0

I think this is a very basic question, but I could not find an answer, maybe because I don't know the right words to search for. I am using the siunitx package to align numbers in a table. Since my table has several columns, I don't want to copy and paste the settings for each column like:

\begin{tabular}{lS[table-number-alignment=left]S[table-number-alignment=left]S[table-number-alignment=left]S[table-number-alignment=left]S[table-number-alignment=left]}

I am searching for a notation like this, but it does not work:

\begin{tabular}{l 5*S[table-number-alignment=left]}

Maybe someone does know how to write this better or point me to the correct documentation, where this is explained. Thanks!

3
  • 3
    Use *{num}{cols}, see latexref.xyz/tabular.html#tabular. In your example, it should be *{5}{S[...]}. Jul 29 '20 at 19:38
  • 1
    If your tabular is in a group (like a table environment), you might simply add at the beginning of the group \sisetup{table-number-alignment=left}.
    – Bernard
    Jul 29 '20 at 20:19
  • @muzimuzhi Z: It works! Thanks! If you post this as an answer, I can accept it. Jul 29 '20 at 21:49
2

The supported syntax is *{num}{cols}, see latexref.xyz/tabular.html#tabular. Hence in your example, it should be

\begin{tabular}{ l *{5}{S[...]} }

Also as @Bernard mentioned in comment, if your tabular is in a group (like a table environment), you might simply use

\begin{table}
  \sisetup{table-number-alignment=left}
  \begin{tabular}{l *{5}{S}} % here braces around "5" and "S" are both optional
    content
  \end{tabular}
\end{table}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.