我为建立联系符号定义了一个注释。它工作得很好,但是当我使用该符号时,我很难覆盖注释的颜色。
我检查了一下,pgfmanual 中的发光二极管也是同样的情况(版本 3.0.1a,第 47.4.1 节)
我的代码和输出如下。我想改变显示 S1 闭合的弧的颜色。任何帮助都将不胜感激...
\documentclass[tikz,border=5pt]{standalone}
\usetikzlibrary{circuits.ee.IEC}
\tikzset{circuit declare annotation={swclosed}{}{(4pt,0pt) edge[to path={arc(45:0:12pt)}]()}}
\begin{document}
\begin{tikzpicture}[circuit ee IEC]
\coordinate (DCpos) at (1,4);
\coordinate (ACout) at (1,2);
\coordinate (DCneg) at (1,0);
\draw [red] (DCpos) to [make contact={swclosed,info={$S1$},red}] (ACout);
\draw (ACout) to [make contact={info={$S2$}}] (DCneg);
\end{tikzpicture}
\end{document}
答案1
\documentclass[tikz,border=5pt]{standalone}
\usetikzlibrary{circuits.ee.IEC}
\tikzset{circuit declare annotation={swclosed}{}{(4pt,0pt) edge[#1,to path={arc(45:0:12pt)}]()}}
\begin{document}
\begin{tikzpicture}[circuit ee IEC]
\coordinate (DCpos) at (1,4);
\coordinate (ACout) at (1,2);
\coordinate (DCneg) at (1,0);
\draw[color=red] (DCpos) to [make contact={swclosed=red,info={[blue]$S1$},red}] (ACout);
\draw (ACout) to [make contact={info={$S2$}}] (DCneg);
\end{tikzpicture}
\end{document}