I hope somebody of you is able to help me with the following problem. I have read over the last hours many posts about expanding commands before the result is used again but I am still not able to achieve my goal.
My problem is that I have a custom command with 2 input arguments \printConvTablesd{"FileName"}{"Number"} which imports a table based on the inputs. Inside the command it looks similar to this \input{dri1/dir2/FileName_someotherStuff_Number}. "Number" is then also used in the label of the table so the labeling follows the inputs.
This commands works as expected if and only if I insert the hard coded values for the two input arguments.
My idea was to set up a loop in order to make the document cleaner and easier to change since I need to use the loops multiple times.
The optimal output would look similar to this:
\foreach \Name in {Name1,Name2,...}
{
\foreach \n in {0.05,0.10,0.55}
{
def\d\num[round-mode=places,round-precision=2]{\n}
\printConvTablesd{\Name}{\d}
}
}
The \num-command is needed since I need a special formatting for importing the table-files.
This peace of code produces the following error Missing \endcsname inserted....
If I modify the code just a little to look something like the following it works alright:
\foreach \Name in {Name1,Name2,...}
{
\printConvTablesd{\Name}{0.05}
\printConvTablesd{\Name}{0.10}
...
\printConvTablesd{\Name}{0.50}
}
So I guess the problem occurs because the second argument is handed over as command sequence and not as the result of the \num[...]{...} command.
I am also guessing that I need some form of code expanding before
I would really appreciate if anybody of you could help me with that problem. If any more information are needed please let me know.
def\d\numlooks very odd it will typeset the worddefthen try to apply the accent command\dto\num. But it would be easier to debug a complete file rather than fragments – David Carlisle Dec 02 '16 at 21:02\nameand\Nameagain it is very hard to tell if that is simply a typo or if there is missing code. – David Carlisle Dec 02 '16 at 21:05\nameand\Nameshould match upper and lower cases. This means either you change\nameto\Nameor the other way around.Regarding posting a MWE it is not so easy since my document has nested
– ExtremOPS Dec 02 '16 at 21:27\input{}over several levels. But I will try to add a MWE asap.