# Spacing circuit element labels from their elements with CircuiTikz

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?

-
It is always best to compose a fully compilable MWE that illustrates the problem including the \documentclass and the appropriate packages so that those trying to help don't have to recreate it. – Peter Grill Mar 15 '12 at 15:44
@PeterGrill thanks. I updated my question accordingly. – mring Mar 15 '12 at 16:54

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:

\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)
\end{circuitikz}
\end{document}

-

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.

-