You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

LaTeX含图片长表格单元格垂直居中与跨页显示问题求解

LaTeX含图长表格两个问题的解决方案

单元格垂直居中实现

默认tabular环境单元格为底部对齐,要实现内容垂直居中,二选一即可:

  • 加载array宏包,将列格式替换为m{宽度},该列格式会自动让单元格内容垂直居中。
  • 加载adjustbox宏包(加export选项),给所有\includegraphics增加valign=m参数,让图片与同行文字中线对齐,无需修改原有列格式。

表格跨页实现

普通table浮动体+tabular组合不支持跨页,直接替换为longtable环境即可:

  • 移除外层\begin{table}[H]和\end{table}浮动体包裹,longtable本身支持直接在正文排版,自动在分页处拆分表格。
  • 通过\endfirsthead、\endhead命令可以分别设置首页表头、后续每页重复的表头,避免分页后表格无表头的问题。

修改后可用代码

首先在文档导言区引入依赖宏包:

\usepackage{graphicx}
\usepackage{array}
\usepackage{longtable}
% 若选用adjustbox对齐方案,取消下一行注释
% \usepackage[export]{adjustbox}

表格主体代码如下,剩余条目按相同格式补全即可:

\begin{longtable}{|m{0.06\textwidth}|m{0.64\textwidth}|m{0.2\textwidth}<{\centering}|}
\hline
Id & Name & Figure \\ \hline
\endfirsthead
\hline
Id & Name & Figure \\ \hline
\endhead
1  & Press imaginary a button         & \includegraphics[width=0.9\linewidth]{gesture/Tup.PNG}        \\ \hline
2  & Double press an imaginary button & \includegraphics[width=0.9\linewidth]{gesture/Tup.PNG}        \\ \hline
3  & Close the fist                   & \includegraphics[width=0.9\linewidth]{gesture/closeFist.PNG}  \\ \hline
4  & Open the fist                    & \includegraphics[width=0.9\linewidth]{gesture/openFist.PNG}   \\ \hline
5  & Touch the ring                   & \includegraphics[width=0.9\linewidth]{gesture/touchRing.PNG}   \\ \hline
6  & Touch 2 times the ring           & \includegraphics[width=0.9\linewidth]{gesture/touchRing2.PNG}  \\ \hline
7  & Draw letter V                    & \includegraphics[width=0.9\linewidth]{gesture/V.PNG}           \\ \hline
8  & Draw letter X                    & \includegraphics[width=0.9\linewidth]{gesture/X.PNG}           \\ \hline
9  & Draw question Mark               & \includegraphics[width=0.9\linewidth]{gesture/right.PNG}       \\ \hline
10 & Swipe right                      & \includegraphics[width=0.9\linewidth]{gesture/right.PNG}       \\ \hline
11 & Swipe up                         & \includegraphics[width=0.9\linewidth]{gesture/up.PNG}          \\ \hline
12 & Thumbs up                        & \includegraphics[width=0.9\linewidth]{gesture/Tup.PNG}         \\ \hline
\end{longtable}

注意事项

  • 图片宽度建议设置为所在列行宽的0.9倍(即0.9\linewidth),替代原来的scale参数,避免图片尺寸不匹配溢出单元格。
  • 如果需要自适应列宽不想手动指定宽度,可以将longtable替换为xltabular环境,同时支持跨页和X类型自适应列,用法和tabularx一致。
  • 如果需要更美观的横线样式,可以加载booktabs宏包使用\toprule、\midrule、\bottomrule命令,和longtable兼容性良好。

内容的提问来源于stack exchange,提问作者Arnaudontour

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.31 23:36:37