2

I want to modify this circuit by aligning the inputs x_3, x_1 and x_2 on the same vertical line and placing the left black disc on the intersection of x_1 and the and gate.

    \begin{circuitikz}
            \node[and port] (A) at (0, 0) {};
            \node at (A) [ocirc,fill=black] {};
            \node[left] at (A.in 1) {\(x_1\)};
            \node[left] at (A.in 2) {\(x_2\)};
            
            \node at (A.bin 1) [ocirc,fill=black] {};
            \node[or port] (B) at (2.7,-0.28) {};
            \node (in3) at ($(B.in 2) - (3, 0)$) {};
            \draw (in3) -- (B.in 2);
            \node at (in3)  {\(x_3\)};
            \node[right] at (B.out) {\((x_1'x_2)'+x_3\)};
            
            \draw (A.out)  --  (B.in 1);
        \end{circuitikz}

This produces this

enter image description here

But I want this

enter image description here

How do I also make the inverter symbol a black disc instead of a circle?

4
  • For the inverter, just use \node at (A) [ocirc,fill=black] {};. For the rest of the question, I didn't understand exactly what you want. Maybe if you drew a sketch of it?
    – SebGlav
    Commented Apr 29, 2021 at 21:47
  • tex.stackexchange.com/questions/583841/…
    – js bibra
    Commented Apr 30, 2021 at 13:10
  • If you don't mind deforming the gate slightly you could try \node[and port, yscale=0.75] (A) at (0, 0) {};. This scales the y dimensions of the gate by 0.75 times which is enough that there is no overlap and the circuit is still mostly the same.
    – Willoughby
    Commented Apr 30, 2021 at 21:54
  • yes. It slightly deforms the x_3 input
    – Manjoy Das
    Commented Apr 30, 2021 at 22:03

1 Answer 1

6

Maybe this? But you may be more specific about what you need.

circuit v1

\documentclass{article}
\usepackage{circuitikz}
\begin{document}

\begin{circuitikz}
        \node[and port, number inputs=1] (A) at (0, 0) {};
        \node at (A) [ocirc,fill=black] {};
        \node[left] at (A.in 1) {\(x_1\)};
        \node[left] at (A.in 2) {\(x_2\)};
        
        \node[or port] (B) at (4,0.28) {};
        \node[left] at (B.in 1) {\(x_3\)};
        \node[right] at (B.out) {\((x_1'x_2)'+x_3\)};
        
        \draw (A.out)  --  (B.in 2);
    \end{circuitikz}

\end{document}

EDIT

So maybe this one?

V2

\documentclass{article}
\usepackage{circuitikz}
\begin{document}

\begin{circuitikz}
        \node[and port, number inputs=1] (A) at (0, 0) {};
        \node at (A) [ocirc,fill=black] {};
        \node[left] at (A.in 1) {\(x_1\)};
        \node at (A.left) [yshift=8pt,ocirc,fill=black] {};
        \node[left] at (A.in 2) {\(x_2\)};
        
        \node[or port] (B) at (3,-.65) {};
        \node[left] at (B.in 2-| A.in 1) (x3) {\(x_3\)};
        \node[right] at (B.out) {\((x_1'x_2)'+x_3\)};
        
        \draw (A.out)  --++ (1,0) |-  (B.in 1);
        \draw (x3)  --  (B.in 2);
    \end{circuitikz}

\end{document}

SECOND EDIT

Following OP's demand, I propose another evolution of the solution, but it's now mandatory to scale the OR gate a bit.

V3

\documentclass{article}
\usepackage{circuitikz}
\begin{document}

\begin{circuitikz}
        \node[and port, number inputs=1] (A) at (0, 0) {};
        \node at (A) [ocirc,fill=black] {};
        \node[left] at (A.in 1) {\(x_1\)};
        \node at (A.in 1) [xshift=6.5pt,ocirc,fill=black] {};
        \node at (A.left) [yshift=8pt,ocirc,fill=black] {};
        \node[left] at (A.in 2) {\(x_2\)};
        
        \node[or port,scale=1.2] (B) at (3,-.35) {};
        \node[left] at (B.in 2-| A.in 1) (x3) {\(x_3\)};
        \node[right] at (B.out) {\((x_1'x_2)'+x_3\)};
        
        \draw (A.out)  -- (B.in 1);
        \draw (x3)  --  (B.in 2);
    \end{circuitikz}

\end{document}
5
  • I want x_1,x_2 and x_3 to be on the same vertical line
    – Manjoy Das
    Commented Apr 30, 2021 at 9:52
  • I edited my answer to add this feature. But you can't align x1 x2 and x3 vertically without using a fork link between the two gates (it would end in having x2 and x3 crashed).
    – SebGlav
    Commented Apr 30, 2021 at 15:23
  • after searching for so long, I found an image that could describe my need. I have updated my requirements. Sorry for this trouble.
    – Manjoy Das
    Commented Apr 30, 2021 at 20:37
  • And so I edited my answer once again. Hope it will nicely fit your needs, even if I don't really understand why the fork link seems to bother you like this ;)
    – SebGlav
    Commented Apr 30, 2021 at 22:26
  • There's no problem with the fork line. Actually I'm learning in this way how to manipulate lines and gaps like this.
    – Manjoy Das
    Commented Apr 30, 2021 at 22:48

You must log in to answer this question.

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