1

How to draw circuit like the following using circuitikz enter image description here. Also, I would like to know how to add dashed boxes in some part of the circuit

8
  • 1
    Welcome to TexSE. In order to help you, we need to see what you've already tried in a "My working example" with a minimum code of yours. In other words, help us, help you :) As a start, check maybe tex.stackexchange.com/questions/32839/… or tex.stackexchange.com/questions/32839/… I found them through on Google with site:tex.stackexchange.com <Boolean circuit circuitikz> and checked images.
    – JeT
    Jun 18 '20 at 16:55
  • Which boxes do you want to dash, there are no dashed boxes in your circuit?
    – TobiBS
    Jun 18 '20 at 20:33
  • I want to add a dashed box for example for the AND and the XOR gates together, I mean a big box contain both of them
    – Nehad
    Jun 20 '20 at 2:04
  • @Nehad to do that, use my code from the answer and add \node[fit=(xor)(and), draw, dashed] {}; at the end.
    – TobiBS
    Jun 20 '20 at 14:52
  • @TobiBS It does not work in my overleaf file the same as multiwire :(. No another way to do so?.
    – Nehad
    Jun 20 '20 at 18:01
2

Maybe you want to start playing around with this and ask some more specific questions?

enter image description here

\documentclass[tikz]{standalone}

\usepackage{circuitikz}

\begin{document}
\begin{circuitikz}
    \draw
    (1,0) node[twoportshape, t=S'] (ss) {}
    (2,1.5) node[twoportshape, t=S] (s) {}
    (3,0) node[twoportshape, t=G] (g) {}
    (4,1.5) node[twoportshape, t=G] (gg) {}
    (3,3) node[twoportshape, t=R] (r) {}
    (8,2.25) node[and port] (and) {}
    (12,0.75) node[xor port] (xor) {}
    (and.out) to[multiwire=$\rho$] ++ (1,0) -| (xor.in 1)
    (g.right) to[multiwire=$\rho$] ++ (1,0) -| (xor.in 2)
    (r.right) to[multiwire=$\rho$] ++ (1,0) -| (and.in 1)
    (gg.right) to[multiwire=$\rho$] ++ (1,0) -| (and.in 2)
    (s.right) to[multiwire=$n$] ++ (1,0) -- (gg.left)
    (ss.right) to[multiwire=$n$] ++ (1,0) -- (g.left)
    (0,3)node[left]{b} -- (r.left)
    (0,1.5)node[left]{0} -- (s.left)
    (0,0)node[left]{0} -- (ss.left)
    (xor.out) to[multiwire=$\rho$] ++ (1,0)node[right]{c};
\end{circuitikz}
    
\end{document}
5
  • Thank you very much
    – Nehad
    Jun 20 '20 at 1:55
  • multiwire does not work What can I do?. My tex file doesn't recognize the multiwire command. also if you can teach me how ho add text in top of the wire?
    – Nehad
    Jun 20 '20 at 2:41
  • @NehadMabrouk, check if you have installed the last version of the circuitikz package (version 1.1.2 (2020/05/17) ). For labels of multiwire see package documentation, subsection 3.12 Multiple wires (buses), page 58--59.
    – Zarko
    Jun 20 '20 at 2:46
  • @Zarko I am using an online tex editor (overleaf).
    – Nehad
    Jun 20 '20 at 2:48
  • @NehadMabrouk, than you need to ask Overleaf support for help. Unfortunately, they do not upgrade their LaTeX installation enough frequently :-(.
    – Zarko
    Jun 20 '20 at 2:52

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.