2

I would like to add arrows to my open and closed switches. What is the easiest way to do this?

\documentclass{article}
\usepackage[free-standing-units]{siunitx}
\usepackage{circuitikz}

\begin{document}
\begin{circuitikz}[scale=1.5]
\draw (0,0) to [short] (0,2)
to[short,-o](0.75,2);
\draw[ very thick](0.78,2)-- +(30:0.46);
\draw (1.25,2)to[short,o-](2,2)
to [short](2,0)
to [short,-o](1.25,0);
\draw [very thick] (1.22,0)--(0.77,0);
\draw (0.75,0)to [short,o-](0,0);
\end{circuitikz}
\end{document}

Switches

Switches with arrows

  • 1
    CircuiTikz has defined three (four with push button) kind of switches. See package manual on page 17: draw (...) to[cspst] (...) and draw (...) to[ospst] (...). – Zarko Nov 2 '15 at 18:37
  • The closing switch is fine. However I don't like that the opening switch is shown as already open. Is there a way to change it to closed? I like my switches better, just need arrows. – John Nov 2 '15 at 18:41
1

On TikZ way:

\documentclass{article}
\usepackage[free-standing-units]{siunitx}
\usepackage{circuitikz}
\usetikzlibrary[arrows.meta,backgrounds]

    \begin{document}
\begin{circuitikz}[scale=1.5,
    > = {Circle[length=1.6mm,fill=white]}
                    ]
\draw[->,shorten >=-0.8mm]  (0.00,0) |-   (0.75,2);
\draw[<->]                  (1.25,2) -|   (2,0) -- (1.25,0);
\draw[<-,shorten <=-0.8mm]  (0.75,0) --   (0,0);(0.75,0) --   (0,0);
%
\scoped[on background layer]
    \draw[very thick]   (0.75,2) -- + ( 30:0.5)
                        (1.25,0) -- + (180:0.5);
\draw[-{Straight Barb[]}]% arrows of switch   
    (0.75,2) + (+45:0.25) arc (45:-45:2.5mm);
\draw[-{Straight Barb[]}]% arrows of switch 
    (0.75,0) + (-45:0.25) arc (-45:45:2.5mm);

\end{circuitikz}
    \end{document}

enter image description here

Supplement: For arrows with triangle shape you can select one of many oprions, which offer arrows.meta library. With help of library bending you can add to arrows option flex, which better determine direction of arrow's head:

\documentclass{article}
    \usepackage[free-standing-units]{siunitx}
    \usepackage{circuitikz}
\usetikzlibrary[arrows.meta,backgrounds,bending]

    \begin{document}
\begin{circuitikz}[
    > = {Circle[length=1.6mm,fill=white]}
                    ]
\draw[->,shorten >=-0.8mm]  (0.00,0) |-   (0.75,2);
\draw[<->]                  (1.25,2) -|   (2,0) -- (1.25,0);
\draw[<-,shorten <=-0.8mm]  (0.75,0) --   (0,0);
%
\scoped[on background layer]
    \draw[very thick]   (0.75,2) -- + ( 30:0.5)
                        (1.25,0) -- + (180:0.5);
\draw[-{Triangle[angle=60:3pt,flex]}]
    (0.75,2) + (+60:0.3) arc (60:-45:3mm);
\draw[-{Triangle[angle=60:3pt,flex]}]
    (0.75,0) + (-45:0.3) arc (-45:45:3mm);
\end{circuitikz}
    \end{document}

Above code generate the following picture:

enter image description here

| improve this answer | |
  • That's really good! Thanks. I can't find how to change the arrow heads to filled in black triangles instead of just two lines. Is this possible? – John Nov 2 '15 at 20:22
  • @John, of course it is possible. Overview of arrows is in TikZ manual, page 202 -- 2013. From your description I guess that you looking for something as \draw[-{Triangle[angle=60:3pt,flex]}] (0.75,2) + (+60:0.25) arc (60:-45:2.5mm);. For it use you need to add library banding. I will upgrade my answer. – Zarko Nov 2 '15 at 20:45

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.