![水平对齐三幅图像](https://linux22.com/image/317460/%E6%B0%B4%E5%B9%B3%E5%AF%B9%E9%BD%90%E4%B8%89%E5%B9%85%E5%9B%BE%E5%83%8F.png)
我有三张大小不同的图片。我想将它们水平排列,使它们居中。我试过这个代码,它适用于定位。但我不知道如何为每张图片添加子标题,并为整个图形包添加标题,如下图所示。
\begin{figure}[!h]
\centering
$\vcenter{\hbox{\includegraphics[height=3.5cm]{image_a}}}$
\qquad
$\vcenter{\hbox{\includegraphics[height=7cm]{image_b}}}$
\qquad
$\vcenter{\hbox{\includegraphics[height=7cm]{image_c}}}$
\caption{image}
\end{figure}
答案1
您可以使用subfigure
来自subcaption
包裹:
\documentclass{article}
\usepackage{subcaption}
\usepackage{graphicx}
\begin{document}
\begin{figure}
\begin{subfigure}{.3\textwidth}
\centering
\includegraphics[width=3cm,height=3.5cm]{example-image-a}
\caption{this is the first subfigure}
\end{subfigure}\hfill
\begin{subfigure}{.3\textwidth}
\centering
\includegraphics[width=3cm,height=7cm]{example-image-b}
\caption{this is the second subfigure}
\end{subfigure}\hfill
\begin{subfigure}{.3\textwidth}
\centering
\includegraphics[width=3cm,height=7cm]{example-image-c}
\caption{this is the third subfigure}
\end{subfigure}
\caption{image}
\end{figure}
\end{document}
结果: