3

How can I draw a 3-input logic gate with circuitikz? Is there a way to do so?

For example,

\begin{circuitikz}
\draw
  (0,0) node[and port](myand){}
  (myand.in 1) node[left]{A}
  (myand.in 2) node[left]{B}
  (myand.in 3) node[left]{C}
  (myand.out) node[right]{Y}
\end{circuitikz}
  • I don't know about circuitikz, but with tikz you could see this answer. Who knows, maybe it even helps with circuitikz. – morbusg Jan 20 '13 at 23:14
  • Yeah, I've seen it. But it's because I use circuitikz to draw my circuits, so I'm used to it. But thank you anyway. – Gutierrez PS Jan 26 '13 at 16:39
6
\documentclass{minimal}
\usepackage{tikz}
\usetikzlibrary{circuits.logic.US,circuits.logic.IEC}
\begin{document}
    \begin{tikzpicture}[minimum height=0.75cm] 
        \node[or gate US, draw,logic gate inputs=nnn] (A) {}; 
        \foreach \a in {1,...,3}
            \draw (A.input \a -| -1,0) -- (A.input \a); 
        \draw (A.output) -- ([xshift=0.5cm]A.output);
    \end{tikzpicture}

    \begin{tikzpicture}[minimum height=0.75cm] 
        \node[and gate US, draw,logic gate inputs=nnn] (A) {}; 
        \foreach \a in {1,...,3}
            \draw (A.input \a -| -1,0) -- (A.input \a); 
        \draw (A.output) -- ([xshift=0.5cm]A.output);
    \end{tikzpicture}   

\end{document}

enter image description here

By slight modification of this code you can acheive gates with more inputs (modifying inputs=nnn and \foreach \a in {1,...,3}).

For more, check TikZ & PGF manual section 29.3 Page 300

  • I was trying to do it with circuitikz, but it seems there's no way. Thanks anyway. – Gutierrez PS Feb 27 '13 at 23:05
  • @Pouya, this is not working with american nor port. – CroCo Oct 11 '15 at 16:37

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.