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.
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 Solutionspretextbook.org/doc/guide/html/topic-exercises-solutions.html#topic-solutions-division
from the guide.