As a first step I am calculating the sum of a series of numbers. Then I want to calculate the root of the sum, but I don't know how to use the result.
So I tried using \def\test{\calcsum{\one,\two,\three}}
and calling with \calcroot{\test}
but it doesn't work. (The code for this is from LATEX3: More than 9 arguments.)
It gives me the error message:
You can't use \edef after \the. \cs_set_nopar_Npx
Does someone know how to fix this? Thanks in Advance!
\documentclass[a4paper,12pt]{article}
\usepackage{xparse}
\usepackage{fp}
\def\one{1}
\def\two{2}
\def\three{3}
\def\four{4}
\def\five{5}
\def\six{6}
\def\seven{}
\def\eight{8}
\def\nine{9}
\def\ten{1}
\ExplSyntaxOn
\NewDocumentCommand{\calcsum}{m}
{
\clist_set:Nx \l_tmpa_clist { #1 }
\fp_to_decimal:n { \clist_use:Nn \l_tmpa_clist { + } }
}
\ExplSyntaxOff
\def\test{\calcsum{\one,\two,\three}}
\ExplSyntaxOn
\NewDocumentCommand{\calcroot}{m}
{ \fp_eval:n {sqrt(#1)}}
\ExplSyntaxOff
\begin{document}
\calcroot{\test}
\end{document}
\seven
empty is that intentional? (it complicates things a bit as6++8
would be a syntax error) also you probably don't need fp package if you are loading expl3 via xparse as expl3 has its own floating point implementation.