I thought that the construction \wd\bopxcontrolsequence was expandable. But in mucking around in things, it seems not to be. At least in the following, the code demonstrates that \wd\aetmpbox never gets fully expanded in the definition of \aewidth.
\documentclass{article}
\usepackage{pgffor}
\newsavebox\aetmpbox
\begin{document}
\def\aewidth{0pt}%%
\foreach \myitem in {first,a,a bit longer,shorter,very very very very very long}
{\savebox\aetmpbox{\myitem}%%
\ifdim\wd\aetmpbox>\aewidth\relax
\xdef\aewidth{\wd\aetmpbox}%%
\typeout{---> \detokenize\expandafter{\aewidth} :L: \myitem }%%
\else
\typeout{---> \detokenize\expandafter{\aewidth} :s: \myitem }%%
\fi
}
hello
\end{document}
What I did not want to have to create a new length (for whatever reason). I just wanted to get the value for the width of my box to be saved in the macro \aewidth for later use.
\xdef\aewidth{\the\wd\aetmpbox}perhaps? If I apply this way, I can use\aewidthin\setlength.... – Mar 15 '16 at 15:35\savebox\aetmpbox{\myitem}was building the box. – A.Ellett Mar 15 '16 at 15:39\xdef\aewidth{\the\wd\aetmpbox}– egreg Mar 15 '16 at 15:40