Tell me more ×
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.

Is it possible to get a labelname in circuitikz to be equal to the output from

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{circuits.ee.IEC}
\usepackage{siunitx}
\begin{document}
\begin{tikzpicture}[circuit ee IEC,every info/.style={font=\footnotesize},set resistor graphic=var resistor IEC graphic]
    \draw (0,0) to[resistor={info={$R_\text{L}=\SI{220}{\ohm}$}}] (2,0);
\end{tikzpicture}
\end{document}

As far I've understood there's no "info" property in circuitikz, so I can't figure out how to do the same with that package. E.g., using something like

\draw (0,0) to[R=$R_1=\SI{2}{\ohm}$] (2,0)

results in an error in circuitikz.

If possible, I'd prefer to use circuitikz over the circuits.ee.IEC library as I like the symbols in circuitikz more.

Best regards, dm

Edit:

circuitikz example that's not working:

\documentclass{article}
\usepackage{tikz}
\usepackage[siunitx,european,americanresistors]{circuitikz}
\begin{document}
\begin{tikzpicture}[american currents]
    \draw (0,0) to[R=$R_1=\SI{2}{\ohm}$] (2,0);
\end{tikzpicture}
\end{document}
share|improve this question
Does it work if you don't use \SI? I've had issues with siunitx and pgfplots, so it could be that it clashes with TikZ. – Mark S. Everitt Dec 21 '11 at 12:36
No, unfortunately. I get the following error: "! Extra }, or forgotten $.\@let@token ...rc@temp ) {\pgf@circ@finallabel {}}" – militiaOfDeath Dec 21 '11 at 12:40
Your code compiles fine for me (looks nice too). I'm on an up to date TeXLive 2011 though. What are you using? – Mark S. Everitt Dec 21 '11 at 12:49
You compile fine when you use circuitikz and a command like i.e. \draw (0,0) to[R=$R_1=\SI{2}{\ohm}$] (2,0) ? I use TexLive 2011, which I updated about two weeks ago. But I'll run an update now and see if it works after the update. Edit: tried to compile now after updating, still the same error when using circuitikz. – militiaOfDeath Dec 21 '11 at 12:52
Oh, I'm sorry, I've misread the question! If possible, could you provide a nearly complete example with circuitikz that you'd like modified? – Mark S. Everitt Dec 21 '11 at 12:53
show 4 more comments

1 Answer

up vote 2 down vote accepted

Putting the label in a \mbox seems to do the trick. Try the following version:

\documentclass{standalone}
\usepackage{tikz}
\usepackage[siunitx,european,americanresistors]{circuitikz}
\begin{document}
\begin{tikzpicture}[american currents]
    \draw (0,0) to[R,label=\mbox{$R_1=\SI{2}{\ohm}$}] (2,0);
\end{tikzpicture}
\end{document}

enter image description here

share|improve this answer
1  
Thanks again for your help! – militiaOfDeath Dec 21 '11 at 13:08
You're most welcome! – Mark S. Everitt Dec 21 '11 at 13:09

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.