5

I get numbers in scientific and decimal notation from a script (R-script). How can I force the numbers into either decimal or scientific notation in a table? (Possibly with siunitx?)

My current status:

\documentclass[12pt]{article}
\usepackage{siunitx}
\usepackage{booktabs}

\begin{document}
\begin{table}[htbp]
        \sisetup{round-mode=places
        ,round-precision=3
        ,scientific-notation=false
    }
    \caption{Train} 
    \begin{tabular}{lrr}
        \toprule
        Naming & Number 1 & Number 2\\
        \midrule
        Group 1     & \num{4.569975e-05}    & \num{0.0003580374}    \\
        Group 2     & \num{8.919496e-06}    & \num{0.0090821639}    \\
        \bottomrule
    \end{tabular}
\end{table}
\end{document}

MWE But in this case I want both numbers in decimals, three digits (Yes I know that there will be zero) Any suggestions?

1 Answer 1

5

You need to pass the options scientific-notation=fixed and fixed-exponent=0 to siunitx. (See also pp. 25f. of the package's user guide.)

enter image description here

\documentclass[12pt]{article}
\usepackage{siunitx}
\usepackage{booktabs}
\usepackage[skip=0.5\baselineskip]{caption}
\begin{document}
\begin{table}[htbp]
\centering
\sisetup{round-mode=places
        ,round-precision=3
        ,scientific-notation=fixed,
        fixed-exponent=0}
\caption{Train} 
\begin{tabular}{lcc}
\toprule
Naming & Number 1 & Number 2\\
\midrule
Group 1     & \num{4.569975e-05}    & \num{0.0003580374}    \\
Group 2     & \num{8.919496e-06}    & \num{0.0090821639}    \\
\bottomrule
\end{tabular}
\end{table}
\end{document} 

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .