How can i draw a circuit like this using circuitikz?
Asked
Active
Viewed 1,274 times
0
1 Answers
3
The following draws your logic circuit. Everything is placed relative to A and if you change something in the A path, the B path should stretch/shrink accordingly.
\documentclass[border=3.14,tikz]{standalone}
\usepackage{circuitikz}
\usetikzlibrary{calc}
\begin{document}
\begin{tikzpicture}
\draw (0,0) coordinate[label={[left]$A$}](A)
to[short,-*] ++(.35,0) coordinate(jA)
-- ++(.25,0) node[american not port, anchor=west](notA){} (notA.east)
node[american and port, anchor=in 1](andA){}
(A) ++(0, -2) coordinate[label={[left]$B$}](B)
to[short,-*] ($(B-|jA)+(0.1,0)$) coordinate(jB)
-- (B-|notA.west) node[american not port, anchor=west](notB){} (notB.east)
node[american and port, anchor=in 2](andB){}
(jA) -- ($(jA)!.8!(jA|-andB.in 1)$) -| (andB.in 1) -- +(.01,0)
(jB) -- ($(jB)!.8!(jB|-andA.in 2)$) -| (andA.in 2) -- +(.01,0)
($(A)!.5!(B)$) coordinate(vc)
(vc-|andB.out) node[american or port, anchor=west](or){}
(andA.out) ++(-.01,0) -| (or.in 1) -- +(0.01,0)
(andB.out) ++(-.01,0) -| (or.in 2) -- +(0.01,0)
(or.out) node[right]{$(\bar{A}\cdot B)+(A\cdot\bar{B})=A\oplus B$}
;
\end{tikzpicture}
\end{document}
Skillmon
- 60,462


pgfmanual,circuitikzuses TikZ below the hood and most of the syntax is "just" TikZ. Also thecircuitikzmanual has quite a few examples and a tutorial inside. – Skillmon Feb 23 '20 at 15:25