2

I need some help with the alignment and how to fix all my logic gates using only one A, B and C.

\begin{circuitikz} \draw

(0,4) node[not port, scale=.5](mynotA){}

(mynotA.in) node[left=1](a) {A}

(a) -- (mynotA.in)

(0,3.2) node[not port, scale=.5](mynotB){}

(mynotB.in) node[left = 1](b) {B}

(b) -- (mynotB.in)

(2.5,3.5) node[and port] (myand) {}

(mynotA.out) -| (myand.in 1)

(mynotB.out) -| (myand.in 2)


(4,3) node[and port] (myand1) {}

(myand.out) -- (myand1.in 1)

(myand1.in 2) node[left=3.95](c) {C}

(c) -| (myand1.in 2)


(0,2) node[not port, scale=.5](mynotA1){}

(mynotA1.in) node[left=1](a1) {A}

(a1) -- (mynotA1.in)

(0,1) node[not port, scale=.5](mynotC){}

(mynotC.in) node[left = 1](c1) {C}

(c1) -- (mynotC.in)

(2.5,1.8) node[and port] (myand2) {}

(mynotA1.out) -| (myand2.in 1)

(myand2.in 2) node[left=2.5](b1) {B}

(b1) -| (myand2.in 2)

(4,1.5) node[and port] (myand3) {}

(myand2.out) -| (myand3.in 1)

(mynotC.out) -| (myand3.in 2)

(2.5,0) node[and port] (myand4) {}

(myand4.in 1) node[left=2.5](a2) {A}

(myand4.in 2) node[left=2.5](b2) {B}

(a2) -| (myand4.in 1)

(b2) -| (myand4.in 2)

(4,-0.5) node[and port] (myand5) {}

(myand4.out) -| (myand5.in 1)

(myand5.in 2) node[left=4](c2) {C}

(c2) -| (myand5.in 2)

;
\end{circuitikz}
2

Using [anchor=in 1] or [anchor=in 2] one can place component to precisely line up with other component's outputs.

\documentclass{standalone}
\usepackage{circuitikz}
\begin{document}

\begin{circuitikz} 
\draw
(0,4) node[not port, scale=.5](mynotA){}
(mynotA.in) node[left=1](a) {A}
(a) -- (mynotA.in)
(0,3.2) node[not port, scale=.5](mynotB){}
(mynotB.in) node[left = 1](b) {B}
(b) -- (mynotB.in)
(mynotB.out) node[and port,anchor=in 2] (myand) {}
(mynotA.out) -| (myand.in 1)
%(mynotB.out) -| (myand.in 2)
(myand.out) node[and port,anchor=in 1] (myand1) {}
%(myand.out) -| (myand1.in 1)
(myand1.in 2) node[left=3.95](c) {C}
(c) -- (myand1.in 2)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
(0,2) node[not port, scale=.5](mynotA1){}
(mynotA1.in) node[left=1](a1) {A}
(a1) -- (mynotA1.in)
(0,1) node[not port, scale=.5](mynotC){}
(mynotC.in) node[left = 1](c1) {C}
(c1) -- (mynotC.in)
(mynotA1.out) node[and port,anchor=in 1] (myand2) {}
%(mynotA1.out) -| (myand2.in 1)
(myand2.in 2) node[left=2.5](b1) {B}
(b1) -| (myand2.in 2)
(myand2.out) node[and port,anchor=in 1] (myand3) {}
%(myand2.out) -| (myand3.in 1)
(mynotC.out) -| (myand3.in 2)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
(2.5,0) node[and port] (myand4) {}
(myand4.in 1) node[left=2.5](a2) {A}
(myand4.in 2) node[left=2.5](b2) {B}
(a2) -| (myand4.in 1)
(b2) -| (myand4.in 2)
(myand4.out) node[and port,anchor=in 1] (myand5) {}
%(myand4.out) -| (myand5.in 1)
(myand5.in 2) node[left=4](c2) {C}
(c2) -| (myand5.in 2)
;
\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.