latexcircuit

How do you use both curved and straight voltages in LaTeX with circuitikz package?


Currently I am using:

\usepackage[european,straightvoltages]{circuitikz}

and in the body I have only:

\begin{circuitikz}
    \draw
    (0,0) to[R = $R_6$, v = $U_{R6}$] (1.5,0)
          to[R = $R_6$, v = $U_{R6}$] (3,0)
    ;
\end{circuitikz}

Please do not care about the naming. I just need to have both straight and curved voltage in the same file in LaTeX.

Left: curved voltage; right: straight voltage

There is the whole code if it helps:

\documentclass[a4paper,11pt]{article}
\usepackage[european,straightvoltages]{circuitikz}

\begin{document}
    \section{My header}
        \begin{circuitikz}
            \draw
            (0,0) to[R = $R_6$, v = $U_{R6}$] (1.5,0)
            to[R = $R_6$, v = $U_{R6}$] (3,0)
            ;
        \end{circuitikz}
\end{document}

Solution

  • You can use voltage=straight to change the style of individual elements:

    \documentclass[a4paper,11pt]{article}
    \usepackage[european]{circuitikz}
    
    \begin{document}
        \section{My header}
            \begin{circuitikz}
                \draw
                (0,0) to[R = $R_6$, v = $U_{R6}$] (1.5,0)
                to[R = $R_6$, v = $U_{R6}$, voltage=straight] (3,0)
                ;
            \end{circuitikz}
    \end{document}
    

    enter image description here