4
\documentclass[border=10pt]{standalone}
\usepackage[american]{circuitikz}

\begin{document}

\begin{circuitikz}
\draw (0,0)
node[transformer] (T) {};
\draw (T.B1)
to [D] (3,0)
to [R] (3,-2.1)
to [short] (T.B2);
\draw (3,0)
to [vR] (6,0)
to [R] (6,-2.1)
to [short] (3,-2.1);
\end{circuitikz}

\end{document}

enter image description here

\documentclass[border=10pt]{standalone}
\usepackage[american]{circuitikz}

\begin{document}

\begin{circuitikz}
\draw (0,0)
node[transformer] (T) {};
\draw (T.B1)
to [D] (3,0)
to [R] (3,-2)
to [short] (T.B2);
\draw (3,0)
to [vR] (6,0)
to [R] (6,-2)
to [short] (3,-2);
\end{circuitikz}

\end{document}

enter image description here

As you can see the generated circuit using the second code doesn't look good but for first code I have to use messy coordinates (2.1 etc.). Is there any way to correct this behavior so that anchors are at proper integer coordinates?

3
  • 1
    Two options: 1) use node[transformer,yscale=<some factor>] or 2) use |--notation to determine the start and end coordinates of the vertical resistors based on the size of the transformer. Feb 20, 2015 at 17:07
  • @PaulGessler are you going to write the answer? Today seems to be the day in which I wrote answers just to find comments saying exactly what I was writing. Feb 20, 2015 at 17:09
  • @GonzaloMedina no time right now; go for it if you want. :-) Feb 20, 2015 at 17:10

1 Answer 1

4

As Paul Gessler mentions in his comment, you can scale the transformer using some factor or, a better approach in my opinion, would be to use the perpendicular coordinate system: (<coordinatea>|-<coordinateb>) or (<coordinateb>-|<coordinatea>) to adjust the vertical/horizontal position of the coordinates:

\documentclass[border=10pt]{standalone}
\usepackage[american]{circuitikz}

\begin{document}

\begin{circuitikz}
\draw (0,0)
node[transformer] (T) {};
\draw (T.B1)
to [D] ++(2,0)
to [R] (3,-2|-T.B2)
to [short] (T.B2);
\draw (3,0)
to [vR] (6,0)
to [R] (6,-2|-T.B2)
to [short] (3,-2|-T.B2);
\end{circuitikz}

\end{document}

enter image description here

You must log in to answer this question.

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