<exercise>can be rather freeform, containing elements such as
<image>, etc. However, an author will typically think about an exercise as having an associated correct answer, perhaps with a hint or a detailed solution. PreTeXt has tags to support that sort of content, but it does require that your
<exercise>be structured. This is nearly identical to the structure of a project-like element.
The code in Listing 16.1.1 produces the following output:
<statement>is mandatory when any of
<solution>is included as a child of
<exercise>, otherwise it may be omitted.
Note that you can have multiple
<solution>elements. But you must put all the
<hint>s first, then all the
<answer>s, and then all the
<solution>s. There are a variety of options for determining where hints, answers, and solutions appear (at all). Check Section 28.1 for information about
<exercise>can also have a more complicated structure that assigns a sequence of steps for a student to complete. PreTeXt provides the same
<task>tag that is used in project-like elements to give structure to such an
The code in Listing 16.1.3 produces the following output:
Checkpoint 16.1.4. A structured exercise.
Here is where we give the student the background information required to start accomplishing tasks.
The first step to do.
The second step to do. We'll be lazy and just include an answer.
Just the answer.
A little wrap up.