Skip to main content

Section 10.1 Configuring a WeBWorK Course for PreTeXt

We assume a mild familiarity with administrating a WeBWorK server. The version of WeBWorK needs to be 2.14 or later for use with PreTeXt. Using the admin course, create a course named anonymous. In the course's Course Configuration menu, set all permissions to admin (or perhaps set some to the even more restrictive nobody). Except set “Allowed to login to the course” to login_proctor.

In the Classlist Editor, add a user named anonymous, and set that user's permission level to login_proctor, the permission level one higher than student. Set that user's password to anonymous. Note that because this is public information, anyone will be able to log into this course as user anonymous. This is why setting the permissions earlier is very important. (Especially preventing this user from changing its own password.)

Add the following lines to the course.conf file (which lives in the parent folder of the templates/ folder.)

# Hide message about previewing hints and solutions for instructors
$pg{specialPGEnvironmentVars}{ALWAYS_SHOW_HINT_PERMISSION_LEVEL} = 100;
$pg{specialPGEnvironmentVars}{ALWAYS_SHOW_SOLUTION_PERMISSION_LEVEL} = 100;

In the templates/macros/ folder, edit (or create it if need be) and add the lines:

#### Replace essay boxes with a message
sub essay_box {
    my $out = MODES(
        TeX => '',
        Latex2HTML => '',
        HTML => qq!<P>If you were logged into a WeBWorK course
        and this problem were assigned to you,
        you would be able to submit an essay answer
        that would be graded later by a human being.</P>!,
        PTX => '',

#### Suppress essay help link
sub essay_help {};

#### How many attempts until hint is available
$showHint = -1;
# May be a bug that WeBWorK requires -1 instead of 0
# for immediate access to hints


Now PreTeXt will be able to communicate with this course to retrieve what is needed.