Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

How can one determine the position of a symbol on the typeset page? Possible uses:

  • One page contains a fill-in-the-blanks text, and the opposite page contains only the solution words, each starting at the same position on the page where the blank started. The blanks on the first page should all be of equal length in order to not reveal any information. It can be assumed that the solution expressions don't overlap (and if they do, one can still manually adjust).
  • relative anchoring: One has typeset a complex diagram or equation, and one then creates a series of transformations. For example, diagram 2 is like diagram 1, but with the complex middle portion simplified so that one can focus on other parts; the relative positioning of certain outer elements of diagram 1 should be the same in diagram 2 to help the reader understand which diagram elements correspond. For this one would need to be able to obtain the coordinates of certain outer elements so that one can subtract them.

Very much related:

share|improve this question
add comment

1 Answer

up vote 3 down vote accepted

The zref package's savepos module uses \pdfsavepos that can save the (x,y) coordinate of a "label" in scaled points (sp). You can then use this to position things on another page, possibly using tikz.

Here's a small example to showcase the savepos module (take from Where is the left-hand margin? and modified slightly):

enter image description here

\documentclass{article}
\usepackage[user,pagelayout,savepos]{zref}% http://ctan.org/pkg/zref
\begin{document}
\section{pagelayout}

During page shipout, \verb|\oddsidemargin| is
\zref[oddsidemargin]{thepage}sp. (You won't be fooled)

\section{savepos}

\leavevmode\zsavepos{leftanchor}\fbox{FOO}\zsavepos{rightanchor}

FOO begins at (\zposx{leftanchor}sp, \zposy{leftanchor}sp)
and ends at (\zposx{rightanchor}sp, \zposy{rightanchor}sp).
\end{document}

From the zref documentation:

Horizontal positions by \zposx increase from left to right. Vertical positions by zposy from bottom to top.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.