While siunitx
is good at aligning a series of numbers in a similar format, it is less good for this type of mixed input. My initial thought would be
\documentclass{article}
\usepackage{siunitx}
\begin{document}
\begin{tabular}{S[table-format = -1.6e1, table-align-exponent = false]}
3,158722 \\
-0,00061 \\
6,28E-05 \\
0,000303 \\
1,67E-04 \\
0,000175 \\
-0,00017 \\
0,000025 \\
-0,00012 \\
-7,7E-05 \\
-0,00042 \\
-0,0005 \\
0,128871 \\
-0,00689 \\
0,004255 \\
-0,00245 \\
0,010475 \\
0,007083 \\
0,000852 \\
0,004583 \\
-0,00042 \\
0,002032 \\
-0,00111 \\
0,000556 \\
12,53887 \\
0,0024 \\
-0,00387 \\
0,002836 \\
-0,00052 \\
-0,00022 \\
5,41E-05 \\
-0,00063 \\
3,17E-04 \\
0,000187 \\
-0,08153 \\
-0,07881 \\
0,316826 \\
0,001066 \\
0,009783 \\
-0,02701 \\
0,006054 \\
0,004167 \\
\end{tabular}
\end{document}
but this will have too much space on the right margin. Perhaps a new option is needed in siunitx
to handle this case.
One alternative approach is to use a strategy similar to the dcolumn
package, making both ,
and E
active in math mode:
\documentclass{article}
\usepackage{array}
\newbox\tabboxa
\newbox\tabboxb
\newcommand*\tabalignstart{%
\setbox\tabboxa=\hbox{$-1$}%
\setbox\tabboxa=\hbox to \wd\tabboxa
\bgroup
$
\lccode`\~=`\,\relax
\mathcode`\,="8000%
\lowercase{\def~}%
{%
$%
\egroup
\setbox\tabboxb=\hbox
\bgroup
$
\lccode`\~=`\E\relax
\mathcode`\E="8000%
\lowercase{\def~}####1####2####3%
{\times 10^{####1####3}}%
.
}%
\hfill
}
\newcommand*\tabalignstop{%
$
\hfil
\egroup
\box\tabboxa
\box\tabboxb
}
\begin{document}
\begin{tabular}{>{\tabalignstart}l<{\tabalignstop}}
3,158722 \\
-0,00061 \\
6,28E-05 \\
0,000303 \\
1,67E-04 \\
0,000175 \\
-0,00017 \\
0,000025 \\
-0,00012 \\
-7,7E-05 \\
-0,00042 \\
-0,0005 \\
0,128871 \\
-0,00689 \\
0,004255 \\
-0,00245 \\
0,010475 \\
0,007083 \\
0,000852 \\
0,004583 \\
-0,00042 \\
0,002032 \\
-0,00111 \\
0,000556 \\
12,53887 \\
0,0024 \\
-0,00387 \\
0,002836 \\
-0,00052 \\
-0,00022 \\
5,41E-05 \\
-0,00063 \\
3,17E-04 \\
0,000187 \\
-0,08153 \\
-0,07881 \\
0,316826 \\
0,001066 \\
0,009783 \\
-0,02701 \\
0,006054 \\
0,004167 \\
\end{tabular}
\end{document}
Of course, the problem then is that there are no digit separators.
Best Answer
Instead of writing
(3.45E-10 \pm 6E-12)
, I would recommend using(3.45 \pm 6)E-10
. It's neater that way, especially so since you are typesetting this in a table.Onto the code itself: I'm not doing it in a table because it's too troublesome xD Anyhow, this should have the same effect in a table:
MWE
The option
scientific-notation
ensures the number that you pass in the argument is in scientific notation, whileseparate-uncertainty
ensures the number appears as a\pm
like you wanted.Output