TransWikia.com

table settings for multiple columns

TeX - LaTeX Asked on October 3, 2021

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!

One Answer

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}

Correct answer by muzimuzhi Z on October 3, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP