1

I would like to center the content of table-cells in heading. In guidelines for Polish text documents content of table heading must be centered both horizontally and vertically. I have found such an answer, but I am not able to implement it, because the code is not explained. I tried also application of m-type column as well as \multirow[c]{1}{\mycolumnwidth}{My cell content} and few combinations of them with \multicolumn command. Adjustment of text altitude by \multirow{1}{\mycolumnwidth}[\myyshift]{My cell content} is not a solution - vertical centering must be performed automatically. There is some answer for plain TeX, but I would like to use tabular or similar environment.

enter image description here

MWE:

\documentclass[table]{standalone}
\usepackage{dcolumn}
\usepackage{multirow}

\newcolumntype{d}{D{.}{.}{2.1}} \renewcommand{\arraystretch}{1.3}

\begin{document} \begin{tabular}{|l|d|d|} \hline \multicolumn{1}{|c|}{\multirow[c]{1}{23mm}{\centering\textbf{Title of side-heading}}} & \multicolumn{1}{>{\centering}p{23mm}|}{\textbf{Arbitrary values}} & \multicolumn{1}{>{\centering}p{23mm}|}{\textbf{Some other random values}}\ \hline Description 1 & 63.5 & 48.7\ \hline Description 2 & 88.4 & 51.3\ \hline \end{tabular} \end{document}

forrest
  • 958

1 Answers1

1

With siunitx and makecell:

enter image description here

\documentclass[table]{standalone}
\usepackage{siunitx}
\usepackage{makecell}
\renewcommand{\theadfont}{\normalsize\bfseries}
\renewcommand{\arraystretch}{1.3}

\begin{document} \begin{tabular}{|l|S[table-format=2.1]|S[table-format=2.1]|} \hline {\thead{Title of\ side-heading}} & {\thead{Arbitrary\ values}} & {\thead{Some other\ random\ values}}\ \hline Description 1 & 63.5 & 48.7\ \hline Description 2 & 88.4 & 51.3\ \hline \end{tabular} \end{document}

leandriis
  • 62,593