[texhax] Avoid paragraph indentation on new page?

John Culleton john at wexfordpress.com
Sun Dec 2 05:22:20 CET 2007

On Sunday 25 November 2007 07:14:20 am Edsko de Vries wrote:
> 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 :)

John Culleton
Resources for every author and publisher:

More information about the texhax mailing list