I need elements in a tabular environment to set some lengths and be able to access these lengths in another row of this same table. But it appears that adding \global in front of \settoheight and \settowidth is not sufficient.
The the following MWE MeasureFigureAndPlaceFigure measures the height and width of the parameter passed to it, and attempts to globally set the lengths. This reports zero length and width after the tabular, but correct (ignoring the slight round off) lengths outside.

\documentclass{article}
\usepackage[demo]{graphicx}
\usepackage{printlen}
\uselengthunit{cm}
\newlength{\FigureHeight}
\newlength{\FigureWidth}
\newcommand{\MeasureFigureAndPlaceFigure}[1]{%
\global\settoheight{\FigureHeight}{#1}%
\global\settowidth{\FigureWidth}{#1}%
#1%
}%
\newcommand{\ReportHeightAndLength}{%
Height=\printlength{\FigureHeight}\quad%
Width=\printlength{\FigureHeight}%
}%
\def\FigA{\includegraphics[width=2.0cm,height=1.0cm]{myimage}}
\begin{document}
\noindent% This reports 0 lengths
\begin{tabular}{@{}l@{}}
\MeasureFigureAndPlaceFigure{\FigA}
\end{tabular}
\ReportHeightAndLength
\noindent % This works just fine
\MeasureFigureAndPlaceFigure{\FigA}
\ReportHeightAndLength
\end{document}
\settowidth{\global\FigureWidth}should work.:)– egreg Mar 01 '12 at 22:29\settowidth. A fraction slower but perhaps less devious would be\settowidth{\dimen@}{...}\global\FigureWidth\dimen@– David Carlisle Mar 01 '12 at 22:34\setbox\z@\hbox{#1}\global\FigureWidth\wd\z@\global\FigureHeight\ht\z@\box\z@so you only set it once, save the dimensions then use the saved box. – David Carlisle Mar 01 '12 at 22:38\setboxsolution also work and I like it better as it seems less magical than\settowidth{\global\FigureWidth}, and more efficient. – Peter Grill Mar 01 '12 at 22:45