# How to reproduce the following 3 figures

Does anyone know the code for Figures 1, 2, and 3 of Claude Shannon's paper "A Symbolic Analysis of Relay and Switching Circuits"?

I have seen "The Comprehensive LaTeX Symbol List" and the "Circuitikz – Draw electrical networks with TikZ" package, but I can't really see how to produce the fork-like and multi-map-like line-with-circle ending in both directions that is very simple in essence, but without a clear construct symbol or code, from what I can see at present time.

• these are just lines and circldes you could use tikz or no package at all and use picture mode and \line for the lines and \circle and \circle* for the white and black circles. – David Carlisle Jan 5 '18 at 21:29

picture, TikZ, Metapost versions for Figure 3. All three variants can be scaled as needed.

Two small disclaimers:

• There is no fancy automation stuff going on here about placement and centering of the labels in the figures, it's just a bit of tweaking by hand.
• The Metapost version does not center correctly on the page for me. I'm not very experienced with Metapost yet, so I haven't been able to figure out why.

# Result

The Metapost version is scaled differently than the other two here. This can be adjusted, as said. I've added some lipsum text around it to see how it would look on the page; obviously this is not strictly required.

# Code

I've put all three in a single document. If you're going to go with the Metapost version, compile with lualatex.

\documentclass[a4paper]{article}
\usepackage{lipsum}
\usepackage{mflogo}
\usepackage{tikz}
\usepackage{luamplib}
\begin{document}
\lipsum[1]
\begin{figure}
\centering
\begin{picture}(5,3)(2.5,0.5)
\put(0,2){\line(1,0){1}}
\put(1,2){\circle*{0.1}}
\put(1,2){\line(0,1){1}}
\put(1,2){\line(0,-1){1}}
\put(1,3){\line(1,0){1}}
\put(1,1){\line(1,0){1}}
\put(2.05,3){\circle{0.1}}
\put(2.95,3){\circle{0.1}}
\put(2.05,1){\circle{0.1}}
\put(2.95,1){\circle{0.1}}
\put(4,2){\line(0,1){1}}
\put(4,2){\line(0,-1){1}}
\put(3,3){\line(1,0){1}}
\put(3,1){\line(1,0){1}}
\put(4,2){\circle*{0.1}}
\put(4,2){\line(1,0){1}}
\put(2.41,3.25){$x$}
\put(2.41,0.55){$y$}
\put(5.2,1.9){$=$}
\put(5.65,2){\line(1,0){1}}
\put(6.70,2){\circle{0.1}}
\put(7.60,2){\circle{0.1}}
\put(7.65,2){\line(1,0){1}}
\put(6.85,2.25){$x \cdot y$}
\end{picture}
\caption{Interpretation of multiplication. (\texttt{picture} environment)}
\end{figure}
\lipsum[2]
\begin{figure}
\centering
\draw (0,0) -- (1, 0) -- (1, 1) -- (2, 1)
(1, 0) -- (1,-1) -- (2,-1)
(3, 1) -- (4, 1) -- (4, 0) -- (5,0)
(3,-1) -- (4,-1) -- (4, 0)
(2.1, 1) circle (0.1)
(2.1,-1) circle (0.1)
(2.9, 1) circle (0.1)
(2.9,-1) circle (0.1)
(2.5, 1.3) node {$x$}
(2.5,-1.3) node {$y$}
;
\fill (1,0) circle (0.1)
(4,0) circle (0.1)
;
\node at (5.25,-0.02) {$=$};
\draw (5.75,0) -- ++(1,0)
++(1,0) -- ++(1,0)
(6.85,0) circle (0.1)
(7.65,0) circle (0.1)
(7.25,0.3) node {$x \cdot y$}
;
\end{tikzpicture}
\caption{Interpretation of multiplication. (Ti\emph{k}Z version) }
\end{figure}
\mplibtextextlabel{enable}
\begin{figure}
\centering
\begin{mplibcode}
u=10mm; % scaling
beginfig(1);
draw (0,0) -- (1u,0) -- (1u,1u) -- (2u,1u);
draw          (1u,0) -- (1u,-1u) -- (2u,-1u);

draw (3u,1u) -- (4u,1u) -- (4u,0) -- (5u,0);
draw (3u,-1u) -- (4u,-1u) -- (4u,0);

filldraw fullcircle scaled (0.1u) shifted (1u,0);
draw fullcircle scaled (0.1u) shifted (2.05u,1u);
draw fullcircle scaled (0.1u) shifted (2.05u,-1u);
draw fullcircle scaled (0.1u) shifted (2.95u,1u);
draw fullcircle scaled (0.1u) shifted (2.95u,-1u);
filldraw fullcircle scaled (0.1u) shifted (4u,0);

label.top(btex $x$ etex,(2.5u,1u));
label.bot(btex $y$ etex,(2.5u,-1u));
label(btex $=$ etex,(5.25u,0));

draw (5.5u,0) -- (6.75u,0);
draw (7.75u,0) -- (8.75u,0);
draw fullcircle scaled (0.1u) shifted (6.8u,0);
draw fullcircle scaled (0.1u) shifted (7.7u,0);
label.top(btex $x \cdot y$ etex,(7.25u,0));
endfig;
\end{mplibcode}
\caption{Interpretation of multiplication. (\MP{} version) }
\end{figure}
\end{document}

• Thanks a lot, I appreciate it. I went along with the Tikz withouth lualatex output, but in the meanwhile, I was caught by several log error in relation to some accents-related problem, and I could not respond. Indeed, I´m not yet working again on the Project file, and trying to solve the issue... many thanks again – Luis Homem Jan 8 '18 at 15:53
• @alpenwasser - the note at the bottom of page 2 of the mplib user notes explains what to do to get mplib centered. – Thruston Jan 20 '18 at 16:04