在写一篇关于 RL 电路的文章时,我想处理电流建立和破裂的周期性,我想绘制以下电路。
\begin{circuitikz}[european]
\draw (0,-2) to[vsource, l=$E$] (0,3);
\draw (0,3) to[short, nos] (2,3);
\draw (2,3) to[cute inductor=$(L)$] (2,0);
\draw (2,0) to[R=$R$] (2,-2);
\draw (0,-2) to[short] (2,-2);
\draw (2,3) to[short] (4,3);
\draw (4,3)--(4,-2)--(2,-2);
\end{circuitikz}
这就是我想要的,这就是我得到的!
另外,当我想写入电感器的内部电阻时,cute inductor=$(L,r)$
我收到错误。问题出在哪里?
答案1
像这样?
使用开关符号spdt
(参见circuitikz
包装文档,第 108 页)并使用默认(american
)电路绘图样式:
\documentclass[border=3.141592mm]{standalone}
\usepackage{circuitikz}
\begin{document}
\begin{circuitikz}
\node[spdt, rotate=90] (sw) {};
\draw (sw.in) to [L={$(L,r)$}] ++ (0,-2)
to [R=$R$] ++ (0,-2) coordinate (aux1)
(sw.out 2) node[above] {(2)} to [short] ++ (+1,0) |- (aux1)
(sw.out 1) node[above] {(1)} to [short] ++ (-1,0) coordinate (aux2)
to [vsource, a=$E$] (aux2 |- aux1)
to [short] (aux1);
\end{circuitikz}
\end{document}
对于european
样式,您需要添加circuitikz
选项european
:
\begin{circuitikz}[european]
在这种情况下结果如下:
但是,如果您喜欢混合两种风格,那么 MWE 是:
\documentclass[border=3.141592mm]{standalone}
\usepackage{circuitikz}
\begin{document}
\begin{circuitikz}
\node[spdt, rotate=90] (sw) {};
\draw (sw.in) to [L={$(L,r)$}] ++ (0,-2)
to [R=$R$, european] ++ (0,-2) coordinate (aux1)
(sw.out 2) node[above] {(2)} to [short] ++ (+1,0) |- (aux1)
(sw.out 1) node[above] {(1)} to [short] ++ (-1,0) coordinate (aux2)
to [vsource, a=$E$] (aux2 |- aux1)
to [short] (aux1);
\end{circuitikz}
\end{document}
其生产成果为:
答案2
对于标签,您必须在 $ 内添加花括号:${(L,r)}$,否则解析器会出错。它最终为您提供:
\documentclass[border=3.141592mm]{standalone}
\usepackage{circuitikz}
\begin{document}
\begin{circuitikz}
\node[spdt, rotate=90] (sw) {};
\draw (sw.in) to [L=${(L,r)}$] ++ (0,-2)
to [R=$R$, european] ++ (0,-2) coordinate (aux1)
(sw.out 2) node[above] {(2)} to [short] ++ (+1,0) |- (aux1)
(sw.out 1) node[above] {(1)} to [short] ++ (-1,0) coordinate (aux2)
to [vsource, a=$E$] (aux2 |- aux1)
to [short] (aux1);
\end{circuitikz}
\end{document}```
答案3
这是我的贡献
\documentclass[border=2mm]{standalone}
\usepackage[european, cute inductors]{circuitikz}
\begin{document}
\begin{circuitikz}
\node[spdt, rotate=90] (inter) {};
\draw (inter.in)
to [L, l=\mbox{$(L,r)$}] ++ (0,-2)
to [R, l=$R$] ++ (0,-2) coordinate (aux1)
(inter.out 2) node[above] {(2)}
to [short] ++ (+1,0) |- (aux1)
(inter.out 1) node[above] {(1)}
to [short] ++ (-1,0) coordinate (aux2)
to [vsource, a=$E$] (aux2 |- aux1)
to [short] (aux1);
\end{circuitikz}
\end{document}
我曾经\mbox
写过偶极子 L、r 的细节。
作为欧洲人,我将选项european
直接插入到 circuitikz 封装中。另一方面,正如 Zarko 所指出的,您还必须添加选项cute inductors
以避免获得黑色矩形作为电感器。
答案4
另一个选项是使用cute spdt
,它允许电线水平离开节点:
\documentclass{standalone}
\usepackage{circuitikz}
\begin{document}
\begin{circuitikz}
\node [cute spdt mid, rotate=90] (S) {};
\draw (S.in) to [L=${(L,r)}$] ++ (0,-2)
to [R=$R$, european] ++ (0,-2) coordinate (B)
to [short] ++ (-1,0) coordinate (L)
to [vsource, l=$E$] (L |- S-out 1)
to (S-out 1) node[above] {(1)}
(S-out 2) node[above] {(2)} to [short] ++ (1,0) |- (B);
\end{circuitikz}
\end{document}