`\documentclass{article}
\usepackage{graphicx}
\usepackage[american]{circuitikz}
\begin{document}
\begin{figure}
\centering
\begin{circuitikz}
\draw (0,0)
to[V,v=$V$] (0,3)
to[C=$C_1$] (5,3)
to [L=$L_1$] (5,0)
to[short] (0,0);
\end{circuitikz}
\caption{}
\end{figure}
\end{document}
3 Answers
You can invert the voltage source by changing the counting direction of the voltage using v<=$V$
Your full example will look like:
\documentclass{article}
\usepackage{graphicx}
\usepackage[american]{circuitikz}
\begin{document}
\begin{figure}
\centering
\begin{circuitikz}
\draw (0,0)
to[V,v<=$V$] (0,3)
to[C=$C_1$] (5,3)
to [L=$L_1$] (5,0)
to[short] (0,0);
\end{circuitikz}
\caption{}
\end{figure}
\end{document}
-
this doesn't work for me, still it appears the same way, weather I put the < or not, I'm using texlive Dec 12, 2017 at 3:17
-
Ditto, this doesn't work for me, even though the docs say it should (and this does). Using the answer above (drawing the other way around) puts the V on the wrong side of the circuit.– ahaJan 25, 2018 at 18:41
Since version 0.8.3, using v<=$V$
has been removed as a way to change the polarity of a source. The manual recommends using the invert
tag on the element:
\begin{center}
\begin{circuitikz}
\draw (0,0)
to[V, v=$V$, invert] (0,3) %Invert the element to achieve required polarity.
to[C=$C_1$] (5,3)
to[L=$L_1$] (5,0)
to[short] (0,0);
\end{circuitikz}
\end{center}
Inverting also keeps the correct voltage/current direction.
According to the circuitikz documentation:
Voltage directions: until v0.8.3, there was an error in the coherence between american and european voltages styles (see section 5.2) for the batteries. This has been fixed, but to guarantee backward compatibility and to avoid nasty surprises, the fix is available with new options:
- oldvoltagedirection: Use old way of voltage direction having a difference between european and american direction, with wrong default labelling for batteries;
- nooldvoltagedirection: The standard from 0.5 onward, utilize the (German?) standard of voltage arrows in the direction of electric fields (without fixing batteries);
- RPvoltages (meaning Rising Potential voltages): the arrow is in direction of rising potential, like in oldvoltagedirection, but batteries and current > sources are fixed to follow the passive/active standard; – EFvoltages (meaning Electric Field voltages): the arrow is in direction of the electric field, like in nooldvoltagedirection, but batteries are fixed;
If none of these option are given, the package will default to nooldvoltagedirection. The behavior is also selectable circuit by circuit with the voltage dir style.
Solution
Add RPvoltages
option when importing circuitikz package (\usepackage[american, RPvoltages]{circuitikz}
).
The corresponding code is as follows:
\documentclass{article}
\usepackage{graphicx}
\usepackage[american,RPvoltages]{circuitikz}
\begin{document}
\begin{figure}
\centering
\begin{circuitikz}
\draw (0,0)
to[V,v<=$V$] (0,3)
to[C=$C_1$] (5,3)
to [L=$L_1$] (5,0)
to[short] (0,0);
\end{circuitikz}
\caption{}
\end{figure}
\end{document}
(0,0) -> (0,3)
, draw from(0,3) -> (0,0)
). See tex.stackexchange.com/questions/202159/…