3

Tabular content can be nicely aligned, but I can't get numbers without mantissa (in scientific notation) aligned with the rest:

\documentclass{article}
\usepackage{booktabs,siunitx}
\sisetup{print-unity-mantissa=false}
\begin{document}

~\vfill

\begin{tabular}{SS[table-alignment=right,table-alignment-mode=none] r@{}c@{}l}
\multicolumn{1}{c}{centered in column but not aligned} &
\multicolumn{1}{c}{aligned\footnotemark[1], but not centered} &
\multicolumn{3}{c}{desired} \\
\toprule
10   & 10   & 10 &              &           \\
1e-4 & 1e-4 &    &              & $10^{-4}$ \\
5e-5 & 5e-5 &  5 & ${}\times{}$ & $10^{-5}$ \\
1e-5 & 1e-5 &    &              & $10^{-5}$ \\
\bottomrule
\end{tabular}

\footnotetext[1]{First row is not correct, though.}

\end{document}

Is there some way to get the "desired" result without such manual fumbling?

enter image description here

3
  • 2
    Looks like I have a bug in the v3 code here: I'll sort that today then post an answer
    – Joseph Wright
    Commented Dec 1, 2022 at 8:55
  • Wouldn't it make more sense to put the "10" to the right aligned with the other tens, if the mantisse m is in it's normalized form 1 ≤ |m| < 10. This would be the short version of 1 x 10^1.
    – dexteritas
    Commented Dec 1, 2022 at 8:58
  • 1
    @dexteritas Yes, maybe. That was just a quickly concocted example, pretend it says 7 instead of 10.
    – Jellby
    Commented Dec 1, 2022 at 10:00

1 Answer 1

1

You want to set table-align-exponent; that was working in v2 but there was a bug in v3 which meant you'd not see the effect. I've just released v3.1.11 to address that, for the present I also include the patch here:

\documentclass{article}
\usepackage{booktabs}
\usepackage{siunitx}%[=v2]
\ExplSyntaxOn
\cs_gset_protected:Npn \__siunitx_table_print_format_auxvii:w
  #1 \q_nil #2 \q_mark #3 \q_nil #4 \q_stop
  {
    \tl_if_blank:nF {#2}
      {
        \__siunitx_table_print_format_box:Nn \l__siunitx_table_tmp_box { { } #1#2 }
        \dim_set:Nn \l__siunitx_table_tmp_dim { \box_wd:N \l__siunitx_table_tmp_box }
        \__siunitx_table_print_format_box:Nn \l__siunitx_table_tmp_box
          {
            \bool_lazy_and:nnT
              { \l__siunitx_table_align_exponent_bool }
              { \tl_if_blank_p:n {#3} }
              {
                \__siunitx_table_print_format_box:Nn \l__siunitx_table_tmp_box
                  { { } #1 { } }
                \__siunitx_table_skip:n { \box_wd:N \l__siunitx_table_tmp_box }
              }
            { } #3#4
          }
        \__siunitx_table_print_format_after:N
          \l__siunitx_table_align_exponent_bool
      }
  }
\ExplSyntaxOff

\sisetup{retain-unity-mantissa=false}
\begin{document}

\begin{tabular}{S[table-format = 2e+1,table-align-exponent=true]S[table-format = 2e+1,table-align-exponent=false]}
\multicolumn{1}{c}{centered in column but not aligned}\\
\toprule
10   & 10   \\
1e-4 & 1e-4 \\
5e-5 & 5e-5 \\
1e-5 & 1e-5 \\
\bottomrule
\end{tabular}

\end{document}

You must log in to answer this question.

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