我想拥有每个标题两个子图一个在另一个之上。在下面的 MWE 中,它们是水平对齐的。有没有办法强制它们垂直对齐?
\documentclass{memoir}
\usepackage{graphicx}
\newsubfloat{figure}
\begin{document}
\begin{figure}[h]
\centering
\subbottom[$asd$]{%
\includegraphics[width=0.1\linewidth]{example-image-a}\includegraphics[width=0.1\linewidth]{example-image-a}}
\subbottom[$asd$]{%
\includegraphics[width=0.1\linewidth]{example-image-a}\includegraphics[width=0.1\linewidth]{example-image-a}}
\subbottom[$asd$]{%
\includegraphics[width=0.1\linewidth]{example-image-a}\includegraphics[width=0.1\linewidth]{example-image-a}}
\end{figure}
\end{document}
答案1
如果不希望两个图像之间有间隙,请使用tabular
本地设置为 0。\arraystretch
\documentclass{memoir}
\usepackage{graphicx}
\newsubfloat{figure}
\begin{document}
\begin{figure}[htp]
\centering
\subbottom[$asd$]{%
\renewcommand{\arraystretch}{0}%
\begin{tabular}{@{}c@{}}
\includegraphics[width=0.1\linewidth]{example-image-a}\\
\includegraphics[width=0.1\linewidth]{example-image-a}
\end{tabular}%
}
\subbottom[$asd$]{%
\renewcommand{\arraystretch}{0}%
\begin{tabular}{@{}c@{}}
\includegraphics[width=0.1\linewidth]{example-image-a}\\
\includegraphics[width=0.1\linewidth]{example-image-a}
\end{tabular}%
}
\subbottom[$asd$]{%
\renewcommand{\arraystretch}{0}%
\begin{tabular}{@{}c@{}}
\includegraphics[width=0.1\linewidth]{example-image-a}\\
\includegraphics[width=0.1\linewidth]{example-image-a}
\end{tabular}%
}
\end{figure}
\end{document}
答案2
\documentclass{memoir}
\usepackage{graphicx}
\newsubfloat{figure}
\begin{document}
\begin{figure}[h]
\centering
\subbottom[$asd$]{%
\includegraphics[width=0.1\linewidth]{example-image-a}\includegraphics[width=0.1\linewidth]{example-image-a}}
\subbottom[$asd$]{%
\includegraphics[width=0.1\linewidth]{example-image-a}\includegraphics[width=0.1\linewidth]{example-image-a}}
\subbottom[$asd$]{%
\includegraphics[width=0.1\linewidth]{example-image-a}\includegraphics[width=0.1\linewidth]{example-image-a}}
\end{figure}
\end{document}
这里没有特殊的定位代码,如果你比较一下,你会看到相同的结果
a
b
c
d
和
a
b
c
d