我想要在单个 tikzpicture 中拥有两种不同样式的电压箭头(europeanvoltages
和straightvoltages
)。
您可以使用参数
\ctikzset{voltage/distance from node=0}% in \pgf@circ@Rlen units
\ctikzset{voltage/distance from line=.0}% pos. between 0 and 1
\ctikzset{voltage/bump b/.initial=0.0}%
但对于许多不同的箭头来说,这很麻烦。有没有更简单的方法可以做到这一点?
这是 MWE(我希望 U_out 的箭头是直的):
\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{shapes,shapes.arrows,calc,circuits.ee.IEC,calc,datavisualization,datavisualization.polar,math,patterns,datavisualization.formats.functions,external,backgrounds,spy}
\usepackage[compatibility,EFvoltages,european,fetbodydiode]{circuitikz}
\begin{document}
\begin{tikzpicture}
\draw (0,0) to [*L,-o,v^=$U_\mathrm{L}$] ++ (2.2,0) coordinate(endPos);
\draw (0,-2) coordinate(uocvmin) to [*C,-] (0,0);
\draw (uocvmin) to [*short,-o] (uocvmin -| endPos);
\draw (endPos) to [*open,v=$U_\mathrm{out}$] ++(0,-2); %Arrow that should be straight
\end{tikzpicture}
\end{document}
看起来像这样:
与straightvoltages
:
答案1
答案2
您始终可以使用示波器进行临时参数更改。有趣的是,\ctikzset
虽然始终可以创建密钥,但不能使用 来设置直电压/.code
。
\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{shapes,shapes.arrows,calc,circuits.ee.IEC,calc,datavisualization,datavisualization.polar,math,patterns,datavisualization.formats.functions,external,backgrounds,spy}
\usepackage[compatibility,EFvoltages,european,fetbodydiode]{circuitikz}
\makeatletter
\newcommand{\straightV}{\pgf@circuit@bipole@voltage@straighttrue}
\newcommand{\curveV}{\pgf@circuit@bipole@voltage@straightfalse}
\makeatother
\begin{document}
\begin{tikzpicture}
\draw (0,0) to [*L,-o,v^=$U_\mathrm{L}$] ++ (2.2,0) coordinate(endPos);
\draw (0,-2) coordinate(uocvmin) to [*C,-] (0,0);
\draw (uocvmin) to [*short,-o] (uocvmin -| endPos);
\begin{scope}
\straightV
\draw (endPos) to [*open,v=$U_\mathrm{out}$] ++(0,-2); %Arrow that should be straight
\end{scope}
\end{tikzpicture}
\end{document}