我正在使用\usepackage{subcaption}
图书馆(灵感来自这)创建一个包含两个图像的图形,如下所示:
\begin{figure}[H]
\centering
\begin{subfigure}{0.45 \linewidth}
\centering
\vfill
\includegraphics{2020.jpg}
\caption{A a $20\times 20$ image in original size.}
\end{subfigure} \hfill
\begin{subfigure}{0.54 \linewidth}
\centering
\includegraphics[height=6cm]{2020.jpg}
\caption{The same images with increased resolution, for illustrative purposes.}
\end{subfigure}
给我以下信息:
如何垂直对齐这两幅图像?例如,我想要这样的东西:
答案1
使用\subcaptionbox{<caption>}[<width>]{<image>}
环境subfigure
,然后你就会得到想要的结果,不需要任何技巧。
\documentclass{article}
\usepackage{graphicx}
\usepackage{subcaption}
\begin{document}
\begin{figure}
\centering
\subcaptionbox{%
A a $20\times 20$ image in original size.
}[0.45\linewidth]
{\includegraphics[width=1cm]{example-image-1x1}}
\hfill
\subcaptionbox{%
The same images with increased resolution, for illustrative purposes.
}[0.54 \linewidth]
{\includegraphics[width=5cm]{example-image-1x1}}
\end{figure}
\end{document}