There is a neat package called textpos
that helps you to place anything absolutely on the page.
Loading the package
Include it in your preamble. You need to pass the option absolute for absolute positioning to work.
\usepackage[absolute]{textpos}
If you want to use relative positioning later you may always switch between the two modes using:
\TPoptions{absolute=false}
and \TPoptions{absolute=true}
But you need to pass this package option for absolute positioning to work. Enabling it later using \TPoptions{absolute=true}
will result in an error message.
Defining the grid
Now you need to define a grid:
\TPGrid[horizontalBorder,verticalBorder]{numRows}{numColumns}
Here is an example grid:
\TPGrid[20mm,10mm]{5}{5}
Placing boxes
You may enable debug view of the grid with this instruction:
\TPShowGrid{numRows}{numColumns}
Ensure that the numRows and numColumns match
In our case we want a 1 by 1 grid without any border:
\TPGrid[0mm,0mm]{1}{1}
It might be helpful to enable debug view of our boxes:
\TPoptions{showboxes=true}
Now you can start positioning your textblock:
\begin{textblock}{widthInGridCells}[originXAsFractionOfBoxWidth,originYAsFractionOfBoxHeight](XInGridCells,YInGridCells)
Textcontent
\end{textblock}
Lets talk about the options:
- widthInGridCells (How wide our box is. Approximate its width based on your content)
- XInGridCells (Where the x coordinate of the origin of our box should be placed. We want to place it all the way in the bottom right corner. As our grid is only one cell wide we put a 1 here)
- YInGridCells (Where the y coordinate of the origin of our box should be placed. We want to place it all the way in the bottom right corner. As our grid is only one cell high we put a 1 here)
- originXAsFractionOfBoxWidth (Where the origin of our box is supposed to be. (0,0) is the top left corner and (1,1) the bottom right corner.) We want out origin to be all the way to the right of the box. Therefore we put a 1 here.
- originYAsFractionOfBoxHeight (Where the origin of our box is supposed to be. (0,0) is the top left corner and (1,1) the bottom right corner.) We want out origin to be all the way to the bottom of the box. Therefore we put a 1 here.
\begin{textblock}{0.25}[1,1](1,1)
will now put the origin of our box in the bottom right corner of the page. We specified our origin to be the bottom right corner of our box. The box is 1/4 of our page wide
Example bottom right with page padding:
\TPGrid[10mm,10mm]{1}{1}
%\TPShowGrid{1}{1}
%\TPoptions{absolute=true, showboxes=true}
\begin{textblock}{0.25}[1,1](1,1)
\rule{5cm}{0.12mm}\\
Signum, Date
\end{textblock}
Example bottom left with page padding:
\TPGrid[10mm,10mm]{1}{1}
%\TPShowGrid{1}{1}
%\TPoptions{absolute=true, showboxes=true}
\begin{textblock}{0.25}[0,1](0,1)
\rule{5cm}{0.12mm}\\
Signum, Date
\end{textblock}
Example page center no page padding:
\TPGrid[0mm,0mm]{1}{1}
%\TPShowGrid{1}{1}
%\TPoptions{absolute=true, showboxes=true}
\begin{textblock}{0.25}[0.5,0.5](0.5,0.5)
\rule{5cm}{0.12mm}\\
Signum, Date
\end{textblock}
Example bottom starting after 1/3 of the page with vertical padding
\TPGrid[0mm,10mm]{3}{3}
%\TPShowGrid{3}{3}
%\TPoptions{absolute=true, showboxes=true}
\begin{textblock}{1}[0,1](1,3)
\rule{5cm}{0.12mm}\\
Signum, Date
\end{textblock}
Theres also textblock* for absolute units you max calculate using the calc package
\begin{textblock*}{widthAsUnit}[originXAsFractionOfBoxWidth,originYAsFractionOfBoxHeight](XAsUnit,YAsUnit)
Textcontent
\end{textblock*}