# handyfloss

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

1. ### manassaid

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

2. ### Williemaesaid

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.