我试图将所有元件值放在电路的右侧。我见过在 circuitikz 中使用标签节点的解决方案,但我更喜欢将两者分开。
我只能想到以下方法。我需要将标签放在电路顶部或垂直居中。
\documentclass{article}
\usepackage{amsmath}
\usepackage{circuitikz}
\begin{document}
\begin{table}[h]
\centering
\begin{tabular}{|c|c|}
\begin{circuitikz}[european]
\draw (0,0)
node[tlground]{} % The ground
to[V, v^<=$U_0$] (0,2) % The voltage source
to[C, l=$C_1$] (2,2) % The capacitor
to[R=$R_B$] (2,5); % The resistor
\draw
(4,2) node[npn, tr circle] (Q1) {} % The transistor
(Q1.base) to[short] (2,2) % The short
(Q1.collector) to[R=$R_C$] (4,5) % The resistor
(4,3) to[short] (5,3) % The short
node[label={[font=\footnotesize]right:$V_{out}$}] {}
(Q1.emitter) to[short] (4,0) % The short
node[tlground]{};
\draw (0,5)
node[label={[font=\footnotesize]left:$+V_{cc}$}] {}
to[short] (5,5);
\end{circuitikz}
&
% Add labels for component values on the right side
\begin{tabular}[t]{l}
$R_1 = 1\text{k}\Omega$\\
$C_1 = 10\mu\text{F}$\\
$L_1 = 100\text{mH}$
\end{tabular}
\end{tabular}
\end{table}
\end{document}
答案1
啊,我明白了。我通常的做法是选择电路图中的元素,为其命名(命名节点或元素),然后将表格与该元素的基线对齐。例如,在下面,表格与 +V_CC 节点对齐:
\documentclass{article}
\usepackage{amsmath}
\usepackage{circuitikz}
\begin{document}
\begin{table}[h]
\centering
\begin{tabular}{|c|c|}
\begin{circuitikz}[european, baseline=(REF.base)]
\draw (0,0)
node[tlground]{} % The ground
to[V, v^<=$U_0$] (0,2) % The voltage source
to[C, l=$C_1$] (2,2) % The capacitor
to[R=$R_B$] (2,5); % The resistor
\draw
(4,2) node[npn, tr circle] (Q1) {} % The transistor
(Q1.base) to[short] (2,2) % The short
(Q1.collector) to[R=$R_C$] (4,5) % The resistor
(4,3) to[short] (5,3) % The short
node[label={[font=\footnotesize]right:$V_{out}$}] {}
(Q1.emitter) to[short] (4,0) % The short
node[tlground]{};
\draw (0,5)
node[label={[font=\footnotesize]left:$+V_{cc}$}](REF) {}
to[short] (5,5);
\end{circuitikz}
&
% Add labels for component values on the right side
\begin{tabular}[t]{l}
$R_1 = 1\text{k}\Omega$\\
$C_1 = 10\mu\text{F}$\\
$L_1 = 100\text{mH}$
\end{tabular}
\end{tabular}
\end{table}
\end{document}
或者,例如使用 R_C 标签:
\documentclass{article}
\usepackage{amsmath}
\usepackage{circuitikz}
\begin{document}
\begin{table}[h]
\centering
\begin{tabular}{|c|c|}
\begin{circuitikz}[european, baseline=(REFlabel.base)]
\draw (0,0)
node[tlground]{} % The ground
to[V, v^<=$U_0$] (0,2) % The voltage source
to[C, l=$C_1$] (2,2) % The capacitor
to[R=$R_B$] (2,5); % The resistor
\draw
(4,2) node[npn, tr circle] (Q1) {} % The transistor
(Q1.base) to[short] (2,2) % The short
(Q1.collector) to[R=$R_C$, name=REF] (4,5) % The resistor
(4,3) to[short] (5,3) % The short
node[label={[font=\footnotesize]right:$V_{out}$}] {}
(Q1.emitter) to[short] (4,0) % The short
node[tlground]{};
\draw (0,5)
node[label={[font=\footnotesize]left:$+V_{cc}$}] {}
to[short] (5,5);
\end{circuitikz}
&
% Add labels for component values on the right side
\begin{tabular}[t]{l}
$R_1 = 1\text{k}\Omega$\\
$C_1 = 10\mu\text{F}$\\
$L_1 = 100\text{mH}$
\end{tabular}
\end{tabular}
\end{table}
\end{document}
顺便说一句:我强烈建议使用siunitx
测量单位的包。微法拉中的 μ 应该不是处于数学模式...