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. Oct 20, 2018 at 3:08

2 Answers 2


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:



You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .