Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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}
share|improve this question
    
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
add comment

1 Answer

up vote 2 down vote accepted
\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

share|improve this answer
    
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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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