[Tex/LaTex] Table with multiple lines in some cells

tables

What is the easiest way to have 2 lines in some of the cells in a table?

The only way I can think right now is to actually have 2 separate rows (without the line in the middle) and use \multirow on all other cells in this row. Any easier ideas?

Best Answer

You could nest a tabular within another tabular:

enter image description here

\documentclass{article}
\begin{document}
\begin{tabular}{cccc}
  One & Two & Three & Four \\
  Een & Twee & Drie & Vier \\
  One & Two & 
    \begin{tabular}{@{}c@{}}Three \\ Drie\end{tabular}
  & Four
\end{tabular}
\end{document}

The use of @{}..@{} voids the additional space (horizontal tab separation) inserted by the nested tabular.

Also, the above example inserts the nested tabular vertically centered with respect to the row. If you want it top or bottom aligned, use the optional parameter to tabular: \begin{tabular}[t].. or \begin{tabular}[b]....

Note that this approach also works within math mode for an array.

Related Question