我有 5 张图片:A、B、C、D 和 E,大小各不相同。它们需要像这样设置:
------- ----------- ------- -------
| | | | | | | D |
| | | | | | -------
| A | | B | | C |
| | | | | | -------
| | | | | | | E |
------- ----------- ------- -------
如何使用 latex 中的 subcaption\subfigure 包进行设置?我已设法使 A、B、C 像这样工作:
\centering
\begin{subfigure}[t]{0.246\textwidth}
\centering
\includegraphics[height=0.18\textheight]{tease5_a.jpg}
\end{subfigure}%
\centering
\begin{subfigure}[t]{0.18\textwidth}
\centering
\includegraphics[height=0.18\textheight]{tease5_b.jpg}
\end{subfigure}%
\centering
\begin{subfigure}[t]{0.18\textwidth}
\centering
\includegraphics[height=0.18\textheight]{tease5_c.jpg}
\end{subfigure}%
.. 对于所有图像来说,这几乎是恒定的高度,但每个图像的宽度分配不同,否则我会有太多的额外空间或重叠。但是我该如何设置它才能使最后两幅图像像图片显示的那样垂直对齐?
答案1
您不需要subfig
或subcaption
。使用minipage
底部对齐,但也要指定其垂直尺寸。
\documentclass{article}
\usepackage[demo]{graphicx} % demo is just for the example
\begin{document}
\begin{figure}
\centering
\includegraphics[height=0.18\textheight,width=.246\textwidth]{tease5_a.jpg}
\includegraphics[height=0.18\textheight,width=0.18\textwidth]{tease5_b.jpg}
\includegraphics[height=0.18\textheight,width=0.18\textwidth]{tease5_c.jpg}
\begin{minipage}[b][0.18\textheight][s]{0.18\textwidth}
\centering
\includegraphics[height=0.08\textheight,width=\textwidth]{tease5_d.jpg}
\vfill
\includegraphics[height=0.08\textheight,width=\textwidth]{tease5_e.jpg}
\end{minipage}
\caption{A caption}
\end{figure}
\end{document}