I wanted to automatically pass to a newpage when i'm near the end of one on special occasions and so i was wondering if they were anything that would tell where it should be based on what is above. Exactly i would like something giving either the distance to the upper border of the page or the purcentage of advencement in the page.

PS: If you have a way to pass to a new page when near the end of one page, i will gladly accept it even if it doesn't match the rest of my question

Thanks for your answers

  • \the\pagegoal gives the expected total height of page box, and \the\pagetotal gives the accumulated total height of vertical boxes. Related question: tex.stackexchange.com/q/4017/79060 Commented Mar 11, 2020 at 4:50
  • if I understand well how \pagegoal keep the height where Latex try to break the page and \pagetotal the current height is that it ?
    – ajreckof
    Commented Mar 11, 2020 at 5:05
  • @ajreckof: You can use needspace which inserts a page break if the amount of space is less than a certain amount. That is, you "need a specific amount of space on the page", or else insert a page break. See pagebreak if only 1/4th of the page left? or How to compute the remaining space on the current page.
    – Werner
    Commented Mar 11, 2020 at 5:14
  • Thanks that will do the trick
    – ajreckof
    Commented Mar 11, 2020 at 5:37
  • 1
    Just for the sake of completeness, \pagrebreak[3] can make a page break conditional to page break depending of page penalties. In practice, you will see that is rarely used and less of [3] will be ignored in most scenarios and [4] is mandatory, so ....
    – Fran
    Commented Mar 11, 2020 at 11:01


Browse other questions tagged .