考虑以下 MWE,代码来自这里然后稍作修改:
\documentclass{article}
\usepackage{siunitx}
\ExplSyntaxOn
\NewDocumentCommand\SIexpr{O{,}mm}{
\SIext:nnn{#1}{#2}{#3}
}
\cs_new_protected:Npn \SIext:nnn#1#2#3{
\seq_set_split:Nnn \l_SIext_input_seq{#1}{#2}
\seq_pop_left:NN \l_SIext_input_seq \l_SIext_first_tl
\seq_clear:N \l_SIext_output_seq
\seq_put_right:Nx \l_SIext_output_seq{
\fp_compare:nTF{\l_SIext_first_tl > 0}
{\num{\l_SIext_first_tl}}
{-\num{\tl_tail:V \l_SIext_first_tl}}
}
\seq_map_inline:Nn \l_SIext_input_seq{
\seq_put_right:Nx \l_SIext_output_seq{
\fp_compare:nTF{##1 > 0}
{+\num{##1}}
{-\num{\tl_tail:n{##1}}}
}
}
\SI[
parse-numbers = false,
quotient-mode = fraction,
input-product = *,
output-product = \cdot
]{
\sisetup{parse-numbers}
\left(\seq_use:Nn \l_SIext_output_seq{}\right)
}{#3}
}
\ExplSyntaxOff
\begin{document}
\SIexpr{5, -2*1}{\s}
\end{document}
当我pdflatex
使用最新的 TeX Live 2021 发行版进行编译时,出现以下警告和错误:
Package siunitx Warning: Option "quotient-mode" has been removed in this
(siunitx) release.
! LaTeX3 Error: The key 'siunitx/input-product' is unknown and is being
(LaTeX3) ignored.
For immediate help type H <return>.
...
l.41 \SIexpr{5, -2*1}{\s}
我该如何修复代码以便它再次正确编译?