This is a follow up to Numbers in tables: align by decimal point *and* flush right?.
In a tabular set with siunitx, I can give formatting options or in the \sisetup{} command or in the \begin{tabular} environment options. Why is that so? I would like to give global settings and still be able to modify single columns.
\documentclass{article}
\usepackage[
per-mode=symbol-or-fraction,
locale=DE,
sticky-per
]{siunitx}
\usepackage{subcaption}
\usepackage[table]{xcolor}
\begin{document}
\begin{table}
\caption{Comparing global and local settings}
\sffamily
\begin{subfigure}[t]{.48\linewidth}
\caption{Global}
\sffamily
\sisetup{detect-family, table-number-alignment = right}
\rowcolors{2}{white}{gray!20}
\centering
\begin{tabular}{S[table-format=6.0] S[table-format=2.0] S[table-format=4.0]}\hline
\multicolumn{1}{c|}{Foo} & \multicolumn{1}{c|}{$F$ in \si{\hertz}} & \multicolumn{1}{c}{$\sigma$ in \si{\newton\per\meter\squared}}\\ \hline
123456 & 12 & 1234 \\
12345 & 1 & 123 \\
1234 & 0 & 12 \\ \hline
\end{tabular}
\end{subfigure}%
\hfill
\begin{subfigure}[t]{.48\linewidth}
\rowcolors{2}{white}{gray!20}
\centering
\caption{Local}
\sffamily
\sisetup{detect-family}
\begin{tabular}{S[table-format=6.0, table-number-alignment = right] S[table-format=2.0, table-number-alignment = right] S[table-format=4.0, table-number-alignment = right]}\hline
\multicolumn{1}{c|}{Foo} & \multicolumn{1}{c|}{$F$ in \si{\hertz}} & \multicolumn{1}{c}{$\sigma$ in \si{\newton\per\meter\squared}}\\ \hline
123456 & 12 & 1234 \\
12345 & 1 & 123 \\
1234 & 0 & 12 \\ \hline
\end{tabular}
\end{subfigure}
\end{table}
\end{document}
Edit
If I just set an {S S S} tabular, the output would be correctly aligned, but sometimes I would like to change just one option for a single column. I think that not intuitive.
\sisetup) and local options (set usingS[...]), where the local options will override the global ones. Try settingtable-number-alignment = leftfor the second column of the second table, for example. – Jake Jul 23 '13 at 15:11S[table-format=6.0]overrides\sisetup{table-number-alignment = right}. Solution:S[table-format=6.0, table-number-alignment = right]but thats a lot of text and not logical for my taste. – LaRiFaRi Jul 23 '13 at 15:15table-number-alignmentandtable-formatare provided: Try swapping the order of the options in the second table, and you'll see thattable-formatdeactivates thetable-number-alignment. – Jake Jul 23 '13 at 15:21table-number-alignmentfor a table or document is not possible. – LaRiFaRi Jul 23 '13 at 15:42table-formatsetstable-number-alignment = center, so any other alignment has to be given aftertable-format. – Joseph Wright Jul 23 '13 at 16:26