I'm trying to include a background image of the correct size based on the two variables \IApaperheight and \IApaperwidth.
To do this, I'm converting the lengths to a rounded text value and concatenating them with a prefix in another variable.
I can render the full path correctly, but when I try to pass it to \includegraphics it is complaining because (as far as I can figure out) the path isn't a string, but instead a bunch of macros.
Is there any way I can "stringify" the path name so that I can use it as a literal?
I am using this to convert lengths to rounded integers:
% \IArndmm{\length} returns the length in mm rounded to an integer
\makeatletter%
\def\l@nunitperpt{0.351459}\def\l@nunits{mm}%
\def\@round#1.#2\@empty{#1}%
\newcommand{\IArndmm}[1]{%
\setlength{\@tempdimc}{\l@nunitperpt #1}%
\addtolength{\@tempdimc}{0.5pt}%
\edef\@@round{\strip@pt\@tempdimc}%
\expandafter\@round\@@round.\@empty%
}%
\makeatother%
%
Then this to include the image:
\newcommand{\IABGImageName}[3]{#1/#2x#3.jpg}%
%
\includegraphics[
width=\IApaperwidth,height=\IApaperheight,keepaspectratio]{%
\IABGImageName{\IABGImage}%
{\IArndmm{\IApaperwidth}}%
{\IArndmm{\IApaperheight}}%
}}%
\setlengthand\addtolengthas well as\edefstops the macro\IArndmmto be fully expandable. In short everything which requires assignments isn't expandable. – Martin Scharrer Jun 01 '11 at 18:46