# draw Logic gates with Circuitikz

I would like to draw the logic circuit but I have some problems. This is my sample code.

\begin{figure}[!htb]
\centering
\begin{circuitikz}[/tikz/circuitikz/bipoles/length=1cm]
\draw

(0,2)   node (myand1) [and port]{}
(myand1.out)  node (Y1)[anchor=south west]  {$A \cdot B$}
(myand1.in 1) node (A1)     [anchor=east,xshift=-1cm]{A}
(myand1.in 2) node (B1)     [anchor=east,xshift=-1cm]{B}

(0,1)         node (mynot1) [not port] {}
(mynot1.out)  node (Ybar)    [anchor=south west]   {}

(2,0)   node (myand2) [and port]{}
(myand2.out)  node (Y2)[anchor=south west,xshift=0.5cm,yshift=-0.5cm]  {$\overline{B} \cdot A$}
(myand2.in 1) node (B2) [anchor=south east]   {$\overline{B}$}

(4,1)   node (myor3) [or port]{}
(myor3.out)  node (Y3)[anchor=south west]  {$A \cdot B + \overline{B} \cdot A$};

%draw line
\draw (myand1.in 1) -- (A1);
\draw (myand1.in 2) -- (B1);
\draw (myand1.in 2) |- (mynot1.in);
\draw (mynot1.out) |- (myand2.in 1) ;

\draw (myand2.out) -| (myor3.in 2);
\draw (myand1.out) -| (myor3.in 1);
\node (Ah1)[xshift=1cm] at (A1) {$\bullet$};
\node at (myand1.in 2) {$\bullet$};
\draw (Ah1) |- (myand2.in 2);

\foreach \Point in {(A1),(B1)}{
\node [xshift=.2cm] at \Point {$\bullet$};
}

\end{circuitikz}
\caption{วงจรลองจิกตามสมการ $X = A \cdot B + B \cdot A$}
\label{fig:exampleLogic}
\end{figure}


This is my result. The input line of the second AND gate does not connect to input A. I tried to create node name Ah1 with code \node (Ah1)[xshift=1cm] at (A1) {$\bullet$}; to make a node point. I draw a line with \draw (Ah1) |- (myand2.in 2);. However, a line does not connect to the Ah1 node.

Thank you for your suggestion in advance.

The drawing can be reduced further, but the main problem you have here is to try to use nodes with a $\bullet$ in it as a connection dot (called "poles" in circuitikz jargon). When you build a node, there is a separation (inner sep) between the content and the rest of the drawing, and this is the gap you see. So the best bet is to use the provided node[circ](name){} for adding the dots...

The minimal changes are these:

\documentclass[border=10pt]{standalone}
\usepackage[siunitx, RPvoltages]{circuitikz}
\begin{document}
\begin{circuitikz}[circuitikz/bipoles/length=1cm, circuitikz/logic ports=ieee]
\draw

(0,2)   node (myand1) [and port]{}
(myand1.out)  node (Y1)[anchor=south west]  {$A \cdot B$}
(myand1.in 1) -- ++(-1,0) node[circ](A1){} node[left]{$A$}
(myand1.in 2) -- ++(-1,0) node[circ](B1){} node[left]{$B$}

(0,1)         node (mynot1) [not port]{}
(mynot1.out)  node (Ybar)   [anchor=south west]{}

(2,0)   node (myand2) [and port]{}
(myand2.out)  node (Y2)[anchor=south west,xshift=0.5cm,yshift=-0.5cm]  {$\overline{B} \cdot A$}
(myand2.in 1) node (B2) [anchor=south east]   {$\overline{B}$}

(4,1)   node (myor3) [or port]{}
(myor3.out)  node (Y3)[anchor=south west]  {$A \cdot B + \overline{B} \cdot A$};

%draw line
\draw (myand1.in 2) node[circ]{} |- (mynot1.in);
\draw ([xshift=-0.5cm]myand1.in 1) node[circ]{} |- (myand2.in 2);
\draw (mynot1.out) |- (myand2.in 1) ;

\draw (myand2.out) -| (myor3.in 2);
\draw (myand1.out) -| (myor3.in 1);

\end{circuitikz}
\end{document} 