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

LaTeX表格与图片并排时顶部对齐问题求助

解决LaTeX表格与图片顶部对齐的问题

要实现表格和图片的顶部对齐,核心是调整两者的垂直对齐方式——默认情况下它们会以基线对齐,导致表格被图片向下推。以下是修改后的代码及关键调整说明:

修改后的完整代码

\documentclass{article}

\usepackage{graphicx} % Required for inserting images
\usepackage[a4paper,top=2cm,bottom=0cm,right=2cm,left=2cm]{geometry}
\usepackage{fourier, heuristica}
\usepackage[x11names,table]{xcolor}

\begin{document}

% timeline (line behind bullet points) command creation
\newcommand{\timeline}{\color{blue}\makebox[0pt]{\Large\textbullet}\hskip-0.5pt\vrule width 1pt\hspace{\labelsep}}

% table  
\begin{table}[ht]
\renewcommand\arraystretch{1.7} % set vertical padding for timeline
    % 外层tabular添加[t]实现整体顶部对齐
    \begin{tabular*}{\textwidth}[t]{l | r |} 
        \hline
        % 内层tabular添加[t]使其顶部与单元格顶部对齐
        \begin{tabular}[t]{@{\,} >{\fontfamily{phv}\selectfont} r  <{\hskip 2pt} !{\timeline} >{\raggedright\arraybackslash\fontfamily{phv}\selectfont} p{0.4\linewidth}} 
            \hline
            2015 & 1. Platz IMAV Indoor-Competition Aachen, Deutschland \\
            2016 & 1. Platz IMAV Outdoor-Competition, Peking, China. \\
            2017 & 2. Platz IMAV Outdoor-Competition, Toulouse, Frankreich.\\
            2018 & 2. Platz beim Innovationspreis Senkrechtstarter, Friedrichshafen, Deutschland \\
            2022 & IMAV Sonderauszeichnung für das Kartieren des Wettbewerbsgeländes, Delft, Niederlande.\\
            2023 & 2. Platz IMAV Outdoor-Competition, Aachen, Deutschland. \\
            2024 & 2. Platz IMAV Outdoor-Competition, Bristol, England \\
        \end{tabular}
    
        &
        % 图片添加valign=t使其顶部与单元格顶部对齐
        \includegraphics[valign=t, width=0.5\linewidth]{group_photo.JPG} 
    \end{tabular*}
    
\end{table}

\end{document}

关键调整点

  • 给外层tabular*环境添加[t]参数:让整个外层表格的内容以顶部对齐,确保两列的内容从同一水平线开始。
  • 给内层tabular环境添加[t]参数:让时间线表格的顶部与外层单元格的顶部对齐,避免内层表格因自身布局导致偏移。
  • 给includegraphics添加valign=t参数:将图片的垂直对齐方式从默认的基线改为顶部,让图片的上边缘与表格的上边缘对齐。

这样调整后,无论图片尺寸多大,表格和图片都会保持顶部对齐的布局。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.06.13 16:06:02