[Tex/LaTex] How to round different parts of LaTex number table differently

formattingtables

Lets say I have the following LaTex number table:

\begin{table}[]
\centering
\caption{My caption}
\label{my-label}
\begin{tabular}{lll}
0,209966415285772 & 0,107300702188478 & 0,220336484787743 \\
0,235535794083825 & 0,124200085401020 & 0,241022336291680 \\
0,238895516728854 & 0,112685447109388 & 0,241352008484367
\end{tabular}
\end{table}

How can I round e.g. rows 1-2 to 3 decimals and row 3 to 2 decimals?

The reason why I'm asking this is because I have a big table with a lot of numbers and I need to round different parts of the table differently. How can I do this? MWE?

Best Answer

a small variation of TEXnician answer (considering your comment):

\documentclass{article}
\usepackage{siunitx}

\begin{document}
\begin{table}
\sisetup{table-column-width=16ex,    % local setting for all S columns
         round-mode=places,round-precision=3}
\centering
\caption{My caption}
\label{my-label}
\begin{tabular}{SSS}
0,209 966 415 285 772 & 0,107300702188478 & 0,220336484787743 \\
0,235535794083825 & 0,124200085401020 & 0,241022336291680 \\
\end{tabular}\\
\sisetup{round-precision=2}          % change setting for next S columns
\begin{tabular}{SSS}
0,238895516728854 & 0,112685447109388 & 0,241352008484367
\end{tabular}
\end{table}
\end{document}

enter image description here

Related Question