[texhax] Placing unknown images arbitrarily by lower left corner

Peter Davis pfd at pfdstudio.com
Thu Mar 31 17:22:44 CEST 2011


On Thu, Mar 31, 2011 at 10:40 AM, Ulrike Fischer <news3 at nililand.de> wrote:

> Am Thu, 31 Mar 2011 10:21:09 -0400 schrieb Peter Davis:
>
> > I'm certainly not committed to using textpos.  I just want to be place an
> > image so that lower left corner is at an absolute fixed point on the
> page,
>
> Well in this case you don't need \raisebox ;-). The standard
> reference point of a graphic inserted with \includegraphics is at
> the lower left corner of this graphic.
>
> textblock has an option argument which lets you decide which point
> of the content should be placed at the specified location. You can
> use is to tell textblock to use the standard reference point. So
>
> \begin{textblock}{144}[0,1](72,396)
> ...
>
> should do what you want.
>
> Btw: I didn't follow the complete discussion but you perhaps need
> the [absolute] option when loading textpos.
>

Yes, that did it.  The working example is below.

I still have a slight problem in that the \begin{textblock}... is generated
from <fo:block> in XML, and I don't yet know whether it will contain text,
graphics or both, so it's difficult to set the alignment.  But I think I can
work that out.

Thank you!

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

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

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

\newlength{\imgheight}

\begin{document}

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

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

\begin{textblock}{144}[0,1](72,396)
\usebox{\egg}
\end{textblock}

\begin{textblock}{144}[0,1](288,396)
\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/20110331/39efa27f/attachment.html>


More information about the texhax mailing list