# Labeling a circuit element with its symbol and value on both sides

I have modified the circuit code given in Voltage sign convention (European vs. American) in Circuitikz to serve my presentation in circuit making. However, I am unable to change the voltage source into american style [-ve polarity assigns to the terminal connecting to ground]. I looked through the manuals of both circuitikz and tikz but could not get an answer. My question is to how I can label circuit element(s) with its value and the symbol [american format] on both sides in tikzpicture environment. Please help me.

Here is the modified code for your reference:

\documentclass{article}
\usepackage{tikz}
\usepackage[american voltages,american currents]{circuitikz}
%\usepackage[american voltages, american currents,siunitx]{circuitikz}
\usetikzlibrary{arrows,circuits.ee.IEC,positioning}

\begin{document}
\begin{tikzpicture}[circuit ee IEC,american,x=2cm,y=2cm, semithick, every info/.style={font=\footnotesize}, small circuit symbols, set resistor graphic=var resistor IEC graphic]
\draw (0,0) to [ground={near start, rotate=180}] (0,1)
to [voltage source={near start, info=$V_S$,info'=$5\mbox{V}$}] (0,3)
to [break contact={info=$t_0$}] (2,3)
to [inductor={info=$L$,info'=$1\mbox{H}$}] (3,3)
to [resistor={info=$R$, info'=$47\Omega$}] (6,3)
to [capacitor={info'=$C$, info=$247\mbox{pF}$}] (6,1)
to [ground={near end}] (6,0);
\end{tikzpicture}
\end{document}


Here is another style with little bit of clean codes, however, both the component symbol and its value are on the same side:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{arrows, circuits.ee.IEC, positioning}
\usepackage[american voltages, american currents,siunitx]{circuitikz}

\begin{document}
\begin{tikzpicture}[circuit ee IEC,american,x=2cm,y=2cm, semithick, every info/.style={font=\footnotesize}, small circuit symbols, set resistor graphic=var resistor IEC graphic]
\draw (0,0) node[shape=ground]{}
to [V, l=\mbox{$V_S=\SI{5}{\volt}$}] (0,1)
to [cspst , l =$t_0$] (1,1)
to [L, l=\mbox{$L=\SI{1}{\henry}$}] (2,1)
to [R, l=\mbox{$R=\SI{47}{\ohm}$}] (3,1)
to [C, l=\mbox{$C=\SI{247}{\pico\farad}$}] (3,0)
to (3,0) node[shape=ground]{};
\end{tikzpicture}
\end{document}


and output of the above code:

The last example uses tikz with circuittikz library. But labeling on both sides of the component in american format is still unsuccessful!

• As far as I know, with circuitikz one can not directly place labels on both sides of and element, say a voltage source. Indeed the documentation shows two ways l^ and l_ to differentiate the cases. If you really want to do so, you should specify manually one label, once have chosen l_ or l^. Sep 20 '12 at 6:58
• One idea would be to do it by force! Something like that could be useful...\draw[red] (-2.7,1.5) node[above right] {\footnotesize $+V_0$};Give the correct cordinates and I beleive that you will be OK! Sep 20 '12 at 7:06
• @Claudio Fiandrino, thanks for the information. You know we can use either l^ or l_ but not both. I wanted to use both in american formats. It's possible in european formats as shown in first example above. Sep 20 '12 at 8:26
• @Thanos, thanks a lot for another tips using force method. I did that using another force method as shown in last example above. I was just looking for a normal way if possible. It may help me in reducing code size. Sep 20 '12 at 8:48
• @Khaaba, I am not sure I am aware of one more compact way of solving that. Sorry;) Sep 20 '12 at 9:47

Old question, but in the time since it was asked an improvement has been made to CircuiTikz to allow this behavior.

Since Version 0.7, beside the original label (l) option, there is a new option to place a second label, called annotation (a) at each bipole. Up to now this is a beta-test and there can be problems. For example, up to now this option is not compatible with the concurrent use of voltage labels.

The position of (a) and (l) labels can be adjusted with _ and ^, respectively.

# MWE:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{arrows, circuits.ee.IEC, positioning}
\usepackage[american voltages, american currents,siunitx]{circuitikz}

\begin{document}
\begin{tikzpicture}[circuit ee IEC,american,x=2cm,y=2cm, semithick, every info/.style={font=\footnotesize}, small circuit symbols, set resistor graphic=var resistor IEC graphic]
\draw (0,0) node[shape=ground]{}
to [V, invert, l=\mbox{$V_S$}, a={\SI{5}{\volt}}] (0,1)
to [cspst , l =$t_0$] (1,1)
to [L, l=\mbox{$L$}, a=\SI{1}{\henry}] (2,1)
to [R, l=\mbox{$R$}, a=\SI{47}{\ohm}] (3,1)
to [C, l_=\mbox{$C$}, a^=\SI{247}{\pico\farad}] (3,0)
to (3,0) node[shape=ground]{};
\end{tikzpicture}
\end{document}


# Result:

Well, according to the manual you should correctly name your voltage source with american voltage source

\documentclass{article}
\usepackage{tikz}
\usepackage[american voltages,american currents]{circuitikz}
%\usepackage[american voltages, american currents,siunitx]{circuitikz}
\usetikzlibrary{arrows,circuits.ee.IEC,positioning}

\begin{document}
\begin{tikzpicture}[circuit ee IEC,american,x=2cm,y=2cm, semithick, every info/.style={font=\footnotesize}, small circuit symbols, set resistor graphic=var resistor IEC graphic]
\draw (0,0) to [ground={near start, rotate=180}] (0,1)
to [american voltage source={near start, info=$V_S$,info'=$5\mbox{V}$}] (0,3)
to [break contact={info=$t_0$}] (2,3)
to [inductor={info=$L$,info'=$1\mbox{H}$}] (3,3)
to [resistor={info=$R$, info'=$47\Omega$}] (6,3)
to [capacitor={info'=$C$, info=$247\mbox{pF}$}] (6,1)
to [ground={near end}] (6,0);
\end{tikzpicture}
\end{document}

• @s_C, Have you tried running the modified code? It's giving me this error ! Package pgfkeys Error: I do not know the key '/tikz/circuitikz/info' and I am going to ignore it. Perhaps you misspelled it. when I changed the voltage source to american voltage source in the code! Sep 20 '12 at 3:17
• I think it's more your part that follows the name of the component. Normally you should use label. For example : to [american voltage source,l=\SI{5}{\V}] (0,3) assuming that you use the second line with \usepackage[american voltages, american currents,siunitx]{circuitikz}.
– s__C
Sep 20 '12 at 11:32
• Agreed. But still I am unable to label both sides of the component/element with fewer codes. Sep 20 '12 at 12:44

A force method with path command is given below[reference:http://pdp7.org/blog/?p=133, however, this increases number of lines in the code.

Force method MWE:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{arrows, circuits.ee.IEC, positioning}
\usepackage[american voltages, american currents,siunitx]{circuitikz}

\begin{document}
\begin{tikzpicture}[circuit ee IEC,american,x=2cm,y=2cm, semithick, every info/.style={font=\footnotesize}, small circuit symbols, set resistor graphic=var resistor IEC graphic]
\draw (0,0) node[shape=ground]{}
to [V, l=$V_S$] (0,1)
to [cspst , l =$t_0$] (1,1)
to [L, l=$L$] (2,1)
to [R, l=$R$] (3,1)
to [C, l_=$C$] (3,0)
to (3,0) node[shape=ground]{};
\path (0.2,0) to node [right] {$\SI{5}{\volt}$} (0.2,1);
\path (1,0.9) to node [below] {$\SI{1}{\henry}$} (2,0.9);
\path (2,0.9) to node [below] {$\SI{47}{\ohm}$} (3,0.9);
\path (3.2,1) to node [right] {$\SI{247}{\pico\farad}$} (3.2,0);
\end{tikzpicture}
\end{document}


Its output after running: