1

I have this basic table:

\begin{table}[]
\centering
\begin{tabular}{lll}
 & a/W & b/W \\
v & 0.00001 & 1000 \\
w & 0.002 & 200 \\
x & 0.000003 & 30000 \\
y & 0.00004 & 40
\end{tabular}
\caption{Actual Data}
\label{tab:actual}
\end{table}

The numbers in that table body are generated programmatically. I would like to elect a unit per column that the values are automatically converted to. Can I achieve this using siunitx? The output should look something like that:

\begin{table}[]
\centering
\begin{tabular}{lll}
 & a/mW & b/kW \\
v & 0.01 & 1 \\
w & 2 & 0.2 \\
x & 0.003 & 30 \\
y & 0.04 & 0.04
\end{tabular}
\caption{Can I achieve this using siunitx?}
\label{tab:actual}
\end{table}

1 Answer 1

1

I'm not sure exactly how you want to specific the factors. Assuming we can have a bit of manual work, then we can use exponent-mode = fixed with a suitable fixed-exponent:

\documentclass{article}

\usepackage{siunitx}

\begin{document}
\begin{table}
\centering
% Shared settings
\sisetup{exponent-mode = fixed, drop-exponent}
\begin{tabular}{
      l
      S[table-format = 1.3, fixed-exponent = -3]
      S[table-format = 2.3, fixed-exponent = 3]}
 & {a/\unit{\mW}} & {b/\unit{\kW}} \\
v & 0.00001 & 1000 \\
w & 0.002 & 200 \\
x & 0.000003 & 30000 \\
y & 0.00004 & 40
\end{tabular}
\end{table}
\end{document}
2
  • Package siunitx Error: Unknown option 'drop-exponent' is probably another v2 vs v3 issue...?
    – mritz_p
    Commented Aug 2, 2021 at 18:03
  • @mritz_p In v2 you want table-omit-exponent (it wasn't actually table-specific ...)
    – Joseph Wright
    Commented Aug 2, 2021 at 18:09

You must log in to answer this question.

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