Difference between revisions of "Introduction to PGML"

From WeBWorK_wiki
Jump to navigation Jump to search
(Create initial section)
 
(Added second section and some headers)
Line 11: Line 11:
 
== PGML Basics ==
 
== PGML Basics ==
   
  +
To use PGML, you need to include <code>PGML.pl</code> in your problem file via
   
  +
loadMacros("PGML.pl");
  +
  +
Within your problem file, you can format a section of text using PGML by surrounding it with <code>BEGIN_PGML</code> and <code>END_PGML</code>
  +
  +
BEGIN_PGML
  +
... your PGML text goes here ...
  +
END_PGML
  +
  +
Similarly, if you want to use PGML to generate your solution text, use
  +
  +
BEGIN_PGML_SOLUTION
  +
... your PGML solution text goes here ...
  +
END_PGML_SOLUTION
  +
  +
These <code>BEGIN</code> and <code>END</code> commands must be on a line by themselves, though they can be indented.
  +
  +
The formatting for the text that goes between them is described in more detail below, but PGML tries to make the formatting reflect the layout you have used within the <code>BEGIN/END</code>, and it uses the kinds of things you might type in an email message that doesn't use advanced formatting. For example, a blank line indicates a paragraph break, indenting by 4 spaces indicated an indentation, asterisks and underlines indicate bold and italics, numbers at the beginning of a line indicates numbered lists, and so on.
  +
  +
== Basic Formatting ==
  +
  +
== Further Reading ==
   
   

Revision as of 09:31, 7 May 2015

What is PGML?

PGML stands for "PG Markup Language", and it provides a method of creating the text of a PG problem that is easier and more flexible than the traditional BEGIN_TEXT/END_TEXT approach. PGML is based on the Markdown language that now underlies many blog and wiki software, so you may be familiar with some of its syntax already. Note, however, that there are many flavors of Markdown, and PGML may not implement everything exactly the same as the markdown dialect that you use elsewhere. There are also important additions to PGML specifically for working with PG, such as the ability to create answer blanks, or insert values of variables created earlier in the problem.

PGML provides easy means of creating paragraphs, lists, headers, indentation, centering, and other formatting features. It also allows you to link the answer directly to its answer blank for easy problem maintenance. The underlying idea behind PGML is to make what you type as the text of the problem look as close to the result on screen as possible.

PGML is for creating the text of the problem and for associating answers to their answer blanks. The setup and computational portion of the problem is still done in the traditional way. PGML integrates with MathObjects to make it easy to work with answers and answer checkers, and to present mathematics within the text of your problem.

PGML can also be used to create the solutions to your problem, with many of the same advantages that you have for the text of the problem itself.

PGML Basics

To use PGML, you need to include PGML.pl in your problem file via

  loadMacros("PGML.pl");

Within your problem file, you can format a section of text using PGML by surrounding it with BEGIN_PGML and END_PGML

  BEGIN_PGML
  ... your PGML text goes here ...
  END_PGML

Similarly, if you want to use PGML to generate your solution text, use

 BEGIN_PGML_SOLUTION
 ... your PGML solution text goes here ...
 END_PGML_SOLUTION

These BEGIN and END commands must be on a line by themselves, though they can be indented.

The formatting for the text that goes between them is described in more detail below, but PGML tries to make the formatting reflect the layout you have used within the BEGIN/END, and it uses the kinds of things you might type in an email message that doesn't use advanced formatting. For example, a blank line indicates a paragraph break, indenting by 4 spaces indicated an indentation, asterisks and underlines indicate bold and italics, numbers at the beginning of a line indicates numbered lists, and so on.

Basic Formatting

Further Reading