Here's how you can do this using \matrix
.
\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{circuits.logic.US}
\usetikzlibrary{positioning}
\begin{document}
\begin{tikzpicture}[circuit logic US,
line width=0.8pt,line cap=round,line join=round]
\matrix[column sep=7mm]
{
\node (A) {$A$}; & & & \\
& \node [and gate] (and1) {}; & & \\
\node (B) {$B$}; & & \node [or gate,yshift=-1mm] (or1) {}; & \node[yshift=-1mm] (out) {};\\
\node (C) {$C$}; & & & \\
};
\draw
% AND gate inputs
(A) -- ++(right:5mm) |- (and1.input 1)
(B) -- ++(right:5mm) |- (and1.input 2)
% OR gate inputs
(or1.input 1) -- ++(left:3mm) |- (and1.output)
(or1.input 2) -- ++(left:3mm) |- (C)
% Output
(or1.output) -- (out);
\end{tikzpicture}
\end{document}
Result:
PS. If you want, you can use circuitikz
's logic gates too; just replace and gate
with and port
and similarly for the OR gate. (But somehow circuitikz
's gates are not as well-designed as those of TikZ itself, although it's other electrical elements are.)
circuits.logic.US
library of TikZ instead. Its gates are much more beautiful.