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

  • 1
    what have you tried so far -- you may like to upload a MWE
    – js bibra
    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).

\usepackage[siunitx, RPvoltages]{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 (sw-r.out 1) ++(1,0) node[adder, circuitikz/blocks/scale=0.5](ADD){} ++(1,0) coordinate(Aend);
    \draw (sw-r.out 1) -- (ADD.w) node[inputarrow]{} (ADD.e) -- (Aend) node[inputarrow]{};
    \draw (ADD.n) node[inputarrow, rotate=-90]{} -- ++(0,0.5);

enter image description here

  • Very nice answer....perfect!
    – Sebastiano
    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...
    – Rmano
    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.
    – Rmano
    Oct 24 '20 at 16:09

A pstricks solution with the pst-circ package:

\documentclass[11pt, border=6pt, svgnames]{standalone}



\sffamily\psset{dash=4pt 3pt, linewidth=1pt, arrowinset=0, linejoin=1}%, 


enter image description here

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.