我想减少示例中子图标题之间的垂直距离。
这是我的代码:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\usepackage{subfigure}
\usepackage{lipsum}
\begin{document}
\lipsum[1-2]
\begin{figure}[h] % example dataset
\centering
\subfigure[Gray overlay.]{%
\includegraphics[width=0.25\textwidth]
{example-image-a}}
\hfill
\subfigure[Green overlay.]{%
\includegraphics[width=0.25\textwidth]
{example-image-a}}
\hfill
\subfigure[Red overlay.]{%
\includegraphics[width=0.25\textwidth]
{example-image-a}}%
\end{figure}
\lipsum[1]
\end{document}
我怎样才能做到这一点?
答案1
这子图包已弃用 - 不要使用它。相反,使用子图或者副标题包裹。
假设您愿意并且能够使用该subcaption
包,则可以使用\captionsetup[subfigure]{skip=...}
指令来设置所需的垂直空间。在下面的屏幕截图中,第一行采用默认距离,第二行采用减小的距离0.25\baselineskip
,第三行采用距离0
(不推荐)。
\documentclass{article}
%% \usepackage[utf8]{inputenc} % that's the default nowadays
\usepackage{graphicx,subcaption}
\begin{document}
\hrule
\begin{figure}[h]
\begin{subfigure}{0.3\textwidth}
\includegraphics[width=\linewidth]{example-image-a}
\caption{Gray overlay.}
\end{subfigure}
\hfill
\begin{subfigure}{0.3\textwidth}
\includegraphics[width=\linewidth]{example-image-b}
\caption{Green overlay.}
\end{subfigure}
\hfill
\begin{subfigure}{0.3\textwidth}
\includegraphics[width=\linewidth]{example-image-c}
\caption{Red overlay.}
\end{subfigure}
\end{figure}
\hrule
\begin{figure}[h]
\captionsetup[subfigure]{skip=0.25\baselineskip} % <-- new
\begin{subfigure}{0.3\textwidth}
\includegraphics[width=\linewidth]{example-image-a}
\caption{Gray overlay.}
\end{subfigure}
\hfill
\begin{subfigure}{0.3\textwidth}
\includegraphics[width=\linewidth]{example-image-b}
\caption{Green overlay.}
\end{subfigure}
\hfill
\begin{subfigure}{0.3\textwidth}
\includegraphics[width=\linewidth]{example-image-c}
\caption{Red overlay.}
\end{subfigure}
\end{figure}
\hrule
\begin{figure}[h]
\captionsetup[subfigure]{skip=0\baselineskip} % <-- new
\begin{subfigure}{0.3\textwidth}
\includegraphics[width=\linewidth]{example-image-a}
\caption{Gray overlay.}
\end{subfigure}
\hfill
\begin{subfigure}{0.3\textwidth}
\includegraphics[width=\linewidth]{example-image-b}
\caption{Green overlay.}
\end{subfigure}
\hfill
\begin{subfigure}{0.3\textwidth}
\includegraphics[width=\linewidth]{example-image-c}
\caption{Red overlay.}
\end{subfigure}
\end{figure}
\hrule
\end{document}