[Tex/LaTex] Problem with \makebox and the unit in the dimensions

boxeslengthsunits

I want to superpose a text to some other object (in this aces a picture). My idea is to store the picture in \mabox, to display it with in a \makebox with 0 width and height, then to display the text thru a second \makebox, with width and height equal to those of \mabox. My attempt fails, because \wd\mabox delivers a length with unit, and \makebox expects a length without unit. How could i do it better?

\documentclass{article}
\usepackage{graphicx}
\usepackage{blindtext}

\begin{document}

\newsavebox\mabox
\sbox{\mabox}{\includegraphics[scale=0.10]{Pingouin}}
\makebox(0,0)[b]{\put(0,0){\usebox\mabox}}
\fbox{\makebox(\wd\mabox,\ht\mabox)[b]{\put(0,0){\parbox{\wd\mabox}{\blindtext}}}}

\end{document}

Best Answer

Don't tell anyone I told you, but you can go

\def\unitlength{}
\sbox{\mabox}{\includegraphics[scale=0.10]{Pingouin}}
\makebox(0pt,0pt)[b]{\put(0pt,0pt){\usebox\mabox}}
\fbox{\makebox(\wd\mabox,\ht\mabox)[b]{\put(0pt,0pt){\parbox{\wd\mabox}{blindtext}}}}

Note that having made \unitlength unitless, you have to put explicit units in places that normally take an integer.

The alternative is to use \strip@pt defined in LaTeX eg this use where LaTeX is switching between unit and non-unit font size representation

   \edef\f@size{\strip@pt\@tempdimb}%

but often it's easier just to use units everywhere in picture mode, then you are not restricted to using the same units throughout.