2

I use scalebox to scale the label of a component in circuitikz. For example, to[R,l_=$\scalebox{2}{2\si{\ohm}}$,*-*] which scales the label with no problem, however, when I try this to[cV,l^=$\scalebox{2}{2 v_x}$], it throws out this error ! Missing $ inserted.

\documentclass[border={5}]{standalone}
\usepackage[utf8]{inputenc}
\usepackage[siunitx]{circuitikz}

\begin{document}

\begin{circuitikz}[ultra thick,>=latex,american voltages]
\draw
(0,0) to[R,l_=$\scalebox{2}{2\si{\ohm}}$,*-*] (6,0) to[cV,l^=$\scalebox{2}{2 v_x}$] (12,0);
\end{circuitikz}

\end{document}

I've faced this problem before and I've solved it by placing curly brackets (i.e. {=}) but this solution is not working with v{_}x.

2
  • Why not l^=\scalebox{2}{2 $v_x$}
    – Salim Bou
    Oct 16, 2016 at 8:21
  • @SalimBou, perfect, never thought about it. Please add it as an answer.
    – CroCo
    Oct 16, 2016 at 8:24

1 Answer 1

2

Rather then l^=$\scalebox{2}{2 v_x}$ you can just add l^=\scalebox{2}{2 $v_x$}, also for l_ you can remove $ (label does not include superscript or subscript)

\documentclass[border={5}]{standalone}
\usepackage[utf8]{inputenc}
\usepackage[siunitx]{circuitikz}

\begin{document}

\begin{circuitikz}[ultra thick,>=latex,american voltages]
\draw
(0,0) to[R,l_=\scalebox{2}{2\si{\ohm}},*-*] (6,0) to[cV,l^=\scalebox{2}{2 $v_x$}] (12,0);
\end{circuitikz}

\end{document}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .