I'am having problems creating this simple combinatorial circuit with circuitikz: enter image description here

I don't know how to link the ports between them and how to put the ports in a particular position.

Can someone help me?

  • 1
    There are examples here. See tex.stackexchange.com/questions/386909/… for example. Sep 13, 2019 at 21:49
  • @JohnKormylo thanks Sep 13, 2019 at 22:01
  • You can look also at pages 88-89 of the manual, you have very similar examples. Have a try at it, and if you get stuck post what you have got and we'll try to help you going forward!
    – Rmano
    Sep 13, 2019 at 22:26
  • @GerardoZinno please see if the answer below satisfies your requirement
    – js bibra
    May 4, 2021 at 1:08

2 Answers 2


enter image description here

\usepackage[siunitx, RPvoltages]{circuitikz}
\usetikzlibrary{circuits.logic.US} % TiKZ Library for US Logic Circuits.
\usetikzlibrary{positioning, arrows.meta, calc}

    \ctikzset{logic ports=ieee,}
    \draw [thick]
                %placing the OR port at coordinate 0,0
                %name the OR port as (or)
                %placing a node right of the port with the label B_out  
                (0,0)                                   node [or port](or){} 
                                                        node [right=2pt of or]{\bfseries $\text{B}_{out}$}
                %placing the and port upper side relative to the (or) port
                (or)                ++(-3,2)            node [and port, scale=1.2] (andupper){}                             
                %placing the and port lower side relative to the (or) port
                (or)                ++(-3,-2)           node [and port, scale=1.2] (andlower){}                             
                %connecting and upper output with (or) input 1
                (andupper.out)      -| (or.in 1)            
                %connecting and lower output with (or) input 2  
                (andlower.out)      -| (or.in 2)
                %extending andlower input 2 to left side and label d
                (andlower.in 2)--   ++(-3,0)            node[left]{\bfseries d}
                (andlower.in 1)--   ++(-3,0)            node[left]{\bfseries c}
                (andupper.in 2)--   ++(-3,0)            node[left]{\bfseries b}     coordinate(b) 
                %placing the not port and name it (not) relative to and upper port
                (andupper.in 1)     ++(-1.5,0)          node[not port](not){}
                %connecting the not port to and upper port input
                (andupper.in 1)--   (not.out);
                %draw an imaginary path connecting not input to coordinate (b)
                %this gives the second coordinate (bb) at the downwards turning point on the imaginary path
    \path       (not.in)-|                                                          coordinate(bb)(b);
                %extending the not port input to left upto coordinate (bb) and label a
    \draw       (not.in)--          (bb)                node[left]{\bfseries a}     

Your scheme can be drawn also on the following way:

enter image description here

\ctikzset{logic ports=ieee}

    \begin{circuitikz}[line cap=round,
\draw   (0,2.4) node (A) [and port] {};
\node [notcirc, left] at (A.bin 1) {};
\draw   (0,0.0) node (B) [and port] {}
        ($(A.out)!0.5!(B.out)$) node (C) [or port, right] {}
        (A.out) --  (C.in 1)
        (B.out) --  (C.in 2)
        (A.in 1) node[left] {a}
        (A.in 2) node[left] {b}
        (B.in 1) node[left] {b}
        (B.in 2) node[left] {d}
        (C.out)  node[right] {B\textsubscript{out}};

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .