1

I have been using MikTex for several years and am familiar with the circuitikz package. I know that if I code a battery as such

\draw (0, 0) to [battery1] (2, 0);

the positive side (long side) will be on the right side of the battery. Within the past 6 months I noticed that my battery directions had changed. Meaning that the above code would produce a battery with the positive side on the left. Besides drawing the battery backwards, does anyone know of an elegant solution?

WRG
  • 11

5 Answers5

2

Having a look at the circuitikz manual this change was made due to an update of the circuitikz package:

Version 0.7 (2016-09-08)

– Fixed/rotated battery symbol (longer lines by default positive voltage)

epR8GaYuh
  • 2,432
2

Please have a look at the latest version 0.8. The drawing direction should now always be as expected: By default is the positive potential and the longer line of the symbol at the starting side of the path, like all the other sources and symbols.

\begin{circuitikz}[american voltages]
\draw (0, 0) to [battery1,v=1V] (2, 0);
\end{circuitikz}

enter image description here

Best regards,

Stefan

sistlind
  • 723
  • The underlying difficulty goes far back, and is unrelated to TeX. On a circuit diagram, the longer line is positive. But on typical consumer batteries (AA, AAA, etc.) the positive end is the one with the button, which might cause someone to think that the circuit diagram should have positive as the shorter line (because it looks like a button). –  Mar 22 '17 at 16:13
2

You can use "invert" to change polarity. This my example

\documentclass{article}
\usepackage{circuitikz}
\begin{document}
\begin{circuitikz}
    \draw  (0,0) to [battery1] (3,0);              % without invert
    \draw  (0,-2) to [battery1, invert] (3,-2);    % with invert
\end{circuitikz}
\end{document}

enter image description here

1

Instead of rewriting all your code, you can tell CircuiTikZ to keep the old direction convention. To do this for your entire document, in the preamble write

\usepackage{circuitikz}
  \tikzset{voltage dir = RP}

To keep the old direction convention in just one drawing, omit \tikzset{voltage dir = RP} in the preamble, but begin the CircuiTikZ environment with \begin{circuitikz}[voltage dir = RP].

As explained in the CircuiTikZ 0.9.4 documentation, RP is for "rising potential." Note: you may have to update your TeX distribution for the "RP" key to be recognized.

Rich006
  • 187
0

I had a problem when i tried to reverse the poles, a line pass trougth the symbol

\documentclass{minimal} \usepackage{circuitikz}

\begin{document}
    \begin{circuitikz}
        \draw (0,0) to[R,l=r](0,3) node[rectangle,draw=blue](A){A}
                    to[R,l=$r_3$]++(0,3) node[](B){B};
        \draw       (A) to[battery,l=$V_1$]++(3,-3);
        \draw       ($(B)+(3,0)$)   to[battery,l=$V_2$] (A);

    \end{circuitikz}
\end{document}

That is what it looks