I would really like to do something like the following:
\includegraphics{\StrSubstitute{No Spaces}{ }{}}
However, this gives me an Undefined control sequence error. I saw some other posts about includegraphics
not evaluating macros in arguments. So, I tried this:
\newcommand{\imageFoo}[1]{
\includegraphics{#1}
}
\begin{document}
\imageFoo{\StrSubstitute{No Spaces}{ }{}}
\end{document}
This also gives me the Undefined control sequence error.
To test further, I defined:
\newcommand{\identityMacro}[1]{#1}
The following then all work as expected:
\includegraphics{NoSpaces}
\imageFoo{NoSpaces}
\imageFoo{\identityMacro{NoSpaces}}
\includegraphics{\identityMacro{NoSpaces}}
\StrSubstitute{No Spaces}{ }{}
Can anyone help me understand why includegraphics
never works with StrSubstitute
?