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 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
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}
nand gate USfrom? It's not defined bycircuitikz(at least not the latest couple of versions), so your code doesn't work at all here. – Torbjørn T. May 19 '17 at 08:23\documentclass{article}to your code and try it, I get an error saying thatnand gate USis unknown. It is not mentioned in thecircuitikzmanual either. – Torbjørn T. May 20 '17 at 10:07second answer here @TorbjørnT.
– Safari8331 May 20 '17 at 11:10circuitikzat all, it uses a standard library from the TikZ package. – Torbjørn T. May 20 '17 at 11:14