\documentclass{article}
\usepackage[locale=FR]{siunitx}
\usepackage{booktabs}
\usepackage{geometry}
\begin{document}
\begin{table}
\centering
\begin{tabular}{lS[table-format=4.6]S[table-format=2.3]}
\toprule
{A} & B & C\\
\midrule
a &1231,1231 & 1,12\\
b & 1254,121231 & 1,7\\
\bottomrule
\end{tabular}
\caption{Caption}
\label{tab:my_label}
\end{table}
\end{document}
答案1
使用table-auto-round
选项:
\documentclass{article}
\usepackage[locale=FR]{siunitx}
\usepackage{booktabs}
\usepackage{geometry}
\begin{document}
\begin{table}
\centering
\begin{tabular}{
l
S[table-format=4.6,table-auto-round]
S[table-format=2.3,table-auto-round]
}
\toprule
{A} & B & C\\
\midrule
a & 1231,1231 & 1,12 \\
b & 1254,121231 & 1,7 \\
\bottomrule
\end{tabular}
\caption{Caption}
\label{tab:my_label}
\end{table}
\end{document}