3

I want to draw a resistor with a resistance value showing and a voltage label showing as well. This is content-wise an MWE of everything I want:

\documentclass{article}
\usepackage[siunitx]{circuitikz}

\begin{document}
\begin{circuitikz}[american]

    \draw (2,0) to[R=90<\ohm>, v_>=$v_g$] (2,2) ;

\end{circuitikz}
\end{document}

but when the resistor is vertical, the v_g variable is extremely close to the resistor, with the - symbol touching the resistor's terminal line, the + symbol even crossing the terminal line, and the v_g down in the zig zags of the resistor. I just started using circuitikz today and am trying to search through the documentation, but does anyone know how to space away the v_>=$variable_name_here$ part?

3

Not sure if there is a better way, but you can use label/align=rotate which produces good results, or add manual spacing (but this does apply to the polarity signs) as shown in the example below.

Here is a comparison of these two options:

enter image description here

\documentclass{article}
\usepackage[siunitx]{circuitikz}

\begin{document}

\begin{circuitikz}[american]
    \draw (0,0) to[R=90<\ohm>, v_>=$v_g$] (0,2)
        node [above] {\tiny\verb|default|};
    \draw (2,0) to[R=90<\ohm>, v_>=$v_g$,label/align=rotate] (2,2)
        node [above] {\tiny\verb|label/align=rotate|};
    \draw (4,0) to[R=90<\ohm>, v_>=$\quad v_g$] (4,2) 
        node [above] {\tiny\verb|\quad|};
\end{circuitikz}
\end{document}
2

This reply may come a bit late, but just in case someone still has an older version of the library (as I happened to have), the problem reported here is fixed in version 0.3.0 of the library.

In its CHANGELOG it states "fixed misalignment of voltage label in vertical bipoles with names", and it fixes that problem, indeed.

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.