是否有人知道如何更轻松地获得此结果(无需在 x/y 坐标中定义文本)并可以换行?
\documentclass[]{scrbook}
\usepackage{circuitikz}
\begin{document}
\begin{circuitikz}[scale=1]
% How can I get this easier?
% Like this, but it does not work
% \node [ocirc, label=left:left-aligned{VCC1 out\newline IC523}] (z) at (2,1.5) {};
\node [ocirc, label={[xshift=-1.15cm, yshift=-0.1cm]VCC1 out}] (y) at (2,1.5) {};
\node [ocirc, label={[xshift=-1.0cm, yshift=-0.5cm]of IC523}] (x) at (2,1.5) {};
%
\draw [short,-o] (2,1.5) to [R, l_=$R1$] (5,1.5) to [short,-*] (5,1.5);
\draw (2,1.5) to [R, l=$30 Ohm$] (5,1.5);
% how to define ``R2'' and ``30 Ohm'' in one line?
% \draw (5,1.5) to [R, l_=$R2$, l=$30 Ohm$] (8,1.5) to [short,-*] (8,1.5);
% does not work
\draw (5,1.5) to [R, l_=$R2$] (8,1.5) to [short,-*] (8,1.5);
\draw (5,1.5) to [R, l=$30 Ohm$] (8,1.5);
%
\draw (8,1.5) to [C, l_=$C$] (11,1.5) to [short,-o] (11,1.5);
%How can I get MKS4-100 $100nF$ $100V$ RM7.5 in 4 lines?
% \draw (8,1.5) to [C, l=MKS4-100 \newline $100nF$ \newline $100V$ \newline RM7.5] (11,1.5);
% does not work
\draw (8,1.5) to [C, l=MKS4-100 $100nF$ $100V$ RM7.5] (11,1.5);
\node [ocirc, label=right:{out}] (y) at (11,1.5) {};
\end{circuitikz}
\end{document}
答案1
除了标准标签(用 加)外l
,还可以添加“注释”,用a
。两者都可以在其后加上_
或^
来设置位置。因此您可以这样做l_={..},a^={..}
。
对于节点,您可以在选项中添加align=left
(或center
或),然后可以使用添加换行符。我对 不太熟悉,所以我不知道如何将该样式添加到标签中,因此我改用,用于四行标签。right
\\
circuitikz
l
tabular
还请注意使用siunitx
来书写带单位的数字。一般来说,您可以使用\SI{number}{unit}
,对于circuitikz
标签/注释,您可以使用简写number<unit>
,如下面的代码所示。
整个内容可以写成一条路径,没有任何重复的坐标,如下所示:
\documentclass[]{scrbook}
\usepackage[siunitx]{circuitikz}
\begin{document}
\begin{circuitikz}[scale=1]
\draw [short,-o] (2,1.5)
node[ocirc,label={[align=left]left:VCC1 out\\of IC523}]{}
to [R, l_=$R_1$,a^=30<\ohm>,-*] (5,1.5)
to [R,l_=$R_2$,a^=30<\ohm>,-*] (8,1.5)
to [C, l_=$C$,a^={%
\begin{tabular}[b]{c}
MKS4-100\\
\SI{100}{\nano\farad}\\
\SI{100}{\volt}\\
RM7.5
\end{tabular}}
] (11,1.5)
node[right]{out};
\end{circuitikz}
\end{document}