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}
Is that about right? Are you sure it wouldn't be easier just to stick a node with text where you want it?
\documentclass[a4paper,oneside,titlepage]{article}
\usepackage[utf8]{inputenc}
\usepackage[siunitx]{circuitikz}
\usepackage{tikz}
\usepackage{siunitx}
\begin{document}
\begin{circuitikz}[scale=1.4]\draw
(0,0) to[C, l=\SI{10}{\micro\farad}] (0,2) -- (0,3)
to[R, l=\SI{2.2}{\kilo\ohm}] (4,3) -- (4,2)
to[L, l=\SI{12}{\milli\henry}, i=$i_1$] (4,0) -- (0,0)
(4,2) to[D*, *-*] (2,0) to [D*, -*] (0,2)
to[R, l=\SI{1}{\kilo\ohm}] (2,2) to[cV, v=\SI{0.3}{\kilo\ohm} $i_1$] (4,2)
(2,0) to[I, i=\raisebox{1.2cm}{\SI{1}{\milli\ampere}\hspace{-0.3cm}}, -*] (2,2)
;
\end{circuitikz}
\end{document}
Also, the ne anchor point should be in the vicinity.
\documentclass[a4paper,oneside,titlepage]{article}
\usepackage[utf8]{inputenc}
\usepackage[siunitx]{circuitikz}
\usepackage{tikz}
\usepackage{siunitx}
\begin{document}
\begin{circuitikz}[scale=1.4]\draw
(0,0) to[C, l=\SI{10}{\micro\farad}] (0,2) -- (0,3)
to[R, l=\SI{2.2}{\kilo\ohm}] (4,3) -- (4,2)
to[L, l=\SI{12}{\milli\henry}, i=$i_1$] (4,0) -- (0,0)
(4,2) to[D*, *-*] (2,0) to [D*, -*] (0,2)
to[R, l=\SI{1}{\kilo\ohm}] (2,2) to[cV, v=\SI{0.3}{\kilo\ohm} $i_1$] (4,2)
(2,0) to[I, n=si1, -*] (2,2)
(si1.ne) node[above]{\SI{1}{\milli\ampere}}
;
\end{circuitikz}
\end{document}
Best Answer
Here I provide a different solution from the one suggested by Peter.
Basically, I define a new kind of label
lx
that accepts two commands: the first one is the component name (for exampleR_1
,C_1
) and the second is dedicated to the component value. Its behaviour is similar to the standardl
, therefore the followings:lx_=...
lx^=...
hold. In conclusion, the command should be used as:
lx_={component_name and component_value}
For instance:
Here is the complete example:
Result: