如何在 longtable latex 中四舍五入到小数点后 3 位?

如何在 longtable latex 中四舍五入到小数点后 3 位?

这是我想要四舍五入到小数点后 3 位的表格。

\documentclass{article}
\usepackage{longtable}
\usepackage{geometry}
\begin{document
\begin{longtable}{llllll}
\caption{Summary Statistics }\\ 
Zone & North &  &  & Center &  \\
Variables & Mean & SD &  & Mean & SD \\
Outcome  &  &  &  &  &  \\ 
X & 0.9333306 & 0.2494538 &  & 0.9359156 & 0.2449076 \\
Y & 0.1503803 & 0.3574512 &  & 0.1144668 & 0.318383 \\
\end{longtable}
\end{document}

答案1

与 longtable 配合的包siunitx

\documentclass{article}
\usepackage{array, longtable}
\usepackage{siunitx}
\usepackage{geometry}

\begin{document}

\begin{longtable}{l*{5}{S[round-mode=places, round-precision=3, table-format=1.3, table-number-alignment=center]}}
\caption{Summary Statistics }\\
Zone & {North} & & & {Center} & \\
Variables & {Mean} & {SD} & & {Mean} & {SD} \\
Outcome & & & & & \\
X & 0.9333306 & 0.2494538 & & 0.9359156 & 0.2449076 \\
Y & 0.1503803 & 0.3574512 & & 0.1144668 & 0.318383 \\
\end{longtable}

\end{document} 

在此处输入图片描述

相关内容