0

I am writing math summaries/study guides and using a lot of boxes to frame in parts. On occasion I get page breaks with large amounts of white space and then it ends up being irksome to trouble shoot how much of what has to be removed to get things to fit.

Is there a way to, at a point on a page, calculate how much space is left, and what the next chunk is so the amount of overlap can be seen? So if I am using two tcolorboxes for example, and there is a little text and then one of them and the other doesn't fit so I get a mass of whitespace, is there some way I can figure out how much has to be cut out of them?

TobiBS
  • 5,240
  • 1
    Could you give us an example to play with? Also, have you looked into breakable tcolorboxes? – Teepeemm Sep 07 '20 at 21:03
  • Yes, but I don't want to break them for aesthetics. The colorboxes are just an example, most students just love to see notes framed/boxed but it is annoying to format as nothing can be broken. – Cliff Stamp Sep 08 '20 at 00:08
  • 1
    XY problem. The X is \pagegoal. The Y is that you want (many unbreakable large boxes of any size and small gaps) have no solution, and you have to decide among (a) allow box breaks, and/or (b) allow box floats (section 4.13 of the manual) and/or (c) redesign the document, allowing at least some paragraphs between each two boxes with a flexible \parskip. – Fran Sep 08 '20 at 13:16
  • Another approach uses tikzmark and tikpagenodes. – John Kormylo Sep 08 '20 at 14:24

2 Answers2

1

Two thoughts.

  1. Use \raggedbottom which will put all extra white space at the bottom of the page.

  2. Use the needspace package. The \needspace{<length>} macro will check if there is <length> space available on the page. If there is not then the following material is moved to the next page.

Peter Wilson
  • 28,066
0

Yes there is a way to do it :

https://tex.stackexchange.com/a/512094/219584

\the\dimexpr\pagegoal-\pagetotal\relax