(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Contents

If you are going to use PGML in your problem, you must include "PGML.pl" in the loadMacros() call at the beginning of your problem.

If you don't, you'll get a message about PGML::Format2 not being defined.

Producing Text using PGML

The text that you want processed by PGML should be enclosed in BEGIN_PGML and END_PGML, each on a separate line. That is,

BEGIN_PGML
... your PGML code here ...
END_PGML

You can have as many such PGML sections as you like within one problem.

Producing Solutions using PGML

The text of the solution should be enclosed in BEGIN_PGML_SOLUTION and END_PGML_SOLUTION, each on a separate line. That is,

BEGIN_PGML_SOLUTION
... your PGML code here ...
END_PGML_SOLUTION

PGML's math formatting and command substitution commands are particularly useful here, as you can include intermediate computations directly within the PGML itself:

BEGIN_PGML_SOLUTION
If [:x = [\$a]:], then [:x+1 = ([\$a]+1) = [@ \$a+1 @]:]
END_PGML_SOLUTION

There is no need to use a separate variable for the value of \$a+1, as the result of this computation will be inserted into the solution at that point.

Producing Hints using PGML

The text for the hint should be enclosed in BEGIN_PGML_HINT and END_PGML_HINT, each on a separate line. That is,

BEGIN_PGML_HINT
... your PGML code here ...
END_PGML_HINT

As with solutions, you can perform computations and mathematical typesetting within the PGML hint:

BEGIN_PGML_HINT
What happens when [:x = [@ \$a - \$b @]:]?
END_PGML_HINT

There is no need for a separate variable for the value of \$a-\$b.