# [texhax] Placing unknown images arbitrarily by lower left corner

Ulrike Fischer news3 at nililand.de
Thu Mar 31 14:40:09 CEST 2011

Am Thu, 31 Mar 2011 08:18:47 -0400 schrieb Peter Davis:

>>> ! LaTeX Error: Cannot determine size of graphic in egg.png (no
>>> BoundingBox).

>> You should use pdflatex if you want to use png graphicx.

> Actually, I'm using XeLaTeX, and I don't really care about png.  I just used
> those because I had a couple of image files in the directory I was using.
>  I'm more interested in placing PDF images.

Xelatex will work fine with png and pdf images.

>>> \settoboxtotalheight{\imgheight}{\egg}
>>> \raisebox{\imgheight}{\usebox{\egg}}

>> It is actually not necessary to mesure the graphic before the
>> \raisebox command. You can simply use

>> \raisebox{\height}{\includegraphics{....}}

>  Are you saying I should do this when I store the savebox, or when I use it?

You can use it like I wrote it. \raisebox knows the dimensions of
its argument and stores them in \height, \depth, \width.

\documentclass[12pt]{article}

\begin{document}
\rule{3cm}{4cm} abc \raisebox{-0.5\height}{\rule{3cm}{4cm}}
\end{document}

--
Ulrike Fischer