Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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?

share|improve this question
    
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. –  Pete Mar 15 '12 at 16:54
    
add comment

2 Answers 2

up vote 2 down vote accepted

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}
share|improve this answer
add comment

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.