我在一个图中有三个子图,不知为何左边的子图(包括其标题)排得比其他两个子图低。我确信一定是打字错误,但我就是没看到!如能得到任何帮助我将不胜感激。
\begin{figure}[htb]
\centering
\begin{subfigure}{0.32\textwidth}
\centering
\includegraphics[width=0.95\textwidth]{images/DW-MD-T1}
\caption{V-shape in high density
\label{fig:DW-MD-T1}}
\end{subfigure}
\begin{subfigure}{0.32\textwidth}
\centering
\includegraphics[width=0.95\textwidth]{images/DW-MD-T1}
\caption{Line-shape in medium density
\label{fig:DW-MD-T2}}
\end{subfigure}
\begin{subfigure}{0.32\textwidth}
\centering
\includegraphics[width=0.95\textwidth]{images/DW-MD-T3}
\caption{Line-shape in medium density
\label{fig:DW-MD-T3}}
\end{subfigure}
\caption{A V-shaped DO-formation meets a medium density crowd; (a) The crowd starts to move aside. The closer agents start adjusting their velocity to flee from the formation. (b) The agents directly in front of the formation don't get a chance to move aside as they are only steered ahead; (c) The agents that did not get a chance to flee get overrun.}
\label{fig:DW-MD-T}
\end{figure}
答案1
我使用的包subfig
:
\documentclass{report}
\usepackage[demo]{graphicx}%% Delete [demo]
\usepackage{subfig}
\begin{document}
\begin{figure}[!htb]
\subfloat[V-shape in high density\label{fig:DW-MD-T1}]{%
\includegraphics[width=0.32\linewidth]{images/DW-MD-T1}}\hfill
\subfloat[V-shape in high density\label{fig:DW-MD-T2}]{%
\includegraphics[width=0.32\linewidth]{images/DW-MD-T2}}\hfill
\subfloat[V-shape in high density\label{fig:DW-MD-T3}]{%
\includegraphics[width=0.32\linewidth]{images/DW-MD-T3}}
\caption{A V-shaped DO-formation meets a medium density crowd; (a) The crowd starts to move aside. The closer agents start adjusting their velocity to flee from the formation. (b) The agents directly in front of the formation don't get a chance to move aside as they are only steered ahead; (c) The agents that did not get a chance to flee get overrun.}
\label{fig:DW-MD-T}
\end{figure}
\end{document}
答案2
我发现问题了!图片(具体来说是两张较高的图片)的标题太长了,不知怎么的导致左边的图片掉下来了。缩短标题就可以对齐图片了。
答案3
从你的描述来看,这三个图的高度不同(但设计上宽度相同)。如果你想坚持使用软件包提供的机制subcaption
,我建议你使用[t]
位置说明符来通知 LaTeX,所有三个subfigure
环境(以及它们所包含的材料)都应该顶部对齐。
\documentclass[demo]{article} % omit 'demo' option in real document
\usepackage{graphicx,subcaption}
\begin{document}
\begin{figure}[htb]
\begin{subfigure}[t]{0.32\textwidth} % note the "[t]" placement directive
\includegraphics[width=\textwidth]{images/DW-MD-T1}
\caption{V-shape in high density
\label{fig:DW-MD-T1}}
\end{subfigure}\hfill%
\begin{subfigure}[t]{0.32\textwidth} % note the "[t]" placement directive
\includegraphics[width=\textwidth]{images/DW-MD-T1}
\caption{Line-shape in medium density
\label{fig:DW-MD-T2}}
\end{subfigure}\hfill%
\begin{subfigure}[t]{0.32\textwidth}% note the "[t]" placement directive
\includegraphics[width=\textwidth]{images/DW-MD-T3}
\caption{Line-shape in medium density
\label{fig:DW-MD-T3}}
\end{subfigure}
\medskip
% Suggestion: move the subfigure legends out of the main caption
(a)~The crowd starts to move aside. The closer agents start adjusting their
velocity to flee from the formation. (b)~The agents directly in front of the
formation don't get a chance to move aside as they are only steered ahead.
(c)~The agents who did not get a chance to flee get overrun.
\caption{A V-shaped DO-formation meets a medium density crowd}
\label{fig:DW-MD-T}
\end{figure}
\end{document}