Skip to main content

Section 27.2 Levels Explained

Every PreTeXt document has a hierarchy, even if it might not be very deep. As an extreme example, for a sub-sub-section of a book, the <subsubsection> is contained in a <subsection>, that <subsection> is contained in a <section>, that <section> is contained in a <chapter>, and that <chapter> is contained in the <book>. Each division of a document has a level, and the overall root element is always at level 0 (the <book> in the example). Each other division is at some depth, computed by counting from the root. So the <subsubsection> in the example is at level 4.

Many aspects of the different outputs produced can be customized, typically via the publisher file (Section 27.1), based on how much of the hierarchy is used or made visible. A good example is the Table of Contents. If the level of the Table of Contents of a book is set to 2, then the Table of Contents will be “two-deep” or have “two levels” of entries. More precisely, there will be titles (and maybe page numbers) for every <chapter> and every <section>.

When hierarchical numbering is customized by specifying a level, the number of an object will have as many separators (periods, typically) as the level given. Here's why. Suppose equations are set to be numbered at level 2. Then two levels of the hierarchy will be used to create the initial part of the number. So in an <article>, Equation 5.2.34 will be in Subsection 2, of Chapter 5, and then will be the 34th equation of that sub-section. Two levels: one separator to describe the division, one less that the number of levels (this is the structure number) and a second separator to set off the count within the division (the serial number). So, \((2 - 1) + 1 = 2\) separators. See more on numbering at Section 27.3.

Notice that you make no assumptions or decisions in your source about the depth of the Table of Contents, nor the numbering of equations. At any time, right up to the completion of your project (or later!), you can change this aspect of your output with nearly trivial edits in the publisher file. Nice.