TransWikia.com

European Voltage has different shifts for an open path and a component path. How to return to backward compatibility?

TeX - LaTeX Asked on August 16, 2021

I’ve noticed that recent changes of Circuitikz modified the behaviour of european voltage arrows. When an open path is used instead of a componente path the voltage arrow tip is placed in different positions. The open path compatibility is important to allow the placement of a voltage arrow after drawing the component path. Is there a simple fix for this?

documentclass[10pt]{article}
usepackage[usenames]{color} %used for font color
usepackage{amssymb} %maths
usepackage{amsmath} %maths
usepackage[utf8]{inputenc} %useful to type directly diacritic characters
usepackage[siunitx,american, RPvoltages]{circuitikz}  

% Definitions to help locate nodes. Comment out the second definition when done!
defcoord(#1){coordinate(#1)}
%defcoord(#1){node[circle, inner sep=1pt,pin={[teal, overlay, inner sep=0.5pt, font=tiny, pin distance=0.3cm, pin edge={teal, line width=0.5pt, shorten <=-2pt, {Kite[length=1.5mm]}-{Circle[open,line width=0.5pt,length=0.75mm]}}]45:#1}](#1){}} 

newcommand{flagv}[5] %{x,y}{dx,dy}{name}{label}{color}  e.g. flagv{0,0}{-0.2,0.5}{A}{$A_L$}{red}
{draw[#5!50!gray,Kite-] (#1) -- ($(#1)+(#2)$) node[circle, very thin, inner sep=0pt, minimum size=8pt, draw=#5!25!white, fill=#5!10,font=scriptsize](#3){#4};
}

begin{document}
begin{circuitikz}
    draw[european voltages](-1,0) to[short,-*]  (0,0) coord(1) to[R, v=$V_{12}$] ++(3,0)coord(2) to[short,*-] ++(1,0);

    draw[european, blue, color=blue!50!gray] (1) to[open, v^=$V_{12}$] (2);
    draw[european voltages, color=red!50!gray] (1) to[open, v^=$V_{12}$, voltage shift=2.0 ] (2);

    flagv{1}{0,-0.75}{A}{$A$}{red}
    flagv{2}{0,-0.75}{B}{$B$}{red}

  draw[european, blue, color=blue!50!gray] (A) to[open, v=$V_{AB}$] (B);

end{circuitikz}
end{document}

One Answer

I am not sure what are you trying to achieve here, but the "open voltage" behaviour can be changed with the (misnamed, I will adjust it*) american open voltage key (see section 4.5.5).

documentclass[10pt]{article}
usepackage[T1]{fontenc}   % default since TeXLive 2018
usepackage[utf8]{inputenc} % default since TeXLive 2018
usepackage[siunitx,american, RPvoltages]{circuitikz}
begin{document}
begin{circuitikz}
    draw[blue, color=red!50!gray] (0,0)
        node[draw, circle, inner sep=1pt]{}
        to[european voltages, open, v=$V_{AB}$]
        (3,0)
        node[draw, circle, inner sep=1pt]{}
        ;
    ctikzset{american open voltage=legacy}
    draw[blue, color=blue!50!gray] (0,0)
        node[draw, circle, inner sep=1pt]{}
        to[european voltages, open, v=$V_{AB}$]
        (3,0)
        node[draw, circle, inner sep=1pt]{}
        ;
end{circuitikz}
end{document}

output of the previous snippet

Correct answer by Rmano on August 16, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP