TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How to suppress units in length macros such that they can be passed to viewport. See the following Minimal Not Working Example,

\includegraphics[viewport=0 0 \strip@pt\width \strip@pt\height]{bald}
share|improve this question
Note that \width and \height are often used temporally by macros like \raisebox and then set to the content size. It's not an issue here, I just want to point that out. I'm planning to add this to \includegraphics in the next feature release of adjustbox. – Martin Scharrer Jul 12 '11 at 9:37
@Martin: Can you give me an example where \width and \height will affect \raisebox in a practical situation? – xport Jul 12 '11 at 14:09
up vote 2 down vote accepted

The viewport option actually accepts units, but defaults to bp if none are used. The issue here is that the macro is eating the space behind it which is used as a separator by viewport (and also trim). The solution is to wrap the expression in { } (which is removed afterwards) to protect the space:

\includegraphics[viewport=0 0 {\width} \height]{bald}
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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