I need to dynamically input a proper .tex file into my document. I wrote the following code that works only if instead of "\realyear{\season}" I explicitly write 2019. Inside the \input all new defined commands work, but the command that has one argument (which is \realyear) makes the document not to compile (error is "Argument of \filename@simplehas an extra }"). Why is that? How to overcome this issue?

\def \myfolder {../../../../../trial}
\def \season {Spring}
\def \yearstart{2018}
\def \yearfinish{2019}


\input{\myfolder/trialfolder/\season\realyear{\season} common}  
  • \ifthenelse is not expandable. It won't work here. – Phelype Oleinik Oct 20 at 3:08
up vote 2 down vote accepted

The \ifthenelse command doesn't work by expansion, so it cannot work in that position.

While \pdfstrcmp works, it has a couple of disadvantages: it is not “engine independent” and has a weird syntax.

One can use etoolbox



or expl3


\cs_new_eq:NN \equalstringTF \str_if_eq:nnTF


You need an expandable option for returning \yearstart or \yearfinish. Here's an option:



Your Answer


By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.