[Tex/LaTex] Circuitikz voltage direction broke again

circuitikz

In this question, it was brought up that recent versions of Circuitikz reversed the direction of symbols such as batteries. The fix is to insert \tikzset{voltage dir = RP}. This was working for me until I reinstalled my system software (Mac OS) and installed TeX Live 2019. Now that line leads to a console error I do not know the key '/tikz/voltage dir'. What's happening?

EDIT: updating all packages solved the problem.

Best Answer

Your problem is probably a simple version problem, so check I need to use a different version of circuitikz. How can I do that?, please.

But given that the voltage direction problem arises frequently, let me cite the manual here (and as someone said, reading the documentation is pretty dangerous):

Start auto-citing the manual, section 4.6

The default direction/sign for currents and voltages in the components is, unfortunately, not standard, and can change across countries and sometimes across different authors. This unfortunate situation created a bit of confusion in circuitikz across the versions, with several incompatible changes starting from version 0.5. From version 0.9.0 onward, the maintainers agreed a new policy for the directions of bipoles’ voltages and currents, depending on 4 different possible options:

  • oldvoltagedirection, or the key style voltage dir=old: Use the old way of voltage direction having a difference between european and american direction, with wrong default labeling for batteries (it was the default before version 0.5);

  • nooldvoltagedirection, or the key style voltage dir=noold: The standard from version 0.5 onward, utilize the (German?) standard of voltage arrows in the direction of electric fields (without fixing batteries);

  • RPvoltages (meaning Rising Potential voltages), or the key style voltage dir=RP: the arrow is in the direction of rising potential, like in oldvoltagedirection, but batteries and current sources are fixed so that they follow the passive/active standard: the default direction of v and i are chosen so that, when both values are positive:

    • in passive component, the element is dissipating power;
    • in active components (generators), the element is generating power.
  • EFvoltages (meaning Electric Field voltages), or the key style voltage dir=EF: the arrow is in direction of the electric field, like in nooldvoltagedirection, but batteries are fixed;

Notice that the four styles are designed to be used at the environment level: that is, you should use them at the start of your environment as in \begin{circuitikz}[voltage dir=old] ... and not as a key for single components, in which case the behaviour is not guaranteed.

stop auto-citing

Moreover, unless you are re-using old circuits, the best approach is to load the package with your preferred option (arguably, RPvoltages or EFvoltages should be the logical choices):

\usepackage[RPvoltages]{circuitikz}

and stick to it. There is a big fat warning if you do not specify the voltage direction, but I am evaluating removing it, it seems nobody reads warnings...