The following example fails with ! Argument of \@iinput has an extra }.
The problem does not occur when not using \input
or not using \num
. How can I avoid the error?
\documentclass{minimal}
\usepackage{siunitx}
\usepackage{filecontents}
\begin{filecontents*}{nline}
12345.6789
\end{filecontents*}
% Command to load the number from the simulated file
\newcommand{\rload}[1]{\input{#1}}
% Command to format the number loaded from the simulated file
\newcommand{\rnum}[1]{\num{\rload{#1}}}
\begin{document}
The formatted number is: \rnum{nline}
\end{document}
\num{12345.6789}
and what you have is\num{\IFFileExists{file}{\def\thisfile{file}123456.6789\space\par\endinput}{\LaTeXError{...}}}
you can probably make it work but if you have control over the input file it's much simpler to write\num{12345.6789}
in the file then simply\input
it