Skip to main content

The PreTeXt Guide

Section 3.9 Exercises

Textbooks in many disciplines have exercises for the reader. In PreTeXt there are five places where you can set a question for the reader to pursue.
Divisional
There is a special <exercises> division and an <exercise> placed there is then known as a divisional exercise. This division supports extra features designed for exercises, such as an <exercisegroup> for short exercises with common instructions. The <exercises> division can be used at any level. In other words, it can be a peer of any other division.
Inline
Immediately within any division, you can interrupt the narrative with an inline exercise. It will be rendered similar to a <theorem> or other block, with a number, and a optional <title>.
Reading Question
Another specialized division, <reading-questions>, can be used to house <exercise> designed to test or guide a reader’s comprehension of the material in that division.
Worksheet
The main component of a <worksheet> is an <exercise> (Section 3.11). Notably the exercises in a worksheet may be arranged with a <sidebyside> element (Section 3.19).
Project
A <project> is similar to an inline exercise, other than the type name and the fact that it can run on a separate counter from theorems, figures, etc. (When running on a separate counter, the same counter is used for <activity>, <exploration>, and <investigation>.)
If an <exercise> is simply a statement of the question, then it may be authored with paragraphs (<p>) and similar elements. If an <exercise> has hints, answers, or solutions, then it must be structured with a <statement>, followed by (possibly several) optional <hint>, <answer> and/or <solution>. Conceptually, an <answer> is a short final result, while a <solution> provides details about the route to the answer. Each of these four components is structured further, with paragraph-like elements, and the exercise itself may have a <title>. A title is strongly encouraged for inline exercises, and nearly-mandatory if you plan to have inline exercises rendered in knowls in a conversion to HTML.
There is a wide variety of interactive exercise types you may specify, such as multiple choice, Parson problems, matching, and more. See Section 4.12 for descriptions of each type and the details of markup for each.
You need (and want) to have the hints, answers and solutions grouped with the statement as you author, but there is a lot of flexibility on making these available at the location of the exercise, or in the back matter. See Section 4.13 for more.
An inline exercise typically gets a fully qualified unique number and is rendered similar to an <example> or a <remark>. A divisional exercise (including reading questions and worksheet exercises) only gets a sequential number, though this can be overridden with the @number attribute if you want to maintain stable numbering in response to edits. (Be careful, once you override the sequential numbering, you probably need to manually specify every subsequent number, so save overrides for when your project matures.)
Within a run of divisional exercises a subgroup can be delimited as an <exercisegroup>, which requires an <introduction> and allows a <conclusion> to explain some commonality. A <title> is optional, and a default will be provided otherwise. An <exercisegroup> should be rendered in some way that makes it clear to the reader that they are a group.