需要将文本与表格单元格顶部对齐

需要将文本与表格单元格顶部对齐

这是我现在的代码:

\begin{tabular}{|l|l|p{8cm}|}
\hline
NB & Screen & Description\\
\hline
\multirow{-40}{*}{1}
&
\includegraphics[scale=0.4, trim=0 0 0 -5]{CO600_Screenshots/Login-Accounts}
&
The first view is the Google Login Screen and has 4 buttons. \newline Selecting either
of the accounts will take us to Screen 2, 'Add Account' and 'Remove' will take us to
further Google screens which have not been documented.
\\
\hline
\end{tabular}

\includegraphics 后的大块文本会自动放置在单元格的底部 - 我需要将其放在顶部。

我尝试使用多行包来执行此操作,但文本会延伸出单元格并停止换行。

有人可以帮忙吗?

谢谢!

答案1

您可以使用一个简单的\raisebox。我加载了cellspace包 t 以确保单元格内容与上下水平线之间的间距最小。1.5ex介入的\raisebox是调整,大致对应于当前字体中大写字母的高度,以便图像的顶部与大写字母的顶部对齐,而不是与基线对齐。

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[demo]{graphicx}
\usepackage{cellspace}
\renewcommand\cellspacetoplimit{6pt}
\renewcommand\cellspacebottomlimit{6pt}

\begin{document}

\begin{tabular}{|l|Sl|S{p{8cm}}|}
\hline
NB & Screen & Description\\
\hline
1
&
\raisebox{\dimexpr-\height + 1.5ex\relax}{\includegraphics[scale=0.4, trim=0 0 0 -5]{CO600_Screenshots/Login-Accounts}}
&
The first view is the Google Login Screen and has 4 buttons. \newline Selecting either
of the accounts will take us to Screen 2, 'Add Account' and 'Remove' will take us to
further Google screens which have not been documented.
\\
\hline
\end{tabular}

\end{document} 

在此处输入图片描述

相关内容