垂直對齊調整大小的表格和影像

垂直對齊調整大小的表格和影像

我正在使用此程式碼將一張大桌子放在一個圖形旁邊。

\begin{figure}%[t!]
\centering
\begin{minipage}[c]{0.95\textwidth}
\begin{tabular}{cc}
\resizebox{0.45\textwidth}{!}{
\begin{tabular}{c c c c c c}
 % ... all the lines and stuff
\end{tabular} } & \includegraphics[width=0.45\textwidth]{./image.pdf}\\
(a) & (b) \\
\end{tabular}
\end{minipage}
\end{figure}

然而,程式碼導致表格和圖形未正確對齊,如下所示:

在此輸入影像描述

問題是什麼?

答案1

如果影像tabular和影像的高度大致相同,則將它們對齊到基線。預設情況下,\includegraphics在底部對齊,但tabular在垂直中心對齊。使用\begin{tabular}[b]就足夠了,因為它會將垂直中心對齊方式更改為與最後一行的基線對齊...

其他選項包括添加

\usepackage[export]{adjustbox}

到你的序言並使用

\includegraphics[valign=c,...]{<image>}

這會將影像與tabulars(預設)垂直中心對齊。

相關內容