Take the 2-minute tour ×
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.

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}

Wanted to replace the european symbol into american symbol

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:

enter image description here

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

share|improve this question
1  
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^. –  Claudio Fiandrino Sep 20 '12 at 6:58
1  
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! –  Thanos 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. –  Khaaba 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. –  Khaaba Sep 20 '12 at 8:48
    
@Khaaba, I am not sure I am aware of one more compact way of solving that. Sorry;) –  Thanos Sep 20 '12 at 9:47
show 3 more comments

2 Answers 2

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}
share|improve this answer
    
@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! –  Khaaba 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. –  Khaaba Sep 20 '12 at 12:44
add comment

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:

enter image description here

share|improve this answer
    
Welcome to TeX.SX. While your answer is appreciated, if you intend to receive suggestions, I guess you may want to write up a question post. Thank you. –  kan Sep 23 '12 at 9:08
    
@KannappanSampath, I have been putting my question up there[please scroll up]. Still waiting for answers with minimal code without path command. –  Khaaba Sep 23 '12 at 11:20
add comment

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.