将文本置于表格单元格中央

将文本置于表格单元格中央

我知道这个问题以前有人问过,但答案似乎不适用。我有一个定义如下的表格:

\begin{table}[!ht]
\begin{center}
\caption[Micromagnetic simulators]{Micromagnetic simulators. \citesource{Kim2010}.\label{tab:sims}}
\begin{tabular}{|c|c|c|c|}
\hline \textbf{Name} & \textbf{Developers} & \textbf{Open Source} & \textbf{Method} \\
\hline LLG Simulator & M. R. Scheinfein & Paid & FDM \\
\hline MAGPAR & W. Scholtz & Free & FEM \\ 
\hline {\centering MicroMagus} & D. V. Berkov & Paid & FDM \\ & and N. L. Gorn & & \\ 
\hline Nmag & H. Fangohr & Free & FEM \\ & and T. Fischbacher & & \\ 
\hline OOMMF & M. Donahue & Free & FDM \\ & and D. Porter & & \\ 
\hline 
\end{tabular}
\end{center}
\end{table}

给出如下表:

在此处输入图片描述

您可能注意到,{\centering MicroMagus}未能成功将条目置于中心。此外,您如何评价我的表格在良好做法等方面的表现?

答案1

您应该使用multirow包来实现这一点。以下是有效的代码:

\begin{table}[!ht]
\centering
\caption[Micromagnetic simulators]{Micromagnetic simulators.\citesource{Kim2010}.\label{tab:sims}}
\begin{tabular}{|c|c|c|c|}
\hline
\textbf{Name} & \textbf{Developers} & \textbf{Open Source} & \textbf{Method} \\
\hline
LLG Simulator & M. R. Scheinfein & Paid & FDM \\
\hline
MAGPAR & W. Scholtz & Free & FEM \\
\hline
\multirow{2}{*}{MicroMagus} & D. V. Berkov & Paid & FDM \\
& and N. L. Gorn & & \\
\hline
\multirow{2}{*}{Nmag} & H. Fangohr & Free & FEM \\
& and T. Fischbacher & & \\
\hline
\multirow{2}{*}{OOMMF} & M. Donahue & Free & FDM \\
& and D. Porter & & \\
\hline
\end{tabular}
\end{table}

请注意,我center用命令替换了产生虚假垂直空间的环境\centering在此处输入图片描述

相关内容