5

My problem is to round numbers that are integers so, for example, I have 123456789 but I only want to have 123 * 10^6 in the table cell.

example code:

\begin{table}
\caption{Table} \label{tab:tab}
\begin{center}
\begin{tabular}{l S}
\hline
 Name & {number} \\
\hline
 a & 18799382 \\
 b & 16492855 \\
\hline
\end{tabular}
\end{center}
\end{table}

I want to round the second column to have an output of something like:

\begin{table}
\caption{Table} \label{tab:tab}
\begin{center}
\begin{tabular}{l S}
\hline
 Name & {number} \\
\hline
 a & 188e5 \\
 b & 165e5 \\
\hline
\end{tabular}
\end{center}
\end{table}
2
  • Welcome to TeX.SX! Is Converting numbers to scientific notations helpful or are you looking for an automatic solution?
    – Bobyandbob
    Commented Jun 1, 2018 at 11:53
  • Actually, that is useful, I just didn't know that the same controls work for tabular, but now it is obvious as I see the solution of @JosephWright.
    – mani
    Commented Jun 2, 2018 at 10:37

1 Answer 1

7

You need to do two things:

  • Turn on rounding with appropriate settings
  • Turn on fixed exponents with appropriate settings

Thus something like

\begin{tabular}
{
  l
  S[round-mode = figures,
   round-precision = 3,
   scientific-notation = fixed,
   fixed-exponent = 5]
}

You must log in to answer this question.

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