我使用 subfigure 环境显示 4 个图形,每行 2 个。现在的问题是每个图形的标题超过两行。我希望标题写在一行中,但同时保持图形的尺寸较小。以下是我包含图形的方式:
\begin{figure}[t!]
\centering
\begin{subfigure}{.3\textwidth}
\includegraphics[width=\linewidth]{imgs/first_figure.png}
\vspace*{.2cm}
\caption{My first subcaption.}
\end{subfigure}\hspace*{3cm}
\begin{subfigure}{.3\textwidth}
\includegraphics[width=\linewidth]{imgs/second_figure.png}
\vspace*{.2cm}
\caption{second subcaption is slightly longer.}
\end{subfigure} \\\vspace*{.5cm}
\begin{subfigure}{.3\textwidth}
\includegraphics[width=\linewidth]{imgs/third_figure.png}
\vspace*{.2cm}
\caption{third subcaption is slightly longer.}
\end{subfigure}\hspace*{3cm}
\begin{subfigure}{.3\textwidth}
\includegraphics[width=\linewidth]{imgs/fourth_figure.png}
\vspace*{.2cm}
\caption{fourth subcaption is slightly longer.}
\end{subfigure}
\vspace*{.5cm}
\caption{Four figures.}
\end{figure}
我尝试\hspace*{-2cm}
在每个子标题前面添加一个附加内容,但实际上没有任何效果。这很奇怪,因为它\vspace*{.2cm}
完全按照我的意图运行。有什么建议吗?
答案1
由于您有 4 个子图,因此您可以轻松地为每个子图使用最多0.5\textwidth
。您只需要缩小图像即可。
\documentclass{article}
\usepackage{graphicx}
\usepackage{subcaption}
\begin{document}
\begin{figure}[t]
\advance\abovecaptionskip by 0.2cm
\centering
\begin{subfigure}{.5\textwidth}
\centering
\includegraphics[width=0.6\linewidth]{example-image-a}
\caption{My first subcaption.}
\end{subfigure}%
\begin{subfigure}{.5\textwidth}
\centering
\includegraphics[width=0.6\linewidth]{example-image-b}
\caption{second subcaption is slightly longer.}
\end{subfigure}
\begin{subfigure}{.5\textwidth}
\centering
\includegraphics[width=0.6\linewidth]{example-image-c}
\caption{third subcaption is slightly longer.}
\end{subfigure}%
\begin{subfigure}{0.5\textwidth}
\centering
\includegraphics[width=0.6\linewidth]{example-image}
\caption{fourth subcaption is slightly longer.}
\end{subfigure}
\vspace{.3cm}% plus 0.2
\caption{Four figures.}
\end{figure}
\end{document}