csvsimple 浮点精度过滤器

csvsimple 浮点精度过滤器

我正在使用该csvsimple包从 csv 文件创建表格。我正在使用以下选项:

\csvreader[tabular=lllll,
           table head=\toprule Instance & Best & Worst & Mean & Standard Deviation\\ \midrule,
           head to column names,
           late after last line=\\\bottomrule]      
           {./../output/algorithms/as-results.csv}{}%
           {\instance & \best & \worst & \mean & \std}%

现在,我想仅对列应用过滤器std来调整浮点精度。我该怎么做?

答案1

一种可能性是使用该siunitx包。

\usepackage{siunitx}
\usepackage{booktabs}
\usepackage{csvsimple}

\begin{table}[htb]
    \sisetup{round-mode=places, round-precision=3}
    \centering
    \csvreader[tabular=lllll,
               table head=\toprule Instance & Best & Worst & Mean & Standard Deviation\\ \midrule,
               head to column names,
               late after last line=\\\bottomrule]
               {./../output/algorithms/as-results.csv}{}%
      {\instance & \num{\best} & \num{\worst} & \num{\mean} & \num{\std}}%
\end{table}

相关内容