Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 83af950d8f
Fetching contributors…

Cannot retrieve contributors at this time

32 lines (26 sloc) 0.835 kb
\section{Page Breaking}
module PageBreak
( breakpages
) where
import Measures
import Boxes
This module breaks pages. A page is simply a \code{VBox} that is as large as a page.
The algorithm is simply \emph{best fit}:
breakpages :: Dimen -> [VBox] -> [VBox]
breakpages _ [] = []
breakpages textheight (vb:vbs) = (first:breakpages textheight rest)
first = mergeBoxes V (vb:first')
(first',rest) = breakpages' (textheight `dsub` (theight vb)) vbs
theight b = (height b) `dplus` (depth b)
breakpages' _ [] = ([], [])
breakpages' s (v:vs)
| hfirst `dgt` s = ([], (v:vs))
| otherwise = ((v:h),t)
hfirst = theight v
(h,t) = breakpages' (s `dsub` hfirst) vs
Jump to Line
Something went wrong with that request. Please try again.