2

I would like to choose exactly where my minipage starts using coordinates on the page. So far I have the following,

\documentclass{article}
\begin{document}

\begin{minipage}[x=10cm,y=5cm]{8em} The quick brown fox jumps right over the lazy dog. the quick brown fox jumps right over the lazy dog. the quick brown fox jumps right over the lazy dog. the quick brown fox jumps right over the lazy dog. the quick brown fox jumps right over the lazy dog. the quick brown fox jumps right over the lazy dog. the quick brown fox jumps right over the lazy dog. the quick brown fox jumps right over the lazy dog. \end{minipage}

\end{document}

However, these coordinates have no affect on the positioning of the mini page. Is there a way to do this?

curry
  • 283

3 Answers3

2

Package textpos provides, e.g., the environment textblock* for absolute positioning.

\documentclass{article}

\usepackage[absolute]{textpos}

\begin{document}

\begin{textblock}{8em}(10cm,5cm) The quick brown fox jumps right over the lazy dog. the quick brown fox jumps right over the lazy dog. the quick brown fox jumps right over the lazy dog. the quick brown fox jumps right over the lazy dog. the quick brown fox jumps right over the lazy dog. the quick brown fox jumps right over the lazy dog. the quick brown fox jumps right over the lazy dog. the quick brown fox jumps right over the lazy dog. \end{textblock}

\end{document}

enter image description here

Note: Without option absolute the position would be relative to the text area instead of relative to the page.

Using package eso-pic would also be possible:

\documentclass{article}

\usepackage{eso-pic}

\begin{document}

\AddToShipoutPicture*{% \AtPageUpperLeft{% \put(10cm,-5cm){% \begin{minipage}[t]{8em} The quick brown fox jumps right over the lazy dog. the quick brown fox jumps right over the lazy dog. the quick brown fox jumps right over the lazy dog. the quick brown fox jumps right over the lazy dog. the quick brown fox jumps right over the lazy dog. the quick brown fox jumps right over the lazy dog. the quick brown fox jumps right over the lazy dog. the quick brown fox jumps right over the lazy dog. \end{minipage} }% }% }

\mbox{}% the hook code is only printed, if the page is not empty

\end{document}

Please, see the manuals of the packages for more information.

cabohah
  • 11,455
2

I assume you consider an absolute placement of a minipage independent of the regular content.

You can use shipout/background hook and \put(X,Y){<content>} to get access to absolute coordinates and place an object right at your location. Mind, coordinates start at the left hand-side upper corner.

For instance, the code below renders a minipage at the centre on the second page. I added colours for better distinction between text and a background content:

\documentclass{article}
\usepackage{xcolor}
\usepackage[nopar]{kantlipsum}

\begin{document} \kant[1-3]

\clearpage \AddToHookNext{shipout/background}{\put(0.5\dimexpr\pagewidth-8em,-0.5\pageheight){% \fcolorbox{red}{yellow!50}{\color{blue}% \begin{minipage}{8em} The quick brown fox jumps right over the lazy dog. the quick brown fox jumps right over the lazy dog. the quick brown fox jumps right over the lazy dog. the quick brown fox jumps right over the lazy dog. the quick brown fox jumps right over the lazy dog. the quick brown fox jumps right over the lazy dog. the quick brown fox jumps right over the lazy dog. the quick brown fox jumps right over the lazy dog. \end{minipage}}}} \kant[4][1-6] \end{document}

enter image description here

Celdor
  • 9,058
1

Instead of a minipage you could insert your text via a tikz node. The coordinates in the following example are relative to the top left page corner:

\documentclass{article}

\usepackage{tikz}

\begin{document}

\begin{tikzpicture}[remember picture,overlay] \node[text width=8em] at (3cm,-5cm) {The quick brown fox jumps right over the lazy dog. the quick brown fox jumps right over the lazy dog. the quick brown fox jumps right over the lazy dog. the quick brown fox jumps right over the lazy dog. the quick brown fox jumps right over the lazy dog. the quick brown fox jumps right over the lazy dog. the quick brown fox jumps right over the lazy dog. the quick brown fox jumps right over the lazy dog.}; \end{tikzpicture}

\end{document}