Pagination
Pagination Algorithm
Pagination is performed independently in the vertical and horizontal directions based solely on a pagination data.frame, which includes the following information for each row/column:
number of lines/characters rendering the row will take after word-wrapping (
self_extent)the indices (
reprint_inds) and number of lines (par_extent) of the rows which act as context for the rowthe row's number of siblings and position within its siblings
Given lpp (cpp) already adjusted for rendered elements which
are not rows/columns and a dataframe of pagination information,
pagination is performed via the following algorithm, and with a
start = 1:
Core Pagination Algorithm:
Initial guess for pagination point is
start + lpp(start + cpp)While the guess is not a valid pagination position, and
guess > start, decrement guess and repeat
an error is thrown if all possible pagination positions between
startandstart + lpp(start + cpp) would ever be< startafter decrementing
Retain pagination index
if pagination point was less than
NROW(tt)(ncol(tt)), setstarttopos + 1, and repeat steps (1) - (4).
Validating pagination position:
Given an (already adjusted) lpp or cpp value, a pagination is invalid if:
-
The rows/columns on the page would take more than (adjusted)
lpplines/cppcharacters to render includingword-wrapping
(vertical only) context repetition
(vertical only) footnote messages and or section divider lines take up too many lines after rendering rows
(vertical only) row is a label or content (row-group summary) row
(vertical only) row at the pagination point has siblings, and it has less than
min_siblingspreceding or following siblingspagination would occur within a sub-table listed in
nosplitin