![表格中文本的格式问题](https://linux22.com/image/334369/%E8%A1%A8%E6%A0%BC%E4%B8%AD%E6%96%87%E6%9C%AC%E7%9A%84%E6%A0%BC%E5%BC%8F%E9%97%AE%E9%A2%98.png)
这是我的代码。每次我将图像添加到表格中时,同一行中的文本都会跳过行并从底部开始,以使文本本身与图像对齐。您能告诉我如何修复它吗?谢谢。
\begin{document}
\begin{center}
\begin{longtable}{|c|c|c|} \hline
This is what I am talking about & How do I get it to start from the top?& \includegraphics[scale=0.3]{img/smiley.jpg} \\ \hline
\end{longtable}
\end{center}
\end{document}
答案1
解释是图像放在基线上,所以你必须使用\raisebox{}
。该cellspace
包定义了一个最小对于以字母为前缀的说明符的列,上方和下方规则之间的垂直填充S
:
\documentclass[a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage{geometry}
\usepackage{graphicx} %
\usepackage{array, booktabs, longtable, cellspace}
\renewcommand\cellspacetoplimit{5pt}
\renewcommand\cellspacebottomlimit{5pt}
\begin{document}
\begin{longtable}{|c|c|Sc|} \hline
This is what I am talking about & How do I get it to start from the top?& \raisebox{\dimexpr-\height+1ex\relax}{\includegraphics[scale=0.2]{traccia-table}} \\[1ex] \hline
\end{longtable}
\end{document}