最小(非)工作示例:
\documentclass{article}
\usepackage{siunitx}
\usepackage{pgfplotstable}
\usepackage{filecontents}
\pgfplotstableset{
header=true,
trim cells=true,
col sep=comma,
secure header/.style={
columns/#1/.append style={
column name={\multicolumn{1}{c}{#1}},
}
},
si column/.style={
columns/#1/.append style={
string type,
column type={S[table-format=2.2e1]},
}
},
}
\begin{document}
number to print: 3433010912
\pgfmathparse{3433010912}
siunitx result:
\num[scientific-notation=engineering,round-mode=places,round-precision=2]{\pgfmathresult}
\begin{filecontents*}{data.csv}
works, doesn't work
147385274, 3433010912
\end{filecontents*}
this table is wrong:
\pgfplotstableread{data.csv}{\Data}
% this produces an error
\sisetup{scientific-notation = engineering, table-auto-round=true}
\pgfplotstabletypeset[%
columns={works, doesn't work},
secure header/.list={works, doesn't work},
si column/.list={works, doesn't work},
]{\Data}
this table is right, but the alignment for the long header is not nice:
% this works
\pgfplotstabletypeset[%
columns={works, doesn't work},
columns/works/.style={sci,sci sep align},
columns/{doesn't work}/.style={sci,sci sep align},
]{\Data}
\end{document}
我从 pgfplotstable 中获取要打印的数字,因此也从 csv 文件中获取。我发现所有与 siunitx 和“数字太大”相关的问题都与数字太小且位数太多有关,但与数字实际上太大无关。
我如何获取 siunitx 的值以使其可读?
答案1
该问题已在 siunitx 版本 2015/09/14 v2.6l 中修复,可在 texlive 2015 中找到。因此答案是:使用当前软件。