# Centering text in a table cell

I know the question has been asked before, but the answers don't seem to apply. I have a table defined below:

\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}


This gives a table as below:

As you may notice {\centering MicroMagus} did not succeed in centring the entry. Also, how would you rate my table in terms of good practices etc?

• \centering is for horizontal centering, do you want vertical centering? – Torbjørn T. Jan 13 '14 at 9:45
• The entry is centred (due to the c column) \centering does nothing in gorizontal mode. If it were a p column (a \parbox then \centering MicroMagus would (horizontally) center buy {\centering MicroMagus} will never center anything as centering and similar commands always require the end of paragraph to be in scope, and the {} means that centering is turned off before the end of paragraph. If you want vertical centering try \raisebox{-7pt}{MicroMagus} – David Carlisle Jan 13 '14 at 9:52
• Regarding good practices; I would suggest to loose all the rules and left-align everything (i.e., \begin{tabular}{llll}). – morbusg Jan 13 '14 at 10:45
• Related/duplicate: tex.stackexchange.com/questions/2441/… – egreg Jan 13 '14 at 12:39

You should use the multirow package for that. Here is a code that works:

\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}


Note that I replaced the center environment, that gives a spurious vertical space, with the \centering command.

• Bernard, remember that you can upvote questions and answers you like! – karlkoeller Jan 13 '14 at 12:16
• @karlkoeller How do I upvote? – Bernard Jan 13 '14 at 20:44
• Bernard, next to each answer or question, you can see two arrows with a number in the middle. The one above is to upvote, the one below is to downvote. For example, you can click on the arrow above the "1" on the above question and you'll give reputation to the OP. Have a look at tex.stackexchange.com/tour for more info. – karlkoeller Jan 13 '14 at 21:09