Skip to main content

The PreTeXt Guide

Section 26.1 Publication File

A key concept when using PreTeXt to describe your writing project is that an author should concentrate on content and then later a publisher can concentrate on presentation. (Of course, many PreTeXt authors are also their publisher, making this distinction more difficult than when a professional publisher was a necessity).
We isolate these publisher decisions in a file we call a publication file. Generally, use of this file will change how words look, or are arranged, on the page, but will not change the author’s words themselves. some software might call this a “configuration file”, but we think it is very important to indicate its role in the publication process.
In tnis section, we describe how to create and employ this file. Details on actual options can be found throughout this guide, with terse comprehensive reference material in Chapter 44.
Create a separate XML file the same way you always would. Include the usual XML declaration as the first line. Now, instead of the overall element being <pretext>, use <publication>. That’s it. Various elements within <publication> will be used to specify options, typically attributes. Name the file something that reminds you of its purpose, such as pod.xml for a print-on-demand version. Avoid using spaces in the filename, even if your operating system encourages it.
Entries that control aspects of the output are often attributes of various elements, but may also be the content of elements. When you read the reference material in Chapter 44 be aware that we use a sort of shorthand to describe these entries, modeled on a specification called XPath. For example, if we say to set
/publication/foo/bar/@bazz
to possible values of yes, no, or maybe then the following will be the guts of a legitimate publication file that would somehow adjust your output in some way. In particular, note that the “at sign”, @, indicates an attribute of the preceding element.
<publication>
    <foo>
        <bar bazz="maybe"/>
    </foo>
</publication>
When using the CLI (Section 5.2), the path to a publication file must be specified in the project manifest in the <publication> element for each <target>.