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?




  • Would it be a solution to use TikZ? In that case, take a look at Drawing on an image with TikZ – ilpssun Mar 16 '12 at 9:36
  • You can use \raisebox and \rlap to remove height and width as well. Also, adjustbox allows for that (see key bgimage for example). – Martin Scharrer Mar 30 '18 at 7:09

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


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


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

| improve this answer | |
  • ok, i will not tell anyone ;) But the command \strip@pt makes exactly what i want : just put a \strip@pt before \wd\mabox and \ht\mabox in my second makebox. Thanks ! – nicolas roy Mar 16 '12 at 9:45

Use the picture package, so that


is accepted; you're allowed to put explicit and implicit (that is, expressed as register values) dimensions in all commands of the picture environment.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.