Subsection 38.4.1 Extraction and Processing
Before anything else can be done, a PreTeXt project with WeBWorK problems must first have its WeBWorK content extracted and processed into multiple representations, which are then collected into an auxiliary XML file. Using the CLI, this is done with pretext generate webwork
(if you want to reference a particular target, add -t [targetname]
).
If instead you want to use the pretext/pretext
script, you might need to install the Python requests
module. It is not uncommon for your computer to not have requests
installed (although it comes with the CLI), so you should check if it is there and install it if need be. You can check if it is installed from the command line with:
python -c "import requests"
And if it isn’t, you can install it with pip
, specifically with:
sudo pip install requests
(If you don’t have pip
installed, you could use:
sudo easy_install pip
to install it.)
Processing WeBWorK problems is best accomplished if you are using directory management. With a publication file, declare the external and generated directories as describe in
Section 5.6. Then use the
pretext
script to extract PreTeXt content from the WeBWorK server. It will be placed in a
webwork
subfolder of your generated folder. For example:
$ pretext -c webwork -p <publisher> aota.ptx
aota.ptx
in the example is the root file for your PreTeXt project.
-c webwork
means you are processing the WeBWorK components.
-p
specifies the publication file, as described in
Chapter 44. In the publication file, the element
<webwork>
may have attributes
@server
,
@course
,
@coursepassword
,
@user
, and
@userpassword
. If absent, these default to
https://webwork-ptx.aimath.org
,
anonymous
,
anonymous
,
anonymous
, and
anonymous
respectively. If you specify a server, you must correctly specify the protocol (
http
versus
https
). And it must be version 2.14 or later. Do not include a trailing slash.