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:


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:


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).

1 Comment »

  1. LaTeX: the textpos package « handyfloss said,

    September 18, 2008 @ 14:36 pm

    […] Entry available at: […]

RSS feed for comments on this post · TrackBack URI

Leave a Comment