# Write on 3 lines in ciruitikz diagram

On a circuitikz diagram, I would like to be able to write an annotation on 3 lines: I arrive of course on 2 lines using the command

\draw (0,0) to[rmeter, t=GBF, l2=\SI{1}{\kHz} and \SI{0.05}{\V}]


but I cannot add on a 3rd line resistance $r$ to the rmeter.

My MWE:

\documentclass{article}
\usepackage[european, RPvoltages, straightvoltages]{circuitikz}
\usepackage{siunitx}

\begin{document}
\begin{circuitikz}
\draw (0,0) to[rmeter, t=GBF, l2=\SI{1}{\kHz} and \SI{0.05}{\V}] ++(0,3)  --++(1.5,0) coordinate(charge) to[vR, mirror, invert] ++(0,-3) --++(-1.5,0);
\draw (charge) --++(1.5,0) to[rmeter, t=V] ++(0,-3) --++(-1.5,0);
\end{circuitikz}
\end{document}

• It's a bit of a hack, and I can't check now, but you can try and {\SI{0.05}{\V} \\ resistance $r$}. The correct way is to use a normal label with a stack like the ones you can get from package stackengine. Tomorrow I'll answer if nobody chimes in. – Rmano Jun 10 at 20:33
• @Rmano it works anyway – Nicolas Jun 10 at 20:41
• No, it doesn't work, there is an error... ;-) – Rmano Jun 11 at 8:13

## 1 Answer

l2 labels are put in a tabular environment, so you can try and cheat a bit by adding a two-line second argument. But it is dangerous; braces are stripped and re-positioned during key processing, so it's easy to have an error. In this case,

   ... and {\SI{0.05}{\V} \\  resistance $r$}


gives an error in recent circuitikz and

   ... and \SI{0.05}{\V} \\  resistance $r$


will work, but that's not guaranteed at all. (The bracing of key-values changed between 1.2.2 and recent releases; that should be transparent to the user unless doing undocumented things like that (Yes I know I was the first in suggesting it ;-))).

The correct way of going multiline is to use the stackengine package, and doing something similar to what I did for the voltmeter here:

\documentclass{article}
\usepackage[european, RPvoltages, straightvoltages]{circuitikz}
\usepackage{siunitx}
\usepackage{stackengine}

\begin{document}
\begin{circuitikz}
\draw (0,0) to[rmeter, t=GBF,
% this is more or less an hack
l2=\SI{1}{\kHz} and \SI{0.05}{\V} \\ resistance $r$] ++(0,3)
--++(1.5,0) coordinate(charge) to[vR, mirror, invert]
++(0,-3) --++(-1.5,0);
\draw (charge) --++(1.5,0) to[rmeter, t=V,
% better like this
l = {\Centerstack[l]{{first line} {second line} {third line}}}] ++(0,-3) --++(-1.5,0);
\end{circuitikz}
\end{document} 