![使用 circuitikz 的两个子图彼此相邻](https://linux22.com/image/403619/%E4%BD%BF%E7%94%A8%20circuitikz%20%E7%9A%84%E4%B8%A4%E4%B8%AA%E5%AD%90%E5%9B%BE%E5%BD%BC%E6%AD%A4%E7%9B%B8%E9%82%BB.png)
我有一个无法解决的问题。我想让两个电路彼此靠近,而不是彼此叠在一起。这是我的代码
\documentclass{article}
\usepackage{caption}
\usepackage{subcaption}
\usepackage{circuitikz}
\begin{document}
\begin{figure}
\centering
\begin{subfigure}[b]{0.4\textwidth}
\begin{circuitikz}
\draw
(0,2) to [american controlled current source, l=$g_m V_{GS_1}$](0,0)
(2,2) to [R, l=$r_{o_1}$] (2,0)
(3.5,2) to [american controlled current source, l=$g_m V_{GS_2}$](3.5,0)
(5.5,2) to [R, l=$r_{o_2}$] (5.5,0)
(0,2) to [short, -o] (6,2)
(0,0) to [short, -o] (6,0);
\end{circuitikz}
\caption{with $r_o$}
\end{subfigure}
\begin{subfigure}[b]{0.4\textwidth}
\begin{circuitikz}
\draw
(0,2) to [american controlled current source, l=$g_m V_{GS_1}$](0,0)
(3,2) to [american controlled current source, l=$g_m V_{GS_2}$](3,0)
(0,2) to [short, -o] (4,2)
(0,0) to [short, -o] (4,0);
\end{circuitikz}
\caption{with no $r_o$}
\end{subfigure}
\caption{DC small signal model}
\end{figure}
\end{document}
有人能帮我弄清楚如何将两个电路放在一起而不是叠在一起吗?
答案1
像这样 ?
只需删除两个subfigure
环境之间的白线,并添加一个空格来分隔它们\hspace
。
\documentclass{article}
\usepackage{caption}
\usepackage{subcaption}
\usepackage{circuitikz}
\begin{document}
\begin{figure}
%\centering
\begin{subfigure}[b]{0.4\textwidth}
\begin{circuitikz}
\draw
(0,2) to [american controlled current source, l=$g_m V_{GS_1}$](0,0)
(2,2) to [R, l=$r_{o_1}$] (2,0)
(3.5,2) to [american controlled current source, l=$g_m V_{GS_2}$](3.5,0)
(5.5,2) to [R, l=$r_{o_2}$] (5.5,0)
(0,2) to [short, -o] (6,2)
(0,0) to [short, -o] (6,0);
\end{circuitikz}
\caption{with $r_o$}
\end{subfigure}\hspace{3cm}% <-- no space between subfigure
\begin{subfigure}[b]{0.4\textwidth}
\begin{circuitikz}
\draw
(0,2) to [american controlled current source, l=$g_m V_{GS_1}$](0,0)
(3,2) to [american controlled current source, l=$g_m V_{GS_2}$](3,0)
(0,2) to [short, -o] (4,2)
(0,0) to [short, -o] (4,0);
\end{circuitikz}
\caption{with no $r_o$}
\end{subfigure}
\caption{DC small signal model}
\end{figure}
\end{document}