在特定单元格中垂直居中文本

在特定单元格中垂直居中文本

我想将“特征”标题垂直居中放置在相应的单元格中?

在此处输入图片描述

\documentclass[a4paper,12pt]{article}

\usepackage{booktabs} %for top, middle and bottomline
\usepackage{multirow} %multi column and row spanning
\usepackage{multicol}
\usepackage{graphicx}

\begin{document}

\begin{multicols}{2}

\subsection*{Results}


\resizebox{\columnwidth}{!}{%
\begin{tabular}{@{} l c c @{}}
\toprule
Characteristic & \multicolumn{2}{c}{Result}\\
 \cmidrule{2-3}
 & Seaweed isolate & Coral isolate \\
 \midrule
Cell shape & Rod & Rod\\
Gram stain & $-$ & $-$\\
Oxidase & $+$ & $-$\\
Catalase & $+$ & $-$\\
MSA & Growth & No growth\\
Anaerobic & Growth (weak) & No growth\\
Motility & & \\
Indole production & & \\
Hugh \& Leifsons & & \\
\bottomrule
\end{tabular}
}


\end{multicols}

\end{document}

答案1

您可以使用 手动完成此操作\raisebox,也可以使用\multirow同名包中的命令(尽管正如 egreg 在评论中提到的那样,最好不要改变标题):

\documentclass[a4paper,12pt]{article}
\usepackage{booktabs} %for top, middle and bottomline
\usepackage{multirow} %multi column and row spanning
\usepackage{graphicx}
\usepackage{multicol}

\begin{document}

\begin{multicols}{2}

\subsection*{Results}

\resizebox{\columnwidth}{!}{%
\begin{tabular}{@{} l c c @{}}
\toprule
\multirow{2}{*}{Characteristic} & \multicolumn{2}{c}{Result}\\
 \cmidrule{2-3}
 & Seaweed isolate & Coral isolate \\
 \midrule
Cell shape & Rod & Rod\\
Gram stain & $-$ & $-$\\
Oxidase & $+$ & $-$\\
Catalase & $+$ & $-$\\
MSA & Growth & No growth\\
Anaerobic & Growth (weak) & No growth\\
Motility & & \\
Indole production & & \\
Hugh \& Leifsons & & \\
\bottomrule
\end{tabular}
}


\end{multicols}

\end{document}

相关内容