12

One of the often highlighted features in LuaTeX is the ability to replace the default TeX line-breaking algorithm by something else. I wonder if it is similarly possible to replace the page-breaking algorithm? This would be a great feature, since the page-breaking algorithm in TeX is often described as more "greedy" than the line-breaking algorithm, and as not very good at optimizing globally.

EDIT: If this turns out to be possible, can this be used to solve the following problem, highlighted by Frank Mittelbach? I assume no, since Frank does not state so explicitly.

Issue: TEX generates pages based on precompiled paragraph data

This issue describes the fundamental problem in TeX’s approach: the program builds optimized paragraph shapes without any knowledge about their final placement on a page. The result is a “galley” from which columns are cut to a specified vertical size. A consequence of this is that one can’t have the shape of a paragraph depend on its final position on the page when using TEX’s page builder algorithm.

To some extent, it is possible to program around this limitation, e.g., by measuring the remaining space on a page and explicitly changing paragraph shapes after determining where the current textual material will finally appear. However, besides being complicated to implement, it requires accounting for all kinds of special situations that normally would be automatically managed by TEX, and providing “programmed” solutions for them.

As a result, all attempts so far to provide such functionality had to impose strong limitations on the allowed input material, i.e., they worked only in restricted setups and even then, the results were often not satisfactory.

12

Yes, see the documentation of the buildpage_filter callback, and possibly also the pre_output_filter callback.

Note however that unlike the linebreaking algorithm, there are very few parts of the page breaker that you are forced to use directly, which is why different strategies can be programmed even in classic tex without needing lua extensions, such as two column mode in standard latex, or multicol package.

  • So this issue significant issue in TeX may actually be solved completely? :-D – Gaussler Jun 13 '15 at 14:28
  • @Gaussler I don't understand the comment (or the question). – David Carlisle Jun 13 '15 at 14:28
  • 4
    @Gaussler Not given up, but it's clear that latex as a command will have to stay as LaTeX2e – Joseph Wright Jun 13 '15 at 19:11
  • 2
    @Gaussler If we want to kill the project stone dead, yes. Otherwise we need the LaTeX name. This is an important and tricky area: if you want to discuss it, LaTeX-L is the place. – Joseph Wright Jun 13 '15 at 19:18
  • 2
    @Gaussler: You mean something like "ConTeXt MkIV"? :-) – Martin Schröder Jun 17 '15 at 7:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.