I'm reading Latex 3 docs and get confused. The interaction and differences between entities mentioned in the title are described in too few words with little actual examples.

As far as I get, TeX typesets text as a sequence of boxes. The boxes can be stacked in two ways: vertically and horizontally, and there is a special algorithm that takes a sequence of boxes and arranges them in lines, i.e. a sequence of vertically stacked boxes each containing a sequence of horizontally-stacked boxes. This algorithm, once height of vertical box reaches critical height, passes it to special output routine, that should produce a page, but may be overwritten to do other things.

LaTeX3 provides a lot of nice functions to work with boxes, both vertical and horizontal. But it also introduces concept of galley, that is somehow related to the current vlist. As far I can see, there is no functions to add or take content from a galley explicitly, but only functions that affect parameters of the (current?) galley. So, a galley appears to be a place where typesetting mechanism and boxes interact, but I could use more clear explanation.

Coffins appear to be just a simple mechanism to declaratively position typeset boxes on page and probably are meant to be used in output routines, are they? But I don't get how their dimensions are defined and how those dimensions are related with the box that is being put into a coffin.

Could someone please explain, where all the mentioned entities (boxes, vlists, galleys and coffins) appear in the typesetting pipeline (starting with horizontal boxes that are words), how they are related and how dimensions of each entity is calculated?

1 Answer 1


The first thing to remember is that nothing at the macro layer can change how TeX works fundamentally. That means that expl3 methods can provide useful interfaces for TeX concepts, but under the hood we are still dealing with the same mechanisms.

As you say, TeX builds up the page using boxes, and these are contributed to a vertical list. Such a list when constructing a page or page-like structure is a galley. The code in l3galley and xgalley is experimental and explores how to control additions to the main vertical list (MVL) in particular: unlike other vertical lists, we are very constrained in what we can do to 'back up' on the MVL, so control at point of addition is important. At present, most ideas in l3galley are likely incompatible with much existing LaTeX package code. However, some of them have been incorporated into the kernel: see how paragraph hooks are implemented in particular.

The expl3 modules l3box and l3coffins both deal with box-like structures in general: these are not just about contributing to the MVL. The box module provides lower-level interfaces which are a thin wrapper around TeX box constructs: the expl3 code adds a consistent interface and also some minor tweaks. For example, all expl3 box constructs contain an additional group to make them 'colour safe'.

Coffins are 'boxes with handles'. That means that there is additional (macro layer) data associated with coffins to allow them to be placed easily. This has nothing to do with 'decoration' or interaction per se with the MVL. Instead, it means that you can place coffins relative to each other by describing the handle relationship: 'place the top-right of coffin A 200pt to the left of the baseline-horizontal centre of coffin B'. The standard handles are calculated automatically by examining the size of the typset box that underlies the coffin construct.

None of this affects at all how TeX goes about constructing paragraphs or vertical lists for shipout. Those concepts are described in The TeXbook and other similar references, and should be consulted for more detail: that is a topic which requires chapter-length discussion in a book!

  • 1
    >l3galley and xgalley [.... ] explores how to control additions to the main vertical list | I take it as "galley is a fancy word for the vertical list that is being typeset". Am I right?
    – permeakra
    Commented Sep 4, 2023 at 12:08
  • 3
    @permeakra printwiki.org/Galley
    – Joseph Wright
    Commented Sep 4, 2023 at 12:22

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .