6

How do I use table-omit-exponent property (or something else) from siunitx to skip the exponent and print the unit as M for a million instead of getting the numbers printed in the format 4.32x10^6 in the following example? I understand that the unit M can be defined as a custom unit. I am struggling to remove the exponent part. Here is an MWE

\documentclass{article}
\usepackage{tabularx} 
\usepackage{siunitx}
\usepackage{booktabs}

\begin{document}
\begin{table}[t]
    \centering
    \sisetup{round-mode=places, round-precision=2, table-format=1.3, 
    scientific-notation=fixed, fixed-exponent=6, table-omit-exponent}
    \begin{tabular}
    { p{50mm} S S}
    \toprule
    Field & {col1} & {col2} 
    \\ 
    \midrule
    Property1 & \num{4321673} & \num{74098261}
    \\
    \bottomrule
    \end{tabular}

\end{table}
\end{document}
  • 3
    For starters, remove \num from the table entries... – Werner Nov 24 '18 at 6:26
  • and.. provide a minimum working example which has \documentclass \begin{document} and \end{document} – nidhin Nov 24 '18 at 11:36
  • Oops. I am gonna use my "new contributor" card as an excuse for not adding an MWE. I have updated the question. – Unni Nov 25 '18 at 23:18
  • @Werner: Thanks for that suggestion. Removing \num did the trick apparently! – Unni Nov 25 '18 at 23:22
1

Removing \num did the trick for me.

\documentclass{article}
\usepackage{tabularx} 
\usepackage{siunitx}
\usepackage{booktabs}

\DeclareSIUnit{\million}{M}
\begin{document}
\begin{table}[t]
    \centering
    \sisetup{round-mode=places, round-precision=2, table-format=3.3, 
    scientific-notation=fixed, fixed-exponent=6, table-omit-exponent}
    \begin{tabular}
    { p{40mm} S S}
    \toprule
    Field & {col1} & {col2} 
    \\ 
    \midrule
    Property1 & 4321673 \si{\million} & 74098261 \si{\million}
    \\
    \bottomrule
    \end{tabular}

\end{table}
\end{document}

Gives the table

_____________________________
Field      col1      col2
_____________________________
Property1  4.32  M   74.10  M
_____________________________

Still has an ugly spacing between the number and M. Since there are no other answers, I will keep it here.

| improve this answer | |
  • Actually, it's more than that. You also added \million. – Raffi Khatchadourian Dec 5 '19 at 15:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.