## Chapter23WeBWorK Exercises

It is possible to embed WeBWorK exercises into a PreTeXt document. In the HTML version, readers can answer these exercises and find out if their answer is correct or incorrect. However, results of WeBWorK exercises cannot be recorded to your gradebook. There's some configuration required use WeBWorK. Please see Chapter 8 and Chapter 40 for more details. As soon as you add WeBWorK exercises, compiling to produce any output format becomes a multistep process.

When a WeBWorK exercise lives on the server, the code takes one form.

The code in Listing 23.0.1 produces the following output:

Optional introduction

$$\displaystyle \int_0^{1} (5 e^x+3 \sin x)\, dx$$ =

$$9.97050222469081$$

Solution.

SOLUTION

\begin{equation*} \begin{array}{rcl} \displaystyle \int_0^{1} (5 e^x+3 \sin x)\, dx \amp =\amp \displaystyle 5 e^x-3 \cos x \Big]_0^{1} \\ \amp =\amp (5 e^{1} - 3 \cos 1) - (5 e^0 - 3 \cos0 ) \\ \amp =\amp 5 e^{1} - 3 \cos 1 - 2 \end{array} \end{equation*}

Optional conclusion

It is also possible to code WeBWorK exercises directly in your PreTeXt source. This shows the most primitive sort of such exercise. The section of the Author's Guide referenced above goes into greater detail (Chapter 8).

The code in Listing 23.0.3 produces the following output: