9

The siunitx package has already been extremely helpful to me for formatting tables containing numbers and I now use the S-column in nearly every table of my thesis.

However there is one problem: In the heading lines of the table (between toprule and midrule) there is text and variables and units which regularly produce errors when columns are formatted with S[...] so that I have to manually enclose every one of those texts with round brackets }.

I wonder: Is there a way to exclude a whole tabular line from the S-column formatting and mark it as "text" (as if every cell would be written in "{}")?

  • 2
    Your question post seemed to have solved my problem with siunitx; thanks! I don't mind closing text with braces in tables with a manageable number of cells. – Ã‰be Isaac Sep 17 '18 at 07:28

2 Answers2

5

The TeX \halign primitive, from which tabulars are built, is column-oriented. As a result, row operations are not trivial to implement. As a result, the current answer is that there is not a simple way to achieve what you'd like. I will of course consider possible approaches.

Joseph Wright
  • 259,911
  • 34
  • 706
  • 1,036
3

This can be achieved with the option guard from the package tabularray. The manual provides the following example.

\documentclass[border=6pt]{standalone}
\usepackage{tabularray}
\UseTblrLibrary{siunitx}
\begin{document}
\begin{tblr}{
  hlines, vlines,
  colspec={Q[si={table-format=3.2},c]Q[si={table-format=3.2},c]},
  row{1} = {guard}
}
   Head  & Head   \\
  111    & 111    \\
    2.1  &   2.2  \\
   33.11 &  33.22 \\
\end{tblr}
\end{document}

example

matexmatics
  • 4,819