# Logical circuits

I am trying to recreate a logical circuit using circuitikz package. I drew the nor ports, and placed it where they should be. I have a problem with connecting it. What approach should I use for the A B C inputs, should I manually draw them from top to bottom. Another question I have is how should I connect the particular inputs for example from A main line to the inputs of gates, and how to achieve the black dot branch connector. And the last question is how to do the gate that takes two same inputs, for example the first gate from bottom (input 1 and 2 are both C). I need it to look the same.

• there both dedicated packages in LaTeX and softwares outside of LaTeX. circuitikz . tex.stackexchange.com/questions/32839/…
– anis
Commented Apr 29, 2023 at 14:08
• Can you post your MWE for the picture you've drawn? I'd be happy to help, just don't have the time to do the entire picture from scratch. Commented Apr 29, 2023 at 21:29
• There are a couple of tutorials in the circuitikz manual, one being this... Please show what you tried and we can help you to overcome problems! Commented Apr 29, 2023 at 22:21
• I understand this is almost a do-it-for-me question, but I think I gave a constructive answer, that was even accepted. This is why I'm asking to reopen it. Commented May 3, 2023 at 20:36

I will not draw the whole circuit for you, but I can give you an idea of how I would do it. To draw nice circuits, easily modifiable and adaptable, the trick is:

1. Use the minimum possible number of absolute (like numeric) coordinates, just the starting point and nothing more.

2. Build the circuit using coordinates relative to the fixed starting points, and then base the rest on the newly positioned element. The trick is to be able to change any number and still have a coherent circuit.

3. You need to make yourself at home with the perpendicular coordinates notation.

The details are in the code comments:

\documentclass[border=10pt]{standalone}
\usepackage[T1]{fontenc}
\usepackage[siunitx, RPvoltages]{circuitikz}
\ctikzset{logic ports = ieee}
\begin{document}
\begin{tikzpicture}[]
\node (A) at (0,0) {A};
\node (B) at (1,0) {B};
\node (C) at (2,0) {C};
% draw vertical lines (adjust them at taste)
\foreach \nod in {A, B, C} \draw (\nod.south) -- ++(0,-4);
% let's add a 3-input nor. Start below A and then adjust the rest with the anchors
% the *- in the short component takes care of the connection dot (although not
% strictly needed here...)
% once fixed the position at ++(3,0), we'll use only relative coordinates, so you can
% just change this number and have the whole thing change coherently
\draw (A) ++(0, -1) to[short, *-] ++(3,0)
node[nor port, number inputs=3, anchor=in 1](N1){N1};
% ok, now use the other input anchors and the perpendicular coordinate system
% to place the other inputs
\draw (N1.in 2) to[short, -*] (B|-N1.in 2);
\draw (N1.in 3) to[short, -*] (C|-N1.in 3);
% the notation you use for the "nor-based not" with both input connected together is not
% really supported (you need a lot of tweaks to get the inputs so tight). I suggest:
% 1) draw the nor port where you like, here below the N1
\node [nor port, anchor=center](N2) at ([yshift=-2cm]N1.center) {N2};
% join the two inputs and connect their center to one of the vertical bus (again, the
% dots are not really necessary, but well, de gustibus...)
% notice the trick to obtain the center of the line...
\draw (N2.in 1) -- coordinate[pos=0.5] (N2 in center) (N2.in 2);
\draw (N2 in center) to [short, *-*] (N2 in center -| B);
% let's add another level just to show off...
\draw (N1.out) -| ++(1,-1) -- ++(1,0)
node[nor port, number inputs=5, anchor=in 1](NA){NA};
% use the "kink" position to be nicely aligned...
\draw (N2.out) -- ++(1,0) |- (NA.in 2);
% ... I suppose you can continue on...
\end{tikzpicture}
\end{document}


The Circuit_macros package has a macro Autologix() that will draw this circuit defined in function notation:

.PS
log_init
F: Autologix(Nor(
Nor(A,B,C),
Nor(A,C,Nor(B,B)),
Nor(B,C,Nor(A,A)),
Nor(Nor(B,B),A,Nor(C,C)),
Nor(Nor(A,A),B,Nor(C,C))),R)
"A" at F.InA above
"B" at F.InB above
"C" at F.InC above
.PE