我从脚本(R 脚本)中获取了科学计数法和十进制计数法的数字。如何在表格中强制将数字转换为十进制或科学计数法?(可能使用 siunitx?)
我目前的状态:
\documentclass[12pt]{article}
\usepackage{siunitx}
\usepackage{booktabs}
\begin{document}
\begin{table}[htbp]
\sisetup{round-mode=places
,round-precision=3
,scientific-notation=false
}
\caption{Train}
\begin{tabular}{lrr}
\toprule
Naming & Number 1 & Number 2\\
\midrule
Group 1 & \num{4.569975e-05} & \num{0.0003580374} \\
Group 2 & \num{8.919496e-06} & \num{0.0090821639} \\
\bottomrule
\end{tabular}
\end{table}
\end{document}
答案1
您需要将选项scientific-notation=fixed
和传递fixed-exponent=0
给siunitx
。(另请参阅该包的用户指南第 25f 页。)
\documentclass[12pt]{article}
\usepackage{siunitx}
\usepackage{booktabs}
\usepackage[skip=0.5\baselineskip]{caption}
\begin{document}
\begin{table}[htbp]
\centering
\sisetup{round-mode=places
,round-precision=3
,scientific-notation=fixed,
fixed-exponent=0}
\caption{Train}
\begin{tabular}{lcc}
\toprule
Naming & Number 1 & Number 2\\
\midrule
Group 1 & \num{4.569975e-05} & \num{0.0003580374} \\
Group 2 & \num{8.919496e-06} & \num{0.0090821639} \\
\bottomrule
\end{tabular}
\end{table}
\end{document}