5

I am new to circuitikz so this question may be too easy for some of you. I want to draw a single pole double throw switch in circuitikz. It can be done with "spdt". However I don't find any example of using it in the manual. I just don't know how to connect this 3-terminal component with the surrounding ones. Can anyone provide an example? Thanks.

1
  • It would be helpful if you composed a fully compilable MWE including \documentclass and the appropriate packages that sets up the problem. Then those trying to help can have something to start with. Solving problems can be fun, but setting them up isn't. Commented Oct 8, 2012 at 3:52

1 Answer 1

6

The three anchors you are looking are <name>.in, <name>.out 1, and <name>.out 2. A little example showing a spdt component alone with its main three anchors, and another one showing how to connect some of these components with others; sorry if the examples lack any "real" meaning (I know nothing about circuits):

\documentclass{article}
\usepackage{circuitikz}

\begin{document}

\begin{circuitikz} \draw
(1,0) node[spdt] (myspdt) {}
(0,0) -- (myspdt.in) 
(myspdt.out 1) -- +(1,0)
(myspdt.out 2) -- +(1,0);
\end{circuitikz}

\vspace{1cm}

\begin{circuitikz} \draw
(2,2) node[spdt] (myspdt1) {}
(2,0) node[spdt] (myspdt2) {}
(0,1) node[spdt] (myspdt3) {}
(5,1) node[and port] (myand) {}
(myspdt3.out 1) -| (myspdt1.in)
(myspdt3.out 2) -| (myspdt2.in)
(myspdt1.out 1) -- (myand.in 1)
(myspdt2.out 2) -- (myand.in 2)
;\end{circuitikz}

\end{document}

enter image description here

2
  • Thanks for your example code. It is great to get started with. One small question: I saw you used "--", "-- +" or "-|" to connect two nodes. What is the difference among them?
    – shva
    Commented Oct 8, 2012 at 4:33
  • 4
    @shva You're welcome! Regarding your questions, (a) -- (b) means a straight line from (a) to (b); (a) |- (b) means a line from (a) to (b), but first vertical and then horizontal (-| means first horizontal, then vertical). Now the plus signs: +(0cm,1cm) means "1cm upwards from the previous specified position" and ++(2cm,0cm) means "2cm to the right of the previous specified position, making this the new specified position". Commented Oct 8, 2012 at 4:45

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .