我有一个大表格(跨越几页),其中还插入了图像(示例只是表格的一部分)。我一直在寻找解决方案,如何垂直调整表格中图像的位置,但到目前为止还没有成功。现在文本与图形的底部对齐,这不太好看。有人能建议如何让数字在列中向下移动一半高度,以便相邻列中的文本位于图形的中间吗?
\documentclass[11pt,a4paper,twoside]{report}
\usepackage[utf8x]{inputenc}
\usepackage{ucs}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{graphicx}
\graphicspath{{figures/}}
\usepackage{tocbibind}
\usepackage[top=2cm,bottom=2cm,inner=2cm,outer=2cm]{geometry}
\usepackage{latexsym}
\usepackage{caption}
\usepackage[table]{xcolor}
\usepackage{pgfplots}
\usepackage{booktabs}
\usepackage{pdflscape}
\usepackage{afterpage}
\usepackage{threeparttable}
\usepackage{longtable}
\begin{document}
\afterpage{
\clearpage
\thispagestyle{empty}
\begin{landscape}
\centering
\captionof{table}{Properties of the selected pharmaceuticals}
\label{tab:Properties}
\begin{longtable}{ccccccc}
\toprule
\textbf{Therapeutic class} & \textbf{Pharmaceutical} & \textbf{Acronym} & \textbf{Molecular structure} & \textbf{Log Kow} & \textbf{Kd (L/kgSS)} & \textbf{Reference} \\
\midrule
\textbf{Beta-blockers} & Atenolol & ATL &\includegraphics{figures/ATL.png}& 0.16 &\begin{tabular}{@{}c@{}}64\\38\\1-8\end{tabular}&\begin{tabular}{@{}c@{}}1\\2\\3\end{tabular}\\
&Bisoprolol&BSP&\includegraphics{figures/ATL.png}&1.87&n.a.&\\
&Metoprolol&MTP&\includegraphics[height=0.8in]{figures/ATL.png}&1.88&\begin{tabular}{@{}c@{}}1\\10-90\end{tabular}&\begin{tabular}{@{}c@{}}2\\3\end{tabular}\\
&Sotalol&STL&\includegraphics[height=1in]{figures/ATL.png}&0.24&\begin{tabular}{@{}c@{}}37\\10-60\end{tabular}&\begin{tabular}{@{}c@{}}2\\3\end{tabular}\\
\midrule
\textbf{Analgesic}&Diclofenac&DCF&\includegraphics[height=1in]{figures/ATL.png}&4.51&\begin{tabular}{@{}c@{}}118\\1.58\\16\\151\end{tabular}&\begin{tabular}{@{}c@{}}1\\4\\5\\6\end{tabular}\\
&Tramadol&TMD&\includegraphics[height=1in]{figures/ATL.png}&3.01&47&7\\
\midrule
\bottomrule
\end{longtable}
\end{landscape}
\clearpage
}
\end{document}
https://en.wikipedia.org/wiki/Atenolol#/media/File:Atenolol.svg
答案1
另一种解决方案:使用 m 列,因为这会使单元格内容垂直对齐在中间。
我添加了一个新列类型“C”,它采用您必须定义的列宽。我用我的新“C”列替换了您的第三个“c”列,使其宽度为 7.5 厘米。
您还应该使用命令插入图像\includegraphics[width=linewidth]{filename}
。请注意:a) 我使用缩放图像,width=\linewidth
因为会\linewidth
自动反映列的实际宽度。如果您将我(猜测的)7.5 厘米更改为 5 厘米,\linewidth
则会相应减少。b) 您不需要添加文件扩展名“.jpg”。PDFLaTeX 将自行搜索“.jpg”、“.png”和“.pdf”的存在。(如果您碰巧使用经典 LaTeX,它将搜索“.ps”、“.eps”、“.ps.gz”以及最后的“.eps.gz”。)
以下是(不那么简单的)示例:
\documentclass[11pt,a4paper,twoside]{report}
\usepackage[utf8x]{inputenc}
\usepackage{ucs}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{graphicx}
\graphicspath{{figures/}}
\usepackage{tocbibind}
\usepackage[top=2cm,bottom=2cm,inner=2cm,outer=2cm]{geometry}
\usepackage{latexsym}
\usepackage{caption}
\usepackage[table]{xcolor}
\usepackage{pgfplots}
\usepackage{booktabs}
\usepackage{pdflscape}
\usepackage{afterpage}
\usepackage{threeparttable}
\usepackage{longtable}
%% New column, define the width as #1, the m-column will align all
%% content in ther vertical middle, \centering will align it in the
%% horizontal middle.
\newcolumntype{C}[1]{%
>{\centering\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
\begin{document}
\afterpage{
\clearpage
\thispagestyle{empty}
\begin{landscape}
\centering
\captionof{table}{Properties of the selected pharmaceuticals}
\label{tab:Properties}
%\begin{longtable}{ccccccc}
\begin{longtable}{cccC{7.5cm}ccc}
\toprule
\textbf{Therapeutic class} & \textbf{Pharmaceutical} & \textbf{Acronym} & \textbf{Molecular structure} & \textbf{Log Kow} & \textbf{Kd (L/kgSS)} & \textbf{Reference} \\
\midrule
\textbf{Beta-blockers} & Atenolol & ATL &\includegraphics[width=\linewidth]{figures/ATL.png}& 0.16 &\begin{tabular}{@{}c@{}}64\\38\\1-8\end{tabular}&\begin{tabular}{@{}c@{}}1\\2\\3\end{tabular}\\
&Bisoprolol&BSP&\includegraphics[width=\linewidth]{figures/ATL.png}&1.87&n.a.&\\
&Metoprolol&MTP&\includegraphics[height=0.8in]{figures/ATL.png}&1.88&\begin{tabular}{@{}c@{}}1\\10-90\end{tabular}&\begin{tabular}{@{}c@{}}2\\3\end{tabular}\\
&Sotalol&STL&\includegraphics[height=1in]{figures/ATL.png}&0.24&\begin{tabular}{@{}c@{}}37\\10-60\end{tabular}&\begin{tabular}{@{}c@{}}2\\3\end{tabular}\\
\midrule
\textbf{Analgesic}&Diclofenac&DCF&\includegraphics[height=1in]{figures/ATL.png}&4.51&\begin{tabular}{@{}c@{}}118\\1.58\\16\\151\end{tabular}&\begin{tabular}{@{}c@{}}1\\4\\5\\6\end{tabular}\\
&Tramadol&TMD&\includegraphics[height=1in]{figures/ATL.png}&3.01&47&7\\
\midrule
\bottomrule
\end{longtable}
\end{landscape}
\clearpage
}
\end{document}
这是结果的截图。
答案2
\usepackage{makecell}
...
\makecell[c]{\includegraphics{figures/ATL.png}}
答案3
一个简单的方法\raisebox{-0.5\height}{\includegraphics{...}}
通常就能达到目的。