3

A can't find examples about what I want to do with the circuitTikZ package. I want to put a letter and a black port at the left of this circuit and I want the nand4 to act like an inverter.

\begin{circuitikz} \draw
(0,2) node[nand port] (nand4) {}
(2,3) node[nand port] (nand3) {}
(4,2) node[nand port] (nand2) {}
(0,0) node[nand port] (nand1) {}
(nand1.out) |- (nand2.in 2)
(nand4.out) |- (nand3.in 2)
(nand3.out) |- (nand2.in 1)
;\end{circuitikz}

enter image description here

2
  • 4
    I have no idea what an "inverter" is or what do you mean by a "black port"; can you please add a hand-drawn image of the intended result? Commented Mar 3, 2015 at 14:31
  • I forgot the letters. One letter at the left of each port.
    – user51962
    Commented Mar 3, 2015 at 14:39

1 Answer 1

3

One possibility:

\documentclass{article}
\usepackage{circuitikz}

\begin{document}

\begin{circuitikz} 
\draw
  (0,2) node[nand port] (nand4) {}
  (2,3) node[nand port] (nand3) {}
  (4,2) node[nand port] (nand2) {}
  (0,0) node[nand port] (nand1) {}
  (nand1.out) |- (nand2.in 2)
  (nand4.out) |- (nand3.in 2)
  (nand3.out) |- (nand2.in 1)
  ;
\draw 
    ([xshift=-1cm]nand1.in 1) 
      coordinate (aux) node[left] {$c$} to[short,*-] 
    (nand1.in 1);
\draw 
    ([xshift=-1cm]nand1.in 2) 
        node[left] {$d$} to[short,*-] 
    (nand1.in 2);
\draw 
    (aux|-nand3.in 1) 
        node[left] {$a$} to[short,*-] 
    (nand3.in 1);
\draw
  (nand4.in 1) -- coordinate (middle) (nand4.in 2);
\draw 
    (aux|-middle) 
        node[left] {$b$} to[short,*-] 
    (middle);
\end{circuitikz}

\end{document}

enter image description here

4
  • How can I learn to do this? I already saw the documentation.
    – user51962
    Commented Mar 3, 2015 at 16:52
  • 1
    @Arturo since circuitikz is based on PGF/TikZ, learning some of the latter can be helpful. Commented Mar 3, 2015 at 16:54
  • These NAND gates are really ugly... is there a package dedicated specifically to rendering digital circuits, you know, nicely? Commented Sep 29, 2016 at 22:24
  • 1
    @DmitriNesteruk \ctikzset{logic ports=ieee} gives you better looking logic gates. Commented Dec 30, 2021 at 0:35

You must log in to answer this question.