[texhax] Placing unknown images arbitrarily by lower left corner

Peter Davis pfd at pfdstudio.com
Wed Mar 30 23:38:29 CEST 2011


On Wed, Mar 30, 2011 at 3:22 PM, Philip Taylor (Webmaster, Ret'd) <
P.Taylor at rhul.ac.uk> wrote:

>
>
> Peter Davis wrote:
>
>  This looks very useful, especially since I'm putting all these images in
>> saveboxes anyway.  I'm not sure I understand the directions though.  Can
>> I reposition the box after specifying the image inside it?
>>
>
> Just in case Heiko has already retired for the night ...
>
> The box won't have any position after specifying the image inside it;
> it will just be a box (named or numbered), waiting patiently to be used.
> It is only when you /use/ it that it will gain a position (implicit or
> explicit).
>


Thanks, all!  Probably I'm still missing something or not understanding how
this should work.  I tried to place two images on a page, so that both are
bottom aligned on a line halfway up the page (396bp).  I got LaTeX errors:

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

and the images both appear at the bottom of the page, not aligned. Here's
the doc I used:

\documentclass[11pt]{article}
\usepackage{graphicx}
\usepackage{textpos}
\usepackage{settobox}

\setlength{\TPHorizModule}{1bp}
\setlength{\TPVertModule}{\TPHorizModule}

\title{Image Placement Text}
\author{Peter Davis}

\newlength{\imgheight}

\begin{document}

\newsavebox{\egg}
\sbox{\egg}{\includegraphics[scale=2.0]{egg.png}}

\newsavebox{\sheep}
\sbox{\sheep}{\includegraphics[scale=3.0]{sheep.png}}

\begin{textblock}{144}(72,396)
\settoboxtotalheight{\imgheight}{\egg}
\raisebox{\imgheight}{\usebox{\egg}}
\end{textblock}

\begin{textblock}{144}(288,396)
\settoboxtotalheight{\imgheight}{\sheep}
\raisebox{\imgheight}{\usebox{\sheep}}
\end{textblock}

\end{document}

-- 
----
The Tech Curmudgeon
http://www.techcurmudgeon.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://tug.org/pipermail/texhax/attachments/20110330/80381e8e/attachment.html>


More information about the texhax mailing list