2

I am trying to add dots to all T-Junctions, I can do it manually, but is there an automatic way to do it?

Preview of the Circuit

\documentclass[a4paper,12pt]{article} 
\usepackage{tikz} %vectorgraphics 
\usetikzlibrary{shapes,arrows,shadows, 
decorations.pathreplacing,backgrounds,calc} %graph/flowchart
\usepackage[siunitx]{circuitikz} 
\begin{document}
\begin{circuitikz} \draw

(0,0) node[nand port] (nand1) {}
(3,0) node[nand port] (nand2) {}
(5,0) node[nand port] (nand3) {}

(3,2) node[nand port] (nand4) {}
(5,2) node[nand port] (nand5) {}

(3,4) node[nand port] (nand6) {}
(5,4) node[nand port] (nand7) {}

(0,4) node[nand port] (nand8) {}

(nand1.out) |- (nand2.in 2)
(nand2.out) -| (nand3.in 1)
(nand2.out) -| (nand3.in 2)

(nand8.out) |- (nand6.in 1)
(nand6.out) -| (nand7.in 2)
(nand6.out) -| (nand7.in 1)

(nand4.out) -| (nand5.in 2)
(nand4.out) -| (nand5.in 1)

(-2,1) node(B1)[anchor=east] {B}
(-2,1) -| (nand1.in 2)
(-2,1) -| (nand4.in 2)
(1,1) |- (nand6.in 2)


(-2,3) node[anchor=east] {A}
(-2,3) -| (nand8.in 1)
(-2,3) -| (nand4.in 1)
(0.5,3) |- (nand2.in 1)

%   (-1.13,3) node[anchor=east] {$\bullet$}
%   (-1.13,0.28) node[anchor=east] {$\bullet$}
%   (-1.13,3.7) node[anchor=east] {$\bullet$}
%   (0.77,3) node[anchor=east] {$\bullet$}
%   (-1.13,1) node[anchor=east] {$\bullet$}
%   (1.25,1) node[anchor=east] {$\bullet$}

%   (3.86,1.97) node[anchor=east] {$\bullet$}
%   (3.86,0.0) node[anchor=east] {$\bullet$}
%   (3.86,4) node[anchor=east] {$\bullet$}
(6,1.97) node[anchor=east] {O2}
(6,0.0) node[anchor=east] {O3}
(6,4) node[anchor=east] {O1}

;\end{circuitikz}
\end{document}
  • 1
    Welcome to TeX.SE! What do you mean with "automatic way"? – Mensch Mar 11 at 21:24
  • If it is possible to say the path into a certain gate should start with a dot, instead of having to add it afterwards. – Roman Stadler Mar 11 at 21:26
  • Using to[short,*-] or node[circ]{} yes. Using -| or |-, no. – John Kormylo Mar 11 at 22:40
  • Aha! node[circ,midway]{} will be placed on a corner using |- etc. – John Kormylo Mar 11 at 22:53
3

Not exactly automatic, but fairly easy to add.

\documentclass[a4paper,12pt]{article} 
\usepackage{tikz} %vectorgraphics 
\usetikzlibrary{shapes,arrows,shadows, 
decorations.pathreplacing,backgrounds,calc} %graph/flowchart
\usepackage[siunitx]{circuitikz} 
\begin{document}
\begin{circuitikz} \draw

(0,0) node[nand port] (nand1) {}
(3,0) node[nand port] (nand2) {}
(5,0) node[nand port] (nand3) {}

(3,2) node[nand port] (nand4) {}
(5,2) node[nand port] (nand5) {}

(3,4) node[nand port] (nand6) {}
(5,4) node[nand port] (nand7) {}

(0,4) node[nand port] (nand8) {}

(nand1.out) |- (nand2.in 2)
(nand2.out) -| node[circ,midway]{} (nand3.in 1)
(nand2.out) -| (nand3.in 2)

(nand8.out) |- (nand6.in 1)
(nand6.out) -| node[circ,midway]{} (nand7.in 2)
(nand6.out) -| (nand7.in 1)

(nand4.out) -| node[circ,midway]{} (nand5.in 2)
(nand4.out) -| (nand5.in 1)

(-2,1) node(B1)[anchor=east] {B}
(-2,1) -| node[circ,midway]{} (nand1.in 1) to[short,*-] (nand1.in 2)
(-2,1) -| (nand4.in 2)
(1,1) node[circ]{} |- (nand6.in 2)


(-2,3) node[anchor=east] {A}
(-2,3) -| node[circ,midway]{} (nand8.in 2) to[short,*-] (nand8.in 1)
(-2,3) -| (nand4.in 1)
(0.5,3) node[circ]{} |- (nand2.in 1)

%   (-1.13,3) node[anchor=east] {$\bullet$}
%   (-1.13,0.28) node[anchor=east] {$\bullet$}
%   (-1.13,3.7) node[anchor=east] {$\bullet$}
%   (0.77,3) node[anchor=east] {$\bullet$}
%   (-1.13,1) node[anchor=east] {$\bullet$}
%   (1.25,1) node[anchor=east] {$\bullet$}

%   (3.86,1.97) node[anchor=east] {$\bullet$}
%   (3.86,0.0) node[anchor=east] {$\bullet$}
%   (3.86,4) node[anchor=east] {$\bullet$}
(6,1.97) node[anchor=east] {O2}
(6,0.0) node[anchor=east] {O3}
(6,4) node[anchor=east] {O1}

;\end{circuitikz}
\end{document}

demo

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.