0

I have a table with entries both in scientific and non-scientific notation. I use the parser to convert the scientific notation into fixed exponent (with an exponent equal to 0). Then I would like to pad the numbers to have the same amount of digits in after the decimal marker.

I though that this would work:

\documentclass[a4paper,notitlepage]{article}

\usepackage{siunitx}

\begin{document}

\begin{tabular}{
                S[table-format=2.1, scientific-notation=fixed, fixed-exponent=0, add-decimal-zero=true]
}
8.8\\
7\\
7.\\
1.4e1\\

\end{tabular}

\end{document}

But what happens is that

  • the '8.8' doesn't change. OK!
  • the '7' is not seen as a decimal so there is no '.0' added.
  • the '7.' is seen as a decimal so a '0' is added
  • the '1.4e1' is converted (because of the fixed notation) into 14 but I guess then no longer considered as decimal. I would have hoped to see a '14.0'

Output from xelatex

enter image description here

Any idea what options to set?

1

1 Answer 1

1
\documentclass[margin=3mm]{standalone}
\usepackage{siunitx}

\begin{document}
    \begin{tabular}{S[table-format=2.2,
                      scientific-notation=fixed,
                      round-integer-to-decimal,   % <---
                      round-mode=places,          % <---
                      round-precision=2]}         % <---
8.8     \\
7       \\
7.      \\
1.4e1
    \end{tabular}
\end{document}

enter image description here

You must log in to answer this question.

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