欧洲电压对于开放路径和组件路径有不同的转变。如何恢复向后兼容?

欧洲电压对于开放路径和组件路径有不同的转变。如何恢复向后兼容?

我注意到 Circuitikz 最近的更改修改了欧洲电压箭头的行为。当使用开路而不是元件路径时,电压箭头尖端会放置在不同的位置。开路兼容性对于在绘制元件路径后放置电压箭头非常重要。有没有简单的解决方法?

\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!
\def\coord(#1){coordinate(#1)}
%\def\coord(#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}

答案1

我不确定您在这里想要实现什么,但可以使用(错误命名,我会调整它*)键更改“开路电压”行为american open voltage(参见第 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}

上一个代码片段的输出

相关内容