我想在表格中将非指数和指数数字的小数点对齐。我试过
\documentclass{article}
\usepackage{booktabs}
\usepackage{siunitx}
\begin{document}
\begin{table}
\begin{tabular}{ll}
\toprule
Variable & Coefficient Weight \\
\midrule
A & \tablenum[table-format = 3.4]{0.0018} \\
B & \tablenum[table-format=1.4e2]{-6.0113E-4} \\
C & \tablenum[table-format = 3.4]{0.4365} \\
D & \tablenum[table-format = 3.4]{1.2386} \\
E & \tablenum[table-format = 3.4]{-0.3071} \\
\bottomrule
\end{tabular}
\end{table}
\end{document}
这不会为指数创建所需的对齐。有什么想法吗?
答案1
这难道不是你想要的吗
\documentclass{article}
\usepackage{booktabs}
\usepackage{siunitx}
\begin{document}
\begin{table}
\begin{tabular}{lS[table-format=-1.4e-1]}
\toprule
Variable & {Coefficient Weight} \\
\midrule
A & 0.0018 \\
B & -6.0113E-4 \\
C & 0.4365 \\
D & 1.2386 \\
E & -0.3071 \\
\bottomrule
\end{tabular}
\end{table}
\end{document}