Jump to: Site Navigation

NAME -- located in the pg/macros directory


        Macros contributed by John Jones


        Usage: ANS(auto_right()); 
               ANS(auto_right("this answer can be left blank"));

This answer checker marks any answer correct. It is useful when you want to leave multiple answer blanks, only some of which will be used. If you turn off showing partial correct answers and partial credit, the effect is not visible to the students. The comment in the second case is what will be displayed as the correct answer. This helps avoid confusion.


Can be wrapped around an numerical evaluation. It marks the answer wrong if it contains a decimal point. Usage:


This will accept "sqrt(3)" or "3^(1/2)" as answers, but not 1.7320508


Wrapper for other answer evaluators. It insists that a string is part of the answer to be marked right.


Wrapper for other answer evaluators. It marks the answer wrong if it contains one of the six basic trig functions.

This is useful if you want students to report the value of sin(pi/4), but you don't want to allow "sin(pi/4)" as the answer.

A similar effect can be accomplished with Contexts() by undefining the trig functions. See




Filter for checking that an answer has (or doesn't have) a certain string in it. This can be used to screen answers where you want them in a particular form (e.g., if you allow most functions, but not trig functions in the answer, or if the answer must include some string).

First argument is the string to have, or not have Second argument is optional, and tells us whether yes or no Third argument is the error message to produce (if any).

When using this filter directly, you also need to install catch_errors_filter as a post filter.

A similar effect can be accomplished with Contexts() by undefining the trig functions. See






        # Wrapper for an answer evaluator which can also supply comments


                # Wrapper for multiple answer evaluators, it takes a list of the following as inputs
                # [answer_evaluator, partial credit factor, comment]
                # it applies evaluators from the list until it hits one with positive credit,
                # weights it by the partial credit factor, and throws in its comment


This is a grader which weights the different parts of the problem differently. The weights passed to it through the environment. In the problem:

 $ENV{'partial_weights'} = [.2,.2,.2,.3];

This will soon be superceded by a better grader.

Site Navigation