Customize Course

From WeBWorK_wiki
Jump to navigation Jump to search
  • Items that are placed in the file [TMP]/macros/PGcourse.pl will affect the appearance of all of the problems in your course homework sets. Here are some examples:

Obtain new version of the question

  • This snippet allows student to obtain a new version of a problem (if they have completed the problem correctly OR after the assignment's dueDate).
 $guest   = ($effectivePermissionLevel == -5) ;	####	practice user
 
 ####	Presume that faculty observers are given TA status (permission 5).
 $observe = ($effectivePermissionLevel >=  5) ;	####	TA or Professor (permission 10)
 
 loadMacros( "problemRandomize.pl" ) ;
 
 ####	Allow a Guest or Observer to always get a new version of problem.
 ProblemRandomize( when => "Always", onlyAfterDue => 0, style => "Button" )
 	if	($guest or $observe) ;
 
 ####	Allow everybody else (e.g., a student) to get a new version (for more practice)
 ####	after correct answer(s) to first (scored) version OR after the assignment's due date
 $when = (time >= $main::dueDate ? "Always" : "Correct");
 ProblemRandomize( when => $when, onlyAfterDue => 0, style => "Button" )
 	if	not ($guest or $observe) ;
 
 ####	Note: those two uses of ProblemRandomize reflect choices which can be made independently,
 ####	e,g,, you could invoke one and zap/comment-out the other.
 
 ####	Always allow observer or teacher to View Source Code for problem.
 ####			loadMacros( "source.pl" )	if	$observe ;
 ####	commented-out because extra setup needed by an admin with shell access
 ####	Note: PREP-2011 participants have professor status & can always invoke Edit Source.


Customizing TeX display

  • This next snippet allows you to write a problem in such a way that the notation can be changed depending on the taste of the instructor, the text book being used and so forth. For example vectors might be displayed using boldface type, or with an over arrow depending on the notation used by the text.
 # Add this snippet to your PGcourse.pl to define the display for vector notation for all homework sets in your course.
   addToTeXPreamble( "\\newcommand{\\myVec }   [1]{  \\overrightarrow{#1}   } "  );
  1. or

addToTeXPreamble( "\\newcommand{\\myVec } [1]{ \\mathbf{#1} } " );