Skip to content

Implementation Notes

Simon Cozens edited this page Feb 21, 2015 · 2 revisions

Page breaking and the insertion problem

One of the main differences between SILE and TeX, internally, is that TeX takes a stateful approach to its typesetting algorithms whereas SILE prefers to be as stateless as possible. The reason for this is the principle of separation of concerns. A stateless algorithm can be replaced without requiring any change or interaction with the rest of the system.

So, for instance, in TeX, each vbox added to the vertical list will fire the page breaking routine, which keeps a running total of the material on the page. By contrast, SILE passes a bunch of nodes to the line breaking algorithm, which returns some vboxes; it then adds those vboxes to the vertical list, (SILE.typesetter.state.outputQueue) and finally asks the page builder if there is a plausible break point yet. Each time the page builder is fired, SILE computes the current page total from scratch, whereas TeX keeps an updated \pagetotal quantity every time a new vbox hits the vertical list. SILE's method is less efficient, but more extensible, treating each algorithm as a black box.

Where this becomes problematic is when determining whether or not insertions will fit on the page.

Clone this wiki locally