Section6WeBWorK 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 the relevant chapter of the author guide for more details. At a minimum, you'll need to add --stringparam webwork.server [URL]
to your xsltproc
command line. For limited testing purposes during workshops, there is a WeBWorK server available if you do not have one configured. Please ask a facilitator for the URL.
As the PDF/print version of this document demonstrates, static versions of WeBWorK exercises can be included in LaTeX output. This is a multi-step process that is best left for after you develop some experience working with PreTeXt, so we will not discuss the process here. Please do not hesitate to ask for help on the email list when you're ready to try out this feature, however.
When a WeBWorK exercise lives on the server, the code takes one form.
<exercise> <introduction> <p>Optional</p> </introduction> <webwork source="Library/ma122DB/set12/s5_4_26.pg" /> <conclusion> <p>Optional</p> </conclusion> </exercise>
The code in Listing 6.1 produces the following output:
Optional
Optional
It is also possible to code WeBWorK exercises directly in your PreTeXt source. This shows the most primitive sort of such exercise. The author guide goes into greater detail.
<exercise> <webwork> <statement> <p><m>1+2=</m><var name="3" width="5" /></p> </statement> </webwork> </exercise>
The code in Listing 6.3 produces the following output: