I have a code line that looks like that
\includegraphics{\complicatedmacro}
The \complicatedmacro
returns just the name of the picture file, e.g., mypicture
, so that when I write
\complicatedmacro
In my LaTeX code I get the text mypicture
in the output .pdf
Consequently \includegraphics{\complicatedmacro}
should just set the picture mypicture
in the document. But I get an error
TeX capacity exceeded, sorry [input stack size=5000].
However when I write \includegraphics{mypicture}
, everything works fine.
I have the feeling this issue has to do with the expansion process. What is the secret to let the \complicatedmacro
be fully expanded before the call to \includegraphics
?
I hope this is enough. I would like a general answer. But if you'd really need the "\complicatedmacro
", I could write it.
Thanks! :)
The
\complicatedmacro
's definition
\newcommand{\usedpicturename}[2]%
{\ifthenelse{\boolean{shouldusetestpicture}}{#1}{#2}}
Use in the
.tex
file
Now somewhere in the code I set the boolean
\setboolean{shouldusetestpicture}{false}
\includegraphics{\usedpicturename{mypicturetest}{mypicturecool}} %Here pops up the error
\complicatedmacro
.\complicatedmacro
expanded tomypicture
as stated you would not get that error.