Section 26.1 Publication File
As of 2021-01-23 we are well along on a transition to providing options a publisher would choose via an XML publication file. Here 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 42. Note too, that Section 26.5 describes the old method (which is still in use, but will eventually be obsolete).
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
<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 42 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
to possible values of
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>
The path to a publication file can be specified using the
-p option for
pretext build. For example, if your publication file is
publication.ptx in the folder
publication (parallel to
source), you would enter the following.
pretext build html -p publication/publication.ptx
Alternatively, you can specify the path to the publication file in the
project.ptx manifest in the
<publication> element for each
<target>, allowing you to have a different publication file for different targets.