![需要将文本与表格单元格顶部对齐](https://linux22.com/image/297812/%E9%9C%80%E8%A6%81%E5%B0%86%E6%96%87%E6%9C%AC%E4%B8%8E%E8%A1%A8%E6%A0%BC%E5%8D%95%E5%85%83%E6%A0%BC%E9%A1%B6%E9%83%A8%E5%AF%B9%E9%BD%90.png)
这是我现在的代码:
\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}