This is a follow-up question to "Notation and output in siunitx".
Consider the following code (courtesy of egreg):
\documentclass{article}
\usepackage{amsmath}
\usepackage[locale = DE]{siunitx}
\ExplSyntaxOn
\NewDocumentCommand\SIexpr{ O{,} m m }
{
\SIextension_siexpr:nnn { #1 } { #2 } { #3 }
}
\cs_new_protected:Npn \SIextension_siexpr:nnn #1 #2 #3
{
\seq_set_split:Nnn \l_SIextension_siexpr_input_seq { #1 } { #2 }
\seq_pop_left:NN \l_SIextension_siexpr_input_seq \l_SIextension_siexpr_first_tl
\seq_clear:N \l_SIextension_siexpr_output_seq
\seq_put_right:Nx \l_SIextension_siexpr_output_seq
{
\fp_compare:nTF { \l_SIextension_siexpr_first_tl > 0 }
{ \num { \l_SIextension_siexpr_first_tl } }
{ - \num { \tl_tail:V \l_SIextension_siexpr_first_tl } }
}
\seq_map_inline:Nn \l_SIextension_siexpr_input_seq
{
\seq_put_right:Nx \l_SIextension_siexpr_output_seq
{
\fp_compare:nTF { ##1 > 0 }
{ + \num { ##1 } }
{ - \num { \tl_tail:n { ##1 } } }
}
}
\SI[parse-numbers=false]
{
\sisetup{parse-numbers}
( \seq_use:Nn \l_SIextension_siexpr_output_seq { } )
}
{ #3 }
}
\ExplSyntaxOff
\begin{document}
\begin{align*}
l
&= \SI{-38.0}{\cm} + 2 \cdot \SI{26.2}{\cm} + \SI{32.6}{\cm}\\
&= \SIexpr{-38.0, 52.4, 32.6}{\cm}\\
% &= \SIexpr{-\frac{38.0}{1}, 52.4, 32.6}{\cm}\\
&= \SI{47.0}{\cm}.
\end{align*}
\end{document}

The code compiles just fine but assume I want a fraction as in the out-commented expression with automatic scaling of the parentheses.
How do I achieve that?
Update
I tried to change a single code line from
( \seq_use:Nn \l_SIextension_siexpr_output_seq { } )
to
\left( \seq_use:Nn \l_SIextension_siexpr_output_seq { } \right)
in order to get scaling parentheses but without luck; with or without the code change I get the following error when trying to use a fraction inside \SIexpr:
! Undefined control sequence.
<argument> \LaTeX3 error:
Erroneous variable \protect used!

\but/. – Manuel Oct 19 '14 at 12:50/but simply forgot the option. Embarrassing that I missed that, since I usesiunitxquite often. – Svend Tveskæg Oct 19 '14 at 12:52quotient-mode=fractionto\sisetuprather than\SI[…]. But I leave that to you. – Manuel Oct 19 '14 at 12:54\frac{}{}work, that would be really cool, but I can do fine with the other solution! – Svend Tveskæg Oct 19 '14 at 13:05*or\cdotgives me an error. – Svend Tveskæg Oct 20 '14 at 02:56*in the siunitx.pdf documentation:input-product=*andoutput-product=\cdotoptions should give you what you want. Put those options in the same place you putquotient-mode=fraction. – Manuel Oct 20 '14 at 08:11