Skip to main content
Logo image

Chapter 6 Publishing

View Source
By publishing, we mean here the process of finalizing the presentation and look of the output you get from PreTeXt. We stress again the philosophical distinction between author and publisher in PreTeXt, since there is great value in focusing on just one of these two types of tasks at a time.
Another aspect of the publishing process is that of creating the physical book and making it available in bookstores, or making the the web version available on your own website. The latter can be done automatically through GitHub pages using the pretext deploy function, but perhaps you also want to have a separate landing page that links to a version of the book you are celling on Amazon.com. However, these steps are beyond the scope of this guide (as for suggestions on the PreTeXt-support group if you would like some assistance getting started with these steps).
For this chapter we will assume you are trying to produce a single version of your book and want to control the presentation and look of that version. You can still produce this version in multiple formats (web, pdf, epub), and which you want to produce might change what you do slightly.

Section 6.1 The publication file

PreTeXt controls publisher options in a publication file. The default location of this file is in the folder publication and is itself called publication.ptx. Open this file and take a look.
What you will see is more XML, but a different set of tags than what you would write in your PreTeXt source. The version of the publication file that came with your codespace was (at the one time) the almost complete list of options with default values provided. This should make it easy to modify values and experiment with different settings.
As new settings are introduced, you can find documentation ins the Publication File Reference
 1 
pretextbook.org/doc/guide/html/publication-file-reference.html
part of the guide.

Remark 6.1.1.

Eventually you may want to have different versions of your document, and you can do this with different publication files. In Chapter 5 we will consider how to manage multiple publication files easily.
Next we will dive deeper into the different sorts of things that can be configured with this file.

Section 6.2 Showing and Hiding things

We have seen that some blocks, like proofs, solutions, examples, are sometimes hidden behind a knowl: when you click on the title, the content expands to reveal itself. Most of the blocks can be “knowled” or not.
To edit these settings, look for the element <html>, and inside that <knowl/>. This element has a number of attributes (the PreTeXt guide marks attributes with the @ symbol, by the way). You can specify whether elements should be knowled or not by changing the value of the attributes between yes and no.
Whether exercises are knowled depends on the type of exercises. PreTeXt distinguishes five types of exercise-like elements, since they have hints/answers/solutions that you might want to hide:
  • inline, which show up as “checkpoints”; these are exercises mixed with other content in a divisions.
  • divisional; these are exercises that belong to an <exercises> division.
  • project; these are the entire project-like element like <activity>, <investigation> etc.
  • worksheet; essentially a project but its a division itself, and can contain spacing for students to work in when printed.
  • readingquestions; these are questions in a <reading-questions> division. These were exercises designed to get a text box that students can type short answers to questions at the end of a section.
You can control whether the entire exercise-like element is knowled, but their hints/answers/solutions are always knowled (no spoilers!). The only solution you can can choose to not knowl is that of an example, and that is controlled by these knowl switches.
You can, however, control which parts of exercises show up at all. This is set in a different section of the publication file: publication/common/exercise-inline (that is, in the <common> block in the <exercise-inline> element). You can replace exercise-inline by any of the five exercise types. Then as attributes, specify yes or no for the @statement, @hint, @answer, @solution.
This controls what shows up in the output, in all formats, at the position that the exercise was authored. There are also ways to redisplay any parts of these exercises later, to give a list of all solutions in the back of the book, say. See Exercises and Solutions
 1 
pretextbook.org/doc/guide/html/topic-exercises-solutions.html#topic-solutions-division
from the guide.

Section 6.3 Numbering

There are a few settings that control how things are numbered. Most of these live inside the <numbering> element of the publication file.
  • The <division/> element and its attributes says how “deep” the numbering goes (i.e., do you put numbers on subsubsection?). This is set as a natural number as the value of the @level attribute.
  • Also in this element you can specify whether parts are structural or decorative. This essentially says whether chapter number should restart in each part.
  • You can also set the number of the first chapter here using the @chapter-start attribute.
  • There are four different types of elements that can be numbered independently: blocks, projects, equations, and footnotes. You can control how specific the numbering are for each of these by giving the corresponding element a @level attribute.

Section 6.4 Formatting

While there are some ways to control the look of the pdf, that is beyond the scope of this guide. Web output can be controlled more easily, selecting from a small number of predefined styles.
This is a feature that is currently under active development, so we will not say much here, but instead refer you again to the Publication File Reference
 1 
pretextbook.org/doc/guide/html/publication-file-reference.html
part of the guide.