Circuitikz 箭头

Circuitikz 箭头

代码:

\documentclass[12pt]{article}
\usepackage{pgfplots}
\usepackage{float}
%\pgfplotsset{compat=1.16}
\usepackage[american,siunitx]{circuitikz}
\usepackage{tikz}
\usepackage{siunitx}
\usetikzlibrary{shapes, arrows.meta, automata, positioning, matrix, calc}
\usepackage[margin=1in]{geometry} 
\begin{document} 
    \begin{figure}[H]
        \centering
        \begin{circuitikz}[declare function = {hypo = 4; x = 1; r ={1/2};}]
            \ctikzset{label/align = straight}
            \draw(0,0) to [battery , l= $V_\textrm{in}$] ++({hypo*sqrt(2) + 2},0);
            \draw(0,0) to[short, i = $I$] ++(0, -5) to[short, -*] ++(1, 0) node[label={below:$C$}](C){} to [R, l_= $R_1$, -*] ++(45:hypo) node[label={above:$A$}](A){} to[R, l_=$R_2$, -*] ++(-45:hypo) node[label = {below:$D$}](D){} to [short] ++(1, 0) to [short, i = $I$] ++(0,5);
            \draw(C) to[R, l^= $R_k$, -*] ++(-45:hypo) node[label = {below:$B$}](B){} to [R, l^=$R_x$, i>^= $I_x$] ++(45:hypo);
            \draw(A) to [rmeter, t=G] (B);
            \draw($(A) + (-x,0)$) -- ++(45:{x*sqrt(2) - r}) coordinate(arcBeforeA);
            \draw(arcBeforeA) arc(135:45:r) node[pos = 0.5, label = {above:$I_A$}]{} coordinate(arcAfterA);
            \draw[-Triangle](arcAfterA) -- ++(-45:{x*sqrt(2) - r});
            \draw($(B) + (-x,0)$) -- ++(-45:{x*sqrt(2) - r}) coordinate(arcBeforeB);
            \draw(arcBeforeB) arc(-135:-45:r) node[pos = 0.5, label = {below:$I_B$}]{} coordinate(arcAfterB);
            \draw[-Triangle](arcAfterB) -- ++(45:{x*sqrt(2) - r});
        \end{circuitikz}
    \end{figure}
\end{document}

输出:

在此处输入图片描述

我意识到Triangle箭头与当前箭头并不完全相同。我甚至尝试了-currarrow在文件中创建箭头,circuitikz.sty而不是-Triangle,但没有成功。如何使弯曲箭头上的箭头与 中的当前箭头(和/或流动箭头)相似circuitikz

答案1

箭射进去的circuitikz并不是真正的钛Z 箭头,有几个原因(部分是历史原因,部分是因为它们用在路径中间,而且据我所知,不可能只在路径的一部分上使用箭头)。最能模仿的箭头circuitikzTriangle,是的。

因此,使用相同箭头的最佳选择是将其用作节点:

 \draw[](arcAfterA) -- ++(-45:{x*sqrt(2) - r}) node[currarrow, rotate=-45, anchor=tip]{};

在此处输入图片描述

完整代码:

\documentclass[12pt]{article}
\usepackage{pgfplots}
\usepackage{float}
\pgfplotsset{compat=1.15}
% you need to explicitly choose a voltage direction, see the warning otherwise!
% circuitikz loads tikz and (with these options) siunitx
\usepackage[RPvoltages, american,siunitx]{circuitikz}
\usetikzlibrary{shapes, arrows.meta, automata, positioning, matrix, calc}
\usepackage[margin=1in]{geometry} 
\begin{document} 
    \begin{figure}[H]
        \centering
        \begin{circuitikz}[declare function = {hypo = 4; x = 1; r ={1/2};}]
            \ctikzset{label/align = straight}
            \draw(0,0) to [battery , l= $V_\textrm{in}$] ++({hypo*sqrt(2) + 2},0);
            \draw(0,0) to[short, i = $I$] ++(0, -5) to[short, -*] ++(1, 0) node[label={below:$C$}](C){} to [R, l_= $R_1$, -*] ++(45:hypo) node[label={above:$A$}](A){} to[R, l_=$R_2$, -*] ++(-45:hypo) node[label = {below:$D$}](D){} to [short] ++(1, 0) to [short, i = $I$] ++(0,5);
            \draw(C) to[R, l^= $R_k$, -*] ++(-45:hypo) node[label = {below:$B$}](B){} to [R, l^=$R_x$, i>^= $I_x$] ++(45:hypo);
            \draw(A) to [rmeter, t=G] (B);
            \draw($(A) + (-x,0)$) -- ++(45:{x*sqrt(2) - r}) coordinate(arcBeforeA);
            \draw(arcBeforeA) arc(135:45:r) node[pos = 0.5, label = {above:$I_A$}]{} coordinate(arcAfterA);
            \draw[](arcAfterA) -- ++(-45:{x*sqrt(2) - r})node[currarrow, rotate=-45, anchor=tip]{};
            \draw($(B) + (-x,0)$) -- ++(-45:{x*sqrt(2) - r}) coordinate(arcBeforeB) ;
            \draw(arcBeforeB) arc(-135:-45:r) node[pos = 0.5, label = {below:$I_B$}]{} coordinate(arcAfterB);
            \draw[](arcAfterB) -- ++(45:{x*sqrt(2) - r})node[currarrow, rotate=45, anchor=tip]{};
        \end{circuitikz}
    \end{figure}
\end{document}

另一种可能性是更好地模仿箭头Triangle,获取箭头的真实大小circuitikz(请注意,它们取决于线宽,所以我在环境开始时获取它---但你明白了)。

\documentclass[12pt]{article}
\usepackage[RPvoltages, american,siunitx]{circuitikz}
\usetikzlibrary{shapes, arrows.meta, automata, positioning, matrix, calc}
\begin{document} 
        \begin{circuitikz}
        \makeatletter
            \newdimen\ctikzAL\newdimen\ctikzAW
            \pgfmathsetlength{\ctikzAL}{ 1.7 * \pgf@circ@Rlen / \ctikzvalof{current arrow scale} + 2*\pgflinewidth}
            \pgfmathsetlength{\ctikzAW}{ 1.6 * \pgf@circ@Rlen / \ctikzvalof{current arrow scale} + 2*\pgflinewidth}
        \makeatother
            \draw (0,2) to[short, i=i1] ++(2,0);
            \path (0,1) to[short, i=i2] ++(2,0);
            \draw[-{Triangle[length=\the\ctikzAL, width=\the\ctikzAW]}, red] (0,1) -- ++(1.0,0); 
            \path[color=yellow] (0,0) to[short, i=i2] ++(2,0);
            \draw[-{Triangle[length=\the\ctikzAL, width=\the\ctikzAW]}, red, opacity=0.5] (0,0) -- ++(1.1,0); 
        \end{circuitikz}
\end{document}

在此处输入图片描述

相关内容