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.

This time I dive into Circuitikz. Anyway, I've got a problem with the american and european styles of e.g. voltages.

IIRC Voltage drops are counted positive which means the voltage arrow in the pictures goes from + to -, where the current flows.

\documentclass{article}
\usepackage{tikz}
\usepackage[european]{circuitikz}
\begin{document}
\begin{circuitikz}%[american]
  \draw
  (0,0) node[ground] {}
  to [V,v=$U_0$] (0,3) {}
  to [cspst=$t_0$] (2,3) {}
  to [L=$L$,v=$u_L$] (3,3) {}
  to [R=$R$,v=$u_R$] (6,3) {}
  to [C,l_=$C$,v^=$u_C$,i=$i$] (6,0) {}
  to [ground] (6,0) {};
\end{circuitikz}
\end{document}

enter image description here

enter image description here

Please use with/without american option. Please note the signs in american and the arrows in european style which are opposite. As the result the equations would be different using the common laws.

Is it a bug, intentionally or I'm wrong?

Further more, this example shows some other problems: At european style the inductor's arrow is not shown/hidden. At american the inductor's signs are cluttered also.

And, probably a TikZ problem, how to get the 2nd ground symbol?

PS: What's the preferred way to append pictures/pdf here - where to store?

share|improve this question
2  
Please make sure that all images are uploaded using the official stackexchange interface, i.e. the image icon on top of the text field (shortcut: CTRL+G). This ensures that all images are always accessible and do not expire. As new user without image posting privileges simply include the image as normal and remove the ! in front of it to turn it into a link. A moderator or another user with edit privileges can then reinsert the ! to turn it into an image again. –  Roelof Spijker Dec 5 '11 at 13:11
    
This example is far from minimal: the bug presumably has nothing to do with the mathptmx or siunitx packages. Presumably the font declarations are also otiose. Please try to make your example minimal. –  Seamus Dec 5 '11 at 13:16
    
It might indeed be a standard conflict. You should check the sign conventions. But you can change the voltage sign with > character as in v>=$u_L$. For the second ground symbol replace to [ground] (6,0) {}; with to (6,0) node[ground] {};. –  percusse Dec 5 '11 at 14:04
    
Could you (or somebody else) perhaps find a title that is a bit more specific, so users can get a better impression what this question is about without having to go to it first? –  doncherry Dec 5 '11 at 16:30
    
IMO this is basically a problem on writing multi language documents - the convention of counting voltages! Due this this problem here, I can't simply hop between american and e.g. german language/style. I do have to adjust the arrows in all the pictures! Therefore the title may doesn't fit up to 100% the problem here. –  oltx Dec 9 '11 at 6:33
add comment

1 Answer

I don't know whether or not you want to hold on to circuitikz or are willing to use the circuits library of TikZ as well. I prefer the latter. This would be the code and resulting image using that instead. Note that the direction info option is added to show the arrows.

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{circuits.ee.IEC}
\begin{document}
\begin{tikzpicture}[circuit ee IEC,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, direction info={info=$U_0$}}] (0,3)
              to [break contact={info=$t_0$}] (2,3)
              to [inductor={direction info={info=$L$},info'=$u_L$}] (3,3)
              to [resistor={direction info={info=$R$}, info'=$u_R$}] (6,3)
              to [capacitor={direction info={info'=$C$}, info=$u_C$}] (6,1)
              to [ground={near end}] (6,0);
\end{tikzpicture}
\end{document}

TikZ circuit using circuits library

You can change the direction in the direction info by simply adding a <-.

share|improve this answer
    
@percusse: good point. Simply change ground={near start} to ground={near start, rotate=180} and it should be fine. I will edit the code and image to reflect this. –  Roelof Spijker Dec 5 '11 at 14:21
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.