我做学校项目,里面有 circuitikz 电路和每个电路的一些方程式。我想把它们放在一起,把图片放在左边,把方程式放在右边——就像附图一样。也不想让块覆盖前一个。试过多列,但它强制两列宽度相同,也不允许我在方程式上方添加任何空间。有什么想法吗?谢谢。看起来
\begin{multicols}{2}
\centering
\resizebox{8cm}{!}{
\begin{circuitikz} \draw
(0,0) to[dcvsource, l=$U_{12}$] (0,4)
%connect 0,0 with R1
(0, 4) -- (0.75, 4)
to[R, *-*, l=$R_{12}$] (4,4)
%parallel R1,2, R3
(0.75,4) -- (0.75,2)
to[R, -*, l=$R_3$] (4,2)
to[R, l=$R_4$] (4, 4)
to[R, l=$R_5$] (8, 4)
(8,4) -- (8,0)
(4,2) -- (4, 2)
to[R, -*, l=$R_6$] (8,2)
(8, 0) -- (4, 0)
to[R, l=$R_{78}$]
(2, 0) -- (0,0)
;
\end{circuitikz}
}
\columnbreak
\begin{itemize}
\item $R_{12} = R_1 + R_2$
\item $U = U_1 + U_2$
\end{itemize}
\end{multicols}
答案1
那这个呢?
\documentclass[11pt,a4paper]{report}
\usepackage{amsthm,amsmath,amssymb,amsfonts}
\usepackage{circuitikz}
\usepackage{showframe}
\begin{document}
Using \verb|\parbox[text]{width}{text}|:
\parbox[c]{.5\linewidth}{%
\begin{circuitikz}[scale=.6] \draw
(0,0) to[dcvsource, l=$U_{12}$] (0,4)
%connect 0,0 with R1
(0, 4) -- (0.75, 4)
to[R, *-*, l=$R_{12}$] (4,4)
%parallel R1,2, R3
(0.75,4) -- (0.75,2)
to[R, -*, l=$R_3$] (4,2)
to[R, l=$R_4$] (4, 4)
to[R, l=$R_5$] (8, 4)
(8,4) -- (8,0)
(4,2) -- (4, 2)
to[R, -*, l=$R_6$] (8,2)
(8, 0) -- (4, 0)
to[R, l=$R_{78}$]
(2, 0) -- (0,0)
;
\end{circuitikz}
}%
\parbox[c]{.5\linewidth}{%
\begin{itemize}
\item $R_{12} = R_1 + R_2$
\item $U = U_1 + U_2$
\end{itemize}
}
Or using \verb|\begin{figure*}[placement] \end{figure*}|:
\begin{figure*}[h]\centering
\begin{circuitikz}[scale=.6] \draw
(0,0) to[dcvsource, l=$U_{12}$] (0,4)
%connect 0,0 with R1
(0, 4) -- (0.75, 4)
to[R, *-*, l=$R_{12}$] (4,4)
%parallel R1,2, R3
(0.75,4) -- (0.75,2)
to[R, -*, l=$R_3$] (4,2)
to[R, l=$R_4$] (4, 4)
to[R, l=$R_5$] (8, 4)
(8,4) -- (8,0)
(4,2) -- (4, 2)
to[R, -*, l=$R_6$] (8,2)
(8, 0) -- (4, 0)
to[R, l=$R_{78}$]
(2, 0) -- (0,0)
;
\node[right] at (9,3) {\textbullet\ $ R_{12} = R_1 + R_2$};
\node[right] at (9,1) {\textbullet\ $U = U_1 + U_2$};
\end{circuitikz}
\end{figure*}
\end{document}
答案2
问题在于,为了保持左右连贯性,你必须进行大量的视觉设计,而这并不是 LaTeX 的强项。我通常使用的是wrapfigure
,但它有其注意事项(有时会表现得很奇怪,你必须强制使用它,你会在这里找到很多关于它的问答)。例如(直接来自我的课程材料):
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[spanish]{babel}\deactivatequoting
\usepackage{wrapfig}
\usepackage[siunitx]{circuitikz}
\usepackage{amsmath}
\newcommand{\shunt}{\mathop{/\!/}}
\parindent=0pt
\begin{document}
bla blah blah blah blah,
para obtner:
\begin{wrapfigure}{l}{0.5\textwidth}
\begin{circuitikz}[american]
\draw (0,0) to[sV=$v_{th}$, ] ++(0,-3) node[ground](GND){}; %notice the worng +-, uffff
\draw (0,0) to [R=${R_{th}}$] ++(2,0)
to [C=${C}$, ] ++(1.5,0) coordinate (n2)
to [R=${R_L}$] (n2 |- GND) node[ground]{};
\draw (n2) to [short, -o] ++(1,0) node [right] {$v_{o2}$};
\end{circuitikz}
\end{wrapfigure}
y donde los equivalentes de Thévènin son:
\begin{align}
R_{th} &= R_p\shunt r_d = \SI{667}{\ohm} \\
v_{th} &= \frac{r_d}{R_p + r_d} v_s = \frac{2}{3}v_s
\end{align}
\dots y de paso, nota que:
\begin{equation}
\frac{v_{o2}}{v_s}\bigg\vert_{f\to\infty} = \frac{R_L}{R_L+R_{th}} v_{th} =
\num{0.4}v_s
\end{equation}
que lógicamente coincide con el resultado anterior.
\end{document}