Possible runaway argument using circuitikz
The main point is made by siracusa: the parser gets confused by the [...]
which are nested in the trouble-making line. This can be resolved by making the respective coordinate a symbolic coordinate via
\path ([xshift=10mm]nmos9.drain) coordinate (aux);
In addition you cannot have spaces around --
in kinky cross=...
. This is because it is not an ordinary path, where spaces would have been indeed allowed, but some style defined via style args
.
\documentclass[tikz]{standalone}
\usepackage[compatibility]{circuitikz}
\ctikzset{bipoles/length=1cm}
\tikzset{
declare function={% in case of CVS which switches the arguments of atan2
atan3(\a,\b)=ifthenelse(atan2(0,1)==90, atan2(\a,\b), atan2(\b,\a));},
kinky cross radius/.initial=+.125cm,
@kinky cross/.initial=+, kinky crosses/.is choice,
kinky crosses/left/.style={@kinky cross=-},kinky crosses/right/.style={@kinky cross=+},
kinky cross/.style args={(#1)--(#2)}{
to path={
let \p{@kc@}=($(\tikztotarget)-(\tikztostart)$),
\n{@kc@}={atan3(\p{@kc@})+180} in
-- ($(intersection of \tikztostart--{\tikztotarget} and #1--#2)!%
\pgfkeysvalueof{/tikz/kinky cross radius}!(\tikztostart)$)
arc [ radius =\pgfkeysvalueof{/tikz/kinky cross radius},
start angle=\n{@kc@},
delta angle=\pgfkeysvalueof{/tikz/@kinky cross}180 ]
-- (\tikztotarget)
}
}
}
\begin{document}
\begin{tikzpicture}[every text node part/.style={align=right}]
\def\fourthlx{9}
\node[nmos, xscale=-1] (nmos7) at (\fourthlx,0) {};
\node[nmos, xscale=-1] (nmos8) at (\fourthlx,1.1) {};
\node[nmos, xscale=-1] (nmos9) at (\fourthlx,2.2) {};
\node[circ] (topresreplica) at ([yshift=15mm] nmos9.drain) {};
\draw (topresreplica.center) to[*R] ([yshift=2mm] nmos9.drain) -- (nmos9.drain);
\def\fifthlx{15.5}
\node[nmos] (nmos10) at (\fifthlx,0) {};
\node[nmos] (nmos11) at (\fifthlx-1,1.1) {};
\node[nmos, xscale=-1] (nmos12) at (\fifthlx+1,1.1) {};
\node[nmos, xscale=-1] (nmos13) at (\fifthlx-1,2.2) {};
\node[nmos] (nmos14) at (\fifthlx+1,2.2) {};
\node[circ] (topres1) at ([yshift=15mm] nmos13.drain) {};
\node[circ] (topres2) at ([yshift=15mm] nmos14.drain) {};
\draw (topres1.center) to[*R] ([yshift=2mm] nmos13.drain) -- (nmos13.drain);
\draw (topres2.center) to[*R] ([yshift=2mm] nmos14.drain) -- (nmos14.drain);
\draw (nmos7.gate) -- (nmos10.gate);
\draw let \p{A} = ([xshift=20mm] nmos7.gate), \p{B} = (nmos9.drain) in
node (temp) at (\x{A},\y{B}) {}
($(\p{A})!0.5!(temp)$) to[*R] (\p{A}) node[circ] {}
(temp) to[*C] ($(\p{A})!0.5!(temp)$)
(temp) to[*short,-*] (\p{B})
;
\draw (nmos11.source) to[*short,-*] (nmos10.drain) to[*short] (nmos12.source);
\draw (nmos13.gate) -- (nmos14.gate);
\node (errtest) at ([yshift=8mm] nmos9.gate) {};
\path ([xshift=10mm]nmos9.drain) coordinate (aux);
\draw ($(nmos13.gate)!0.5!(nmos14.gate)$) to[*short,*-] ([yshift=8mm] $(nmos13.gate)!0.5!(nmos14.gate)$) to[kinky cross=(nmos13.drain)--(topres1.center), kinky crosses=left] (errtest.center)
(errtest.center) to[kinky cross=(nmos9.drain)--(aux), kinky crosses=right] (nmos9.gate);
\end{tikzpicture}
\end{document}
Just for fun, I redrew the entire circuit without using a single xshift or yshift.
\documentclass[tikz]{standalone}
\usepackage[compatibility]{circuitikz}
\ctikzset{bipoles/length=1cm}
\tikzset{
declare function={% in case of CVS which switches the arguments of atan2
atan3(\a,\b)=ifthenelse(atan2(0,1)==90, atan2(\a,\b), atan2(\b,\a));},
kinky cross radius/.initial=+.125cm,
@kinky cross/.initial=+, kinky crosses/.is choice,
kinky crosses/left/.style={@kinky cross=-},kinky crosses/right/.style={@kinky cross=+},
kinky cross/.style args={(#1)--(#2)}{%
to path={
let \p{@kc@}=($(\tikztotarget)-(\tikztostart)$),
\n{@kc@}={atan3(\p{@kc@})+180} in
-- ($(intersection of {\tikztostart}--{\tikztotarget} and #1--#2)!%
\pgfkeysvalueof{/tikz/kinky cross radius}!(\tikztostart)$)
arc [ radius =\pgfkeysvalueof{/tikz/kinky cross radius},
start angle=\n{@kc@},
delta angle=\pgfkeysvalueof{/tikz/@kinky cross}180 ]
-- (\tikztotarget)
}
}
}
\begin{document}
\begin{tikzpicture}[every text node part/.style={align=right}]
\def\fourthlx{9}
\node[nmos, xscale=-1] (nmos7) at (\fourthlx,0) {};
\node[nmos, xscale=-1] (nmos8) at (\fourthlx,1.1) {};
\node[nmos, xscale=-1] (nmos9) at (\fourthlx,2.2) {};
\path (nmos9.drain) ++(0,15mm) coordinate (topresreplica);
\draw (nmos9.drain) -- ++(0,2mm) to[*R,-*] (topresreplica);
\def\fifthlx{15.5}
\node[nmos] (nmos10) at (\fifthlx,0) {};
\node[nmos] (nmos11) at (\fifthlx-1,1.1) {};
\node[nmos, xscale=-1] (nmos12) at (\fifthlx+1,1.1) {};
\node[nmos, xscale=-1] (nmos13) at (\fifthlx-1,2.2) {};
\node[nmos] (nmos14) at (\fifthlx+1,2.2) {};
\node[circ] (topres1) at (nmos13.drain |- topresreplica) {};
\node[circ] (topres2) at (nmos14.drain |- topresreplica) {};
\draw (nmos13.drain) -- ++(0,2mm) to[*R] (topres1.center);
\draw (nmos14.drain) -- ++(0,2mm) to[*R] (topres2.center);
\draw (nmos7.gate) -- (nmos10.gate);
\path (nmos7.gate |- nmos9.drain) -- ++(20mm,0) coordinate (topthingy);
\path (nmos7.gate -| topthingy) coordinate (bottomthingy);
\draw (nmos9.drain) to[*short,*-] (topthingy)
to[*C] ($(topthingy)!0.5!(bottomthingy)$)
to[*R,-*] (bottomthingy);
\draw (nmos11.source) to[*short,-*] (nmos10.drain) to[*short] (nmos12.source);
\draw (nmos13.gate) -- (nmos14.gate);
\path (nmos9.gate) ++(0,8mm) coordinate (errtest);
\draw ($(nmos13.gate)!0.5!(nmos14.gate)$) coordinate (midgate)
to[*short,*-] (errtest -| midgate)
to[kinky cross=(nmos13.drain)--(topres1), kinky crosses=left] (errtest)
to[kinky cross=(nmos9.drain)--(topthingy), kinky crosses=right] (nmos9.gate);
\end{tikzpicture}
\end{document}