我很难在 tikz 文档中找到这些。
如何标记电阻(上面是 R,下面是 3Ohm)。如何指示回路电流并指示其方向,如快照所示。
\documentclass{memoir}
\usepackage{tikz}
\usetikzlibrary{circuits.ee.IEC}
\usetikzlibrary{shapes,fit,arrows}
\begin{document}
\begin{figure}
\centering
\begin{tikzpicture}[circuit ee IEC, x=3cm,y=4cm,
thick,
every info/.style={font=\footnotesize},
set resistor graphic=var resistor IEC graphic,
set diode graphic=var diode IEC graphic,
set make contact graphic= var make contact IEC graphic]
\draw (0,0) to [voltage source={direction info={volt=20}}] ++(0,1);
\draw (0,1) to [resistor={info={$R$},ohm=3}] (2,1);
\draw (2,1) to [voltage source ={direction info={volt=10}}]
(2,0);
\draw (2,0) to [resistor={info=$R$}] (0,0);
\end{tikzpicture}
\caption{What is current in shown direction}
\end{figure}
\end{document}
我想显示环路电流,如下所示
答案1
'
在某些电路键后面加上后缀(例如info'
,,ohm'
详情请参阅手册),将注释放在组件的另一侧。
对于中间的圆弧,我认为手动绘制它可能是最好的方法,但在这里我说明了使用带有节点的自定义注释的使用:
\documentclass[tikz,border=5]{standalone}
\usetikzlibrary{circuits.ee.IEC,calc}
\begin{document}
\begin{tikzpicture}[circuit ee IEC, x=3cm, y=4cm, thick,
every info/.style={font=\footnotesize},
set resistor graphic=var resistor IEC graphic,
set diode graphic=var diode IEC graphic,
set make contact graphic= var make contact IEC graphic,
circuit declare annotation={circular annotation}{0}
{ (270:3/16) edge [to path={ arc (270:0:1/8) } ] () }]
\draw (0,0) to [voltage source={direction info={volt=20}}] ++(0,1);
\draw (0,1) to [resistor={info={$R$},ohm'=3}] (2,1);
\draw (2,1) to [voltage source ={direction info={volt=10}}] (2,0);
\draw (2,0) to [resistor={info=$R$}] (0,0);
\node at (1,1/2) [circular annotation] {$I_1$};
\end{tikzpicture}
\end{document}