# Schematic diagram with switches I want to do this diagram in latex. I know how to draw rectangles and arrows (basic tikz user) but doing it symmetrically such that the arrow head is in the center of the box consumes a lot of time (usually need to do it on paper first specifying all the lengths). Is there a faster way of doing this kind of diagrams? Also if you can help with any part of this diagram I can complete the rest. Thank you

• what have you tried so far -- you may like to upload a MWE Oct 22 '20 at 15:59
• Both tikz and circuitikz have libraries of predefined circuit components. Oct 22 '20 at 16:48

If you find yourself doing a lot of manual calculation for maintaining symmetry, I have two suggestions for you:

1. learn to use correctly relative coordinates, coordinate and anchors;
2. learn to use the calc TikZ library (not needed here, but...).

One way to build your diagram is the following one (could be compacted, but I didn't want to use tricks or other similar things --- the code should be straightforward).

\documentclass[border=10pt]{standalone}
\usepackage[siunitx, RPvoltages]{circuitikz}
\begin{document}
\begin{circuitikz}
\draw (0,0) coordinate(A) to[rmeterwa] ++(3,0) coordinate(B);
% circuitikz manual page 105
\node [cute spdt up arrow, anchor=in](sw-r) at (B){};
\node [cute spdt up arrow, anchor=in, xscale=-1](sw-l) at (A){};
\draw [dashed] (sw-l-in) -- (sw-l-out 2);
\draw [dashed] (sw-r-in) -- (sw-r-out 2);
\draw (sw-l.out 1) -- ++(-2,0);
\draw (sw-l.out 2) to[generic, name=G] ++(-2,0);
\node at (G.center) {D};
% circuitikz manual page 71
% put the adder midway between the switch and ++(2,0)
\draw (ADD.n) node[inputarrow, rotate=-90]{} -- ++(0,0.5);
\end{circuitikz}
\end{document} • Very nice answer....perfect! Oct 22 '20 at 19:52
• This solution is a neat but I still need to consult the manual to understand these apparently predefined names before I can modify the diagram at will. Thanks you! Very nice!
– Duns
Oct 23 '20 at 9:59
• Well, it is supposed to be like that --- I mean, reading the manual. Otherwise, the time I and the other developers spent writing it would be a little pity... Oct 23 '20 at 10:13
• @Rmano, yes. Im getting familiar. My changes have finally started compiling XD. I do not want to post another question. Maybe you can help. I want to draw a matrix keypad (letss say 4x6) and connect resistors to each element. Is there a quick way to create such a grid? and can each of the elements be instantiated?
– Duns
Oct 24 '20 at 14:34
• @Duns, not sure to understand you (especially when you talk about "instantiating" elements) ... there is a matrix syntax in TikZ, but you can do that probably with foreach (page 1001 :-) of the TikZ manual.). But it's better ro post another question, just this time show where you got stuck and let people start from there in helping you. Oct 24 '20 at 16:09

A pstricks solution with the pst-circ package:

\documentclass[11pt, border=6pt, svgnames]{standalone}
\usepackage{pst-circ}

\usepackage{sansmath}

\begin{document}

\begin{pspicture}(-5,-1)(6.5,2.5)
\sffamily\psset{dash=4pt 3pt, linewidth=1pt, arrowinset=0, linejoin=1}%,
\SpecialCoor
\pnodes{A}(0,0)(-1.5,0)(1.5,0)
\pnodes{B}(-5,0.75)(-2.5,0.75)(2.5,0.75)(6.4,0.75)
\pnodes{C}(-5,-0.75)(-2.5,-0.75)(2.5,-0.75)
\pnodes(0,0){O}(4.45,2.5){C}
\pcline(B0)(B1)
\resistor[labeloffset=0](C0)(C1){D}
\Ucc(A1)(A2){}
{\psset{linewidth=0.8pt}\psline{->}(0.9;-120)(0.9;60)
\psarc{->}(A1){0.75}{110}{170}\psarcn{->}(A2){0.75}{70}{10}}
{\psset{linewidth=1.5pt}\pcline{-*}(A1)(B1)\pcline[linestyle=dashed]{o-*}(A1)(C1)%
\pcline{-*}(A2)(B2)\pcline[linestyle=dashed]{o-*}(A2)(C2)}
\Ucc[labeloffset=0](B2)(B3){\Large\bfseries+}
\psline{->}(C)(4.45,1.25)\psline{->}(B2)(3.96,0.75)\psline{->}(5,0.75)(6.5,0.75)
\end{pspicture}

\end{document} • Very very nice :-) Oct 22 '20 at 20:16
• Thank you for your kind appreciation, @Sebastiano. Oct 22 '20 at 20:19
• Thanks for the help @Bernard.
– Duns
Oct 23 '20 at 10:00