## Section6.10Exercises and their Solutions

As described in Section 3.8 an <exercise> can be placed in many different locations, and a <project> has similar features. It is critical to understand that you want to author any hints, answers, or solutions immediately following the statement of an exercise. If your PreTeXt source is public, and you would like to keep some aspects of the solutions private, then read the Publisher's Guide for some practical advice. See the Publisher's Guide as well for information on creating a standalone Solutions Guide. We concentrate here on techniques for controlling visibility and location of the components of exercises within your primary output.

### Subsection6.10.1Exercises, Original Versions

A <hint> to an <exercise> renders nicely in a knowl, right below the exercise statement, as part of a conversion to HTML. For a conversion to /PDF/print, you might wish to display a hint, visibly, as part of the exercise, or you may wish to park the hint in a Hints to Exercises division in the back matter. To control visibility of the components of exercises (and projects) there are fifteen switches you can use as string parameters on the command line, or in an extra XSL file. Each takes values of yes or no.

### Subsection6.10.2Exercises, Solutions Versions

Exercises, and their components may be duplicated easily, to provide a back matter appendix with solutions, or within each division. For example, you can easily create an end-of-chapter division with solutions to every inline exercise throughout the chapter and solutions to all the divisional exercises from each section of the chapter.

The <solutions> element will create an entire division, semi-automatically. You can provide a <title>, an <introduction>, and <conclusion>. The remaining content is statements, hints, answers, and solutions to exercises (and projects).

If <solutions> is a child of <backmatter>, then an appendix will be generated, and covering <exercise> from the entire <book> or <article>. If <solutions> is a child of a division, then a new subdivision is created and the scope is all <exercise> for the division. So, for example, a <solutions> placed inside a <chapter> will render as a division that looks like a <section> and will include components of all the exercises (at any level) contained within the <chapter>.

An author filters the types of exercises, and their components, through attributes of the <soutions> element. For example

reading="hint answer"


would cause every <exercise> within each <reading-questions> to have its <hint> and <answer> displayed, but not its <statement> nor its <solution>. These are the attribute names and the possible values.

So, PreTeXt source like

<section>
...
<solutions worksheet="hint solution" project="hint solution">
<title>Hints and Solutions to Worksheets and Projects<title>
</solutions>
</section>


would generate an entire subsection with hints and solutions to every worksheet and every project, located anywhere (including in subsections and subsubsections) in the section on Birds of Paradise.