I am trying to put together a table that consists out of both text and numbers. Most of the numbers I want to align with respect to their decimal points. Nevertheless, some of the cells contain text and should therefore simply be centered. I managed to use the \multicolumn command to align specific cells correctly. Now I am wondering if there is a more efficient way to align whole rows (e.g. Row 1) instead of writing a \multicolumn command for every cell in that row. Below you can see how my table looks at the moment.
\documentclass{article}
% Column alignment
\usepackage{dcolumn}
\newcolumntype{d}[1]{D{.}{.}{#1}}
\begin{document}
\begin{tabular}{lcc}
Column 1 & Column 2 & Column 3 \\
Row 1 & \multicolumn{1}{d{3.2}}{555} & 555\\
Row 2 & \multicolumn{1}{d{3.2}}{7.77} & 7.77 \\
Row 3 & \multicolumn{1}{d{3.2}}{99.9} & 99.9 \\
Row 4 & Text 1 & Text 2
\end{tabular}
\end{document}
Best Answer
You can use
siunitx
, where cells that don't fit the numeric scheme have just to be braced and will be automatically centered.