# [texhax] current position in output

tom sgouros tomfool at as220.org
Sun Dec 28 04:57:22 CET 2008

Uwe Lück <uwe.lueck at web.de> wrote:

> At 01:36 28.12.08, tom sgouros wrote:
>
> >I don't know if you'll get the precision you seem to be looking for, but
> >you should try playing with \pagetotal, which is a length that marks
> >where you are on the page (measured from the top), and creeps up (down)
> >towards \pagegoal.  When it gets to \pagegoal, the page-completing
> >machinery clanks into action.  Anyway, you might experiment with those
> >and see if that can't get you where you hope to go.  One little
> >weirdness is that I think \pagegoal isn't set until something
> >is applied to the page.
> Indeed, on
>
>     \documentclass{article}
>     \begin{document}
>     A
>
>     \vspace{\textheight}
>     Z\the\pagetotal
>     \end{document}
>
> Z appears with a large pt value, while it is very close to the top of
> the second page.

I wasn't clear.  \pagetotal is the accumulated distance from the top of
the page, and when it *exceeds* \pagegoal, the machinery clanks and a
new page is output.  But sometimes not right away, either.  Your example
can be made even more entertaining:

\documentclass{article}
\begin{document}
\the\pagegoal A

\vspace{\textheight}
Z\the\pagetotal\the\pagegoal

\the\pagetotal\the\pagegoal

\the\pagetotal\the\pagegoal

\the\pagetotal\the\pagegoal

\the\pagetotal\the\pagegoal

\the\pagetotal\the\pagegoal

\end{document}

You'll see that the counters are close to page coordinates, but since
the underlying design required something else, they are something else.

-tom

--
------------------------
tomfool at as220 dot org
http://sgouros.com
http://whatcheer.net