Skip to main content

Section 11.4 Headers and Footers

The titleps package cooperates with “traditional” divisions, such as \chapter and \section, and the titlesec package, to pick up the titles of divisions automatically and migrate them to headers and footers on a page. The ps is short for “page style”, and the documentation is a PDF file within the distribution for the titlesec package. Primarily, we let manage the selection of its page styles: empty, plain, and headings. (The myheadings page style is ignored.) PreTeXt does some management in the front matter. As a style writer it is not your concern where these styles are employed, but you do influence what information they contain and were it is placed on a page.

Add an <xsl:template> to your stylesheet that begins with

<xsl:template match="article" mode="titleps-plain">

This would then set a style for a plain page within an <article>. Perhaps just a page number centered in the footer? The text produced by this template (see Section 11.7) will then be placed immediately after a titlesec command in the preamble to renew the page style. More precisely, immediately after


Note that this means the first and last characters of the text produced are a group ({,}).

The definition of this template will override (replace) the definition given in any imported stylesheet. You can replace the value of the @match attribute with book to make your style apply to a PreTeXt <book>. If your style will be used for both books and articles, and you want the plain style to be identical for both, you can expand the @match attribute to have the value article|book. To have different plain styles for a book versus an article, make two separate templates.

The titleps package allows at least twelve options per page style: even-numbered page versus odd-numbered page with two-sided printing; left, center, right; header or footer. There are semi-automatic customizable rules, variable widths allowing hanging styles, choices of marks (division at page-start versus division at page-end versus new-division-mid-page, including combinations at the same time), and more. Note that the system of \markleft and \markboth has been abandonded. (Did I hear you say, “Good riddance!”?)

2019-09-30: we have not tested one-sided versus two-sided very rigoursly. Please report problems.