handyfloss

Because FLOSS is handy, isn’t it?

LaTeX: the textpos package

Posted by isilanes on May 29, 2007

Blog moved to: handyfloss.net

Entry available at: http://handyfloss.net/2007.05/latex-the-textpos-package/

I have recently discovered a marvelous LaTeX package, namely textpos (PDF manual). My problem was that I wanted to place pieces of text arbitrarily in a page. I had tried tabular environments, a liberal use of \vspace and \hspace, the minipage environment, and even the picture environment. None would do.

However textpos is just what I wanted. The package is loaded with the usual:

\usepackage[options]{textpos}

The options I have used are:

  • absolute – the placing is made with respect to the whole page (stuff me if I understand this)
  • showboxes – draws boxes around the text, so you exactly see what you do (for debugging, of course)

Some variables have to (can) be set, namely the width and height units, for example:

\setlength{\TPHorizModule}{\paperwidth}\setlength{\TPVertModule}{\paperheight}

After that, all the placing specifications can be referred to \TPHorizModule and TPVertModule. A typical use of textpos would be:

\begin{textblock}{width}[xt,yt](X,Y)  the-text-goes-here  \end{textblock}

where width is the desired width of the text box (the height will be enough to place all the text specified), X and Y are the (x,y) placement of the text box, and xt and yt are the point inside the text box which will be placed at (X,Y). All the units refer to \TPHorizModule and TPVertModule. For example:

\begin{textblock}{0.6}[0.5,0.5](0.3,0.4)  hello world\end{textblock}

will print the text “hello world” in a box of width 60% of \TPHorizModule (in my example, this is 60% of the total page width). The center (0.5,0.5) of that box will be placed at a point 30% to the right of the left margin, and 40% below the top margin (in TPxxxModule units).

About these ads

3 Responses to “LaTeX: the textpos package”

  1. manas said

    can you pls give me any site that has codes using this package and also illlustrations.

  2. Williemae said

    Nice post. I learn something new and challenging on sites I stumbleupon on a daily basis.
    It will always be interesting to read through content from other writers and practice something from
    other sites.

  3. we, supposed, was intended to attract the neighbouring blacks.
    His fee was 110 guineas, knowning that in the hotelkeeper was 30 guineas.
    Good fishing would have been to be been on this river
    all of the year-round, even just in flood-time, when the lake was
    clear fish may be seen taking the bait with a depth of 10 feet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
Follow

Get every new post delivered to your Inbox.

%d bloggers like this: