Section5Exercises
¶Exercises are pretty fully-featured in PreTeXt, and they are also an ongoing point of development as of the writing of this document. You can put an exercise in the middle of a division, intermixed between theorems and paragraphs and figures. You can also put a bunch of exercises inside an exercises tag within a division, which is the typical way for creating a bunch of exercises togther at the end of a section.
<exercise>
<statement>
<p>
The <c>statement</c> is mandatory.
</p>
</statement>
<hint>
<p>Optional. Just an suggestion of what to try.</p>
</hint>
<answer>
<p>Optional. Just the <q>final answer</q>.</p>
</answer>
<solution>
<p>Optional. All the gory details.</p>
</solution>
</exercise>
The code in Listing 5.1 produces the following output:
The statement is mandatory.
Note that you can have multiple hint, answer, and solution elements. But you must put all the hints first, then all the answers, and then all the solutions. There are a variety of options for determining where hints, answers, and solutions appear (at all). Check the PreTeXt documentation for information about stringparams.
Subsection5.1exercisegroup
¶Sometimes you have several exercises that should all have a common set of instructions, which is when you will use the exercisegroup tag. An exercisegroup can only be placed inside an exercises element, however! The rest of this section is produced using the code in Listing 5.3.
<exercises>
<exercisegroup>
<introduction>
<p>Here's where you put the common instructions.
</p>
</introduction>
<exercise>
<statement>
<p>
First exercise. The <c>statement</c> is mandatory.
You can add all the usual bells and whistles after, but we'll
keep it short here.
</p>
</statement>
</exercise>
<exercise>
<statement>
<p>
Second exercise.
</p>
</statement>
</exercise>
<exercise>
<statement>
<p>
Third exercise.
</p>
</statement>
</exercise>
</exercisegroup>
<exercise>
<statement>
<p>
This <c>exercise</c> is not inside the <c>exercisegroup</c>.
</p>
</statement>
</exercise>
</exercises>
exercisegroup.Subsection5.2Exercises
Here's where you put the common instructions.
1
First exercise. The statement is mandatory. You can add all the usual bells and whistles after, but we'll keep it short here.
2
Second exercise.
3
Third exercise.
4
This exercise is not inside the exercisegroup.