\documentclass{article}
\begin{figure}[!]
\centering
\begin{subfigure}[b]{0.24\textwidth}
\centering
\includegraphics[width=\textwidth]{1.eps}
\caption{1}
\label{fig:1 is 0}
\end{subfigure}%
\hfill
\begin{subfigure}[b]{0.24\textwidth}
\centering
\includegraphics[width=\textwidth]{2}
\caption{2}
\label{fig:2 is the life like}
\end{subfigure}
\hfill
\begin{subfigure}[b]{0.24\textwidth}
\centering
\includegraphics[width=\textwidth]{3}
\caption{3}
\label{fig:3 is what people and the world like}
\end{subfigure}
\hfill
\begin{subfigure}[b]{0.24\textwidth}
\centering
\includegraphics[width=\textwidth]{4}
\caption{4}
\label{fig:4 is what the earth and the mars like}
\end{subfigure}
\end{figure}
\end{document}
答案1
在这种情况下,使用\subcaptionbox
命令,而不是subfigure
;\subcaptionbox
自动根据子图的第一个标题行对齐子图。
subfigure
以下是使用环境和命令时获得的不同垂直对齐方式的比较\subcaptionbox
:
\documentclass{article}
\usepackage[demo]{graphicx}
\usepackage{subcaption}
\begin{document}
\begin{figure}
\centering
\begin{subfigure}[b]{0.24\textwidth}
\centering
\includegraphics[width=\textwidth]{1.eps}
\caption{short}
\label{fig:1}
\end{subfigure}%
\hfill
\begin{subfigure}[b]{0.24\textwidth}
\centering
\includegraphics[width=\textwidth]{2}
\caption{short text}
\label{fig:2}
\end{subfigure}%
\hfill
\begin{subfigure}[b]{0.24\textwidth}
\centering
\includegraphics[width=\textwidth]{3}
\caption{a little longer text}
\label{fig:3}
\end{subfigure}%
\hfill
\begin{subfigure}[b]{0.24\textwidth}
\centering
\includegraphics[width=\textwidth]{4}
\caption{a much longer text goes here}
\label{fig:4}
\end{subfigure}
\caption{a general caption}
\label{fig:testa}
\end{figure}
\begin{figure}
\centering
\subcaptionbox{short\label{fig:11}}{\includegraphics[width=.24\linewidth]{1.eps}}\hfill
\subcaptionbox{short text\label{fig:22}}{\includegraphics[width=.24\linewidth]{2.eps}}\hfill
\subcaptionbox{a little longer text\label{fig:33}}{\includegraphics[width=.24\linewidth]{3.eps}}\hfill
\subcaptionbox{a much longer text goes here\label{fig:44}}{\includegraphics[width=.24\linewidth]{4.eps}}
\caption{a general caption}
\label{fig:testb}
\end{figure}
\end{document}
选项demo
只是graphicx
用黑色矩形替换实际图形;不是在实际文档中使用该选项。