[texhax] Avoid paragraph indentation on new page?

Edsko de Vries edsko at edsko.net
Sun Nov 25 13:14:20 CET 2007


Hey,

I have been experimenting a bit with Morten's macro. It works as long as
the first line on a page is actually at the top of the page; but if that
isn't the case (for example, if there is a figure) it breaks. I have
been trying various variations on his theme; in case anyone is
interested (now why do I get the feeling that there won't be? :-)), the
following seems to work even when there are figures: 

\newlength{\LastPageGoal}

\makeatletter
\AtBeginDocument{\addto at hook\everypar{%
  \ifthenelse{\lengthtest{\pagetotal>\LastPageGoal}}%
    {\setbox0=\lastbox}%
    {}%
  \setlength{\LastPageGoal}{\pagegoal}%
  \addtolength{\LastPageGoal}{-1.01em}%
}}
\makeatother

The macro basically checks if the paragraph starts after the maximum
height of the page (minus 1.01em), which will mean that it will be moved
to the next page (and will thus be the first paragraph on that page).
This works quite well, even in the presence of figures (which reduce
\pagegoal).

I think this will only break in case of a widow, but I cannot think of
a way to fix that. If anyone has any ideas, I'd love to hear them :)

Edsko


More information about the texhax mailing list