I would like to draw the following logic gates. Actually I'm new in latex, so I have no idea how to draw it in latex. I can Draw this in Adobe photoshop, but I know latex produces better image quality. So I want to draw it in latex.
enter image description here

Added : I have tried with the following code, but I can not add the remaining gates. How can I do this?

\begin{tikzpicture}[circuit logic US]
  \node[not gate] (n) {};
  \draw (n.input) -- +(-.1,0);
  \draw (n.output) -- +(.1,0);

More o less:

\begin{tikzpicture}[circuit logic US,
    node distance=8mm]
    \node[and gate] (and1) {};
    \draw (and1.input 1)--++(180:3cm) node[left] (y) {y};
    \draw (and1.input 2)--++(180:3cm) node[left] (z) {z};
    \node[and gate, below =of and1] (and2) {};
    \node[and gate, below =of and2] (and3) {};
    \node[not gate, left=5mm of and2.input 1, scale=.5] (not1) {};
    \node[not gate, left=5mm of and3.input 2, scale=.5] (not2) {};
    \draw (not1)--(and2.input 1);
    \draw (not2)--(and3.input 2);
    \draw (not1.input)--++(180:5mm) coordinate (aux) |- (y);
    \draw (aux) |- (and3.input 1);
    \draw (not2.input)--++(180:10mm) coordinate (aux) |- (z);
    \draw (aux) |- (and2.input 2);

    \node[or gate, right=of and2, anchor=input 1] (or1) {};
    \draw (and2)--(or1.input 1);
    \draw (and3)-|([xshift=-5mm]or1.input 2)--(or1.input 2);

    \node[and gate, right= of or1, anchor=input 1] (and4) {};
    \draw (or1.output)--(and4.input 1);
    \draw (and4.input 2)--++(180:5mm) |- ([yshift=-3mm]and3.south) coordinate (aux) -- (aux-|y.east) node[left] (x) {x};

    \node[or gate, right= of and4, anchor=input 2] (or2) {};
    \draw (and4)-|([xshift=-5mm]or2.input 2)--(or2.input 2);
    \draw (and1)-|([xshift=-5mm]or2.input 1)--(or2.input 1);
    \draw (or2.output)--++(0:1cm);


enter image description here


A more complete option and experiment with edges to draw each arrow, this code is derived from my answer in How to draw logic gates in tikz

RESULT: enter image description here


\documentclass[tikz, border=20pt]{standalone}
        %Environment config
        %Environment styles
            logic gate inputs={normal,normal,normal},
            on grid % Distances from shape centers
    \path % Place gate shapes using positioning commands
        node[and gate US,GateCfg](AND1){} 
        node[and gate US,GateCfg,below=3 of AND1](AND2){}
        node[and gate US,GateCfg,below=3 of AND2](AND3){} 
        node[or gate US,GateCfg, below right= 1.5 and 5 of AND2](OR1){}
        node[and gate US,GateCfg, below right= 0.5 and 5 of OR1](AND4){}
        node[or gate US,GateCfg, above right= 1 and 5 of AND4](OR2){}
        node[not gate US, draw,left=1 of AND2.input 1](N1){}
        node[not gate US, draw,left=1.5 of AND3.input 3](N2){};

    \draw % Coordinate "temp" is redefined in each coordinate (temp) instruction 
            edge[->] ++(3,0)
            -- ++(1,0) coordinate (temp) |- (OR2.input 3) edge[<-]++(-10pt,0)
            -- (AND1-| temp) |- (OR2.input 1) edge[<-]++(-10pt,0)
            edge[->] (OR1 -| AND4.input 1)
            -- ++(2,0) coordinate(temp) |- (OR1.input 1) edge[<-]++(-10pt,0)
            -- (AND3-| temp) |- (OR1.input 3) edge[<-]++(-10pt,0)
        (AND1.input 1)
            -- ++(-4,0) coordinate (init) node[anchor=east]{y}
        (AND1.input 3 -| temp)
            ++(0,5pt) edge (temp.center)
            arc (90:-90:5pt) |- (N1.input) edge[<-]++(-10pt,0)
        (AND2.input 3 -| temp)
            ++(0,5pt) edge (AND2.input 1 -| temp)
            arc (90:-90:5pt) |- (AND3.input 1) edge[<-]++(-10pt,0)
        (AND1.input 3)
            -- ++(-4,0) coordinate (init) node[anchor=east]{z}
        (AND2.input 3 -| temp)
            edge (temp.center)
            edge[->] (AND2.input 3)
        (N2.input -| temp)
            edge (AND2.input 3 -| temp)
            edge[->] (N2.input)
        (AND2.input 1)
            edge[<-] (N1)
        (AND3.input 3)
            edge[<-] (N2)
        (init)++(0,-7) node[anchor=east]{x} 
            -- ++(12,0) coordinate (temp)
            -- (AND4.input 3 -| temp)
            edge[->] (AND4.input 3);


Why tikz picture environment in standalone document class?

It allows you to import the pdf output from the tikz standalone class using graphicx package, without loosing svg or vector properties, within figure environment in the main document scaled by the value \textwidth in:


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.