Skip to main content

The PreTeXt Guide

Section 3.1 Structure

A PreTeXt document is a nested sequence of structural divisions. For a book, these would go <part>, <chapter>, <section>, <subsection>, and <subsubsection>. Using <part> is optional, but a book must always use <chapter> (or else it is not a book!). No skipping over divisions. For example, you cannot divide a <section> directly into several <subsubsection>s without an intervening <subsection>.
An <article> starts divisions from <section>, though it may choose to have no divisions at all. <paragraphs> are exceptional. They lack a full set of features, but can be used to divide anything, in books or in articles, though they are always terminal since you cannot divide them further. You will have noticed that we prefer the generic term division (rather than “section”) since a <section> is a very particular division.
A division may be unstructured, in which case you fill it with paragraphs and lists and figures and theorems and so on. But if you choose to structure a division it must look like the following:
  • An optional <introduction>
  • One or more divisions of the next finer granularity
  • An optional <conclusion>.
Either version may have a single <exercises> division at the end, or other “specialized” divisions. The structured version may have more than one <exercises>, and more than one of each of the types of specialized divisions. For example a <references> is a second example of a specialized division. (See Section 4.7.)
The <introduction> and <conclusion> divisions are meant to be short, and may not contain any other numbered tag. No exercises, theorems, listings, etc. If you want to have an introductory division with any of the numbered elements you are free to omit the <introduction> and use the next finer subdivision with a <title> of “Introduction”.
Every division tag can carry an @xml:id attribute, and it is a good practice to (a) provide one, (b) use a very short list of words describing the content, and (c) adopt a consistent pattern of your choosing. Do not use numbers, you may later regret it. These are optional, and with practice you will learn how best to use them. See Section 3.4 just below for more on this.
The <exercises> and <references> tags are special divisions, see Section 4.3 and Subsection 4.7.1.
This explanation is expanded and reiterated at Section 4.6 and is worth reading earlier rather than later.