Need help with a circuit diagram

I just wrote code for this, and I got it a little bit ugly. Can you help me to fix this. And how to change those nands for not, like it is on nand 3,4,5? Please help!

PS. What I mean by these nands for not or whatever this is

• I'm not quite sure what you want. do you want your NANDs to be NOTs? – naphaneal May 18 '17 at 2:54
• @naphaneal you can see below, there is one answer and it is mine, I couldnt post those links inside this post because I have some sort of limitations of links per post, I dont know. I need just few of those to look like nots, but not those classic not gate we have, but like that one I posted upthere. – Safari8331 May 18 '17 at 11:24
• Where did you get nand gate US from? It's not defined by circuitikz (at least not the latest couple of versions), so your code doesn't work at all here. – Torbjørn T. May 19 '17 at 8:23
• I got them from an online example, thats how I did this. It can compile for me, how do you mean it is not working? @TorbjørnT. – Safari8331 May 20 '17 at 10:02
• That answer doesn't use circuitikz at all, it uses a standard library from the TikZ package. – Torbjørn T. May 20 '17 at 11:14

Use the same technique that Ignasi used in the answer you referred to. Instead of drawing (a) |- (b), draw (a) -- ([xshift=5mm]a) |- (b), (where a and b are the output of one gate and the input of another, or vice versa). \documentclass[border=5mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{shapes.gates.logic.US,shapes.gates.logic.IEC,calc}
\begin{document}
\begin{tikzpicture}[
every circuit symbol/.style={thick},
label distance=2mm,
branch/.style={fill,draw,shape=circle,minimum size=4pt,inner sep=0pt,outer sep=0pt}
]
\node (A) at (0,0) {A};
\node (B) at (1,0) {B};
\node (C) at (2,0) {C};

\node[nand gate US, draw, logic gate inputs=nnn] at ($(C)+(2,-2)$)       (nand1) {};
\node[nand gate US, draw, logic gate inputs=nnn] at ($(nand1)+(3,-2)$)   (nand2) {};
\node[nand gate US, draw, logic gate inputs=n!]  at ($(nand2)+(-3,-1)$)  (nand3) {};
\node[nand gate US, draw, logic gate inputs=!n]  at ($(nand3)+(0.5,-1)$) (nand4) {};
\node[nand gate US, draw, logic gate inputs=n!]  at ($(nand4)+(0,-1)$)   (nand5) {};
\node[nand gate US, draw, logic gate inputs=nnn] at ($(nand1)+(5,-0.5)$) (nand6) {};
\node[nand gate US, draw, logic gate inputs=nnn] at ($(nand2)+(0,-2)$)   (nand7) {};

\foreach \nand in {3,4,5} { % this loop replaces the loop that was here
\node [branch,left=4mm] (a\nand) at (nand\nand.west) {};
\draw (nand\nand.input 1) -| (a\nand) |- (nand\nand.input 2);
}

\draw[black, line width=0.3mm] (A) |- (0,-9); % 9 instead of 8
\draw[black, line width=0.3mm] (A |- nand1.input 1) node[branch] {} -- (nand1.input 1);
\draw[black, line width=0.3mm] (A |- nand2.input 1) node[branch] {} -- (nand2.input 1);
\draw[black, line width=0.3mm] (A |- a4) node[branch] {} -- (a4); % modified

\draw[black, line width=0.3mm] (B) |- (1,-9); % 9 instead of 8
\draw[black, line width=0.3mm] (B |- nand1.input 2) node[branch] {} -- (nand1.input 2);
\draw[black, line width=0.3mm] (B |- nand2.input 2) node[branch] {} -- (nand2.input 2);
\draw[black, line width=0.3mm] (B |- a5) node[branch] {} -- (a5); % modified

\draw (nand1.output) -- ([xshift=3mm]nand1.output) |- (nand6.input 1);
\draw (nand2.output) -- ([xshift=3mm]nand2.output) |- (nand6.input 2);
\draw (nand7.output) -- ([xshift=5mm]nand7.output) |- (nand6.input 3); % modified
\draw (nand6.output) -- ([xshift=0.5cm]nand6.output) node[above] {$f$};

\draw[black, line width=0.3mm] (C) |- (2,-9); % 9 instead of 8
\draw[black, line width=0.3mm] (C |- a3) node[branch] {} -- (a3); % modofied

\draw[black, line width=0.3mm] ($(C |- nand7.input 3) + (0,-2)$) node[branch] (b1) {} --  ([xshift=4cm]b1.center) |- (nand7.input 3); % modified

\draw (nand3.output) -- ([xshift=3mm]nand3.output) |- (nand2.input 3); % modified
\draw (nand4.output) -- ([xshift=2mm]nand4.output) |- (nand7.input 1); % modified
\draw (nand5.output) -- ([xshift=5mm]nand5.output) |- (nand7.input 2); % modified
\end{tikzpicture}

\end{document}
• Thanks, I figured out this on my own, and I was experimenting on this for last 20 minutes haha. But this will help a lot to figure out where and how. Thanks a lot @Torbjørn T. – Safari8331 May 20 '17 at 11:43