Editing Introduction to PGML

Jump to navigation Jump to search

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.

Latest revision Your text
Line 90: Line 90:
 
To right-justify some text, use just <code>&gt;&gt;</code> at the left
 
To right-justify some text, use just <code>&gt;&gt;</code> at the left
   
>> Right-justified text
+
>> Right-justified text
 
 
 
>> Right-jutified paragraph
 
>> Right-jutified paragraph
Line 169: Line 169:
 
=== Mathematical Notation ===
 
=== Mathematical Notation ===
   
PGML allows you to specify mathematics in two different formats: TeX and calculator notation. The TeX notation allows you to use the standard TeX and LaTeX commands to format your mathematics. The calculator notation uses MathObjects to parse and format the mathematics (so this is the notation that you use to create formulas in your PG problems, and that students use to enter their answers). Both formats come in three forms: inline, display-style inline, and display style. The inline form uses spacing rules that try to minimize the impact on line spacing, while display-style inline allows for easier readability at the cost of using more vertical space. Full display style places the math on its own line with buffering space above and below.
+
PGML allows you to specify mathematics in two different formats: TeX and calculator notation. The TeX notation allows you to use the standard TeX and LaTeX commands to format your mathematics. The calculator notation uses MathObjects to parse and format the mathematics (so this is the notation that you use to create formulas in your PG problems, and that students use to enter their answers). Both formats come in two forms: in-line and display style. The in-line form uses spacing rules that try to minimize the impact on line spacing, while display style allows for easier readability at the cost of using more vertical space.
   
To use TeX-formatted mathematics, enclose it in <code>[`...`]</code> for inline math, <code>[``...``]</code> for display-style inline math, and <code>[```...```]</code> for display style math.
+
To use TeX-formatted mathematics, enclose it in <code>[`...`]</code> for in-line math and <code>[``...``]</code> for display-style math.
   
To use calculator notation, enclose it in <code>[: ... :]</code> for inline math, <code>[:: ... ::]</code> for display-style inline math, and <code>[::: ... :::]</code> for display style math.
+
To use calculator notation, enclose it in <code>[: ... :]</code> for in-line math and <code>[:: ... ::]</code> for display-style math.
   
 
For example,
 
For example,
Line 181: Line 181:
 
What [:x:] makes [:(x+2)/3 = 1:]?
 
What [:x:] makes [:(x+2)/3 = 1:]?
   
Both produce the same results with inline math.
+
both produce the same results (with in-line math).
   
And for example,
 
  +
Note that, unlike with TeX, display-mode math is not automatically centered on a separate line. If you want that, you must provide the formatting for that yourself:
   
What [`x`] makes [``\frac{x+2}{3} = 1``]?
 
  +
[``\sum_{n=0}^{10} 2^n``] is flush left
 
 
What [:x:] makes [::(x+2)/3 = 1::]?
 
  +
[``\sum_{n=0}^{10} 2^n``] is indented
 
Both produce the same results with inline math, but the second math is display-style inline, so the fraction numerator and denominator typically will appear larger. This can comes at the cost of awkward spacing between consecutive lines of text.
 
 
And for example,
 
 
Find [`x`] that solves the equation: [```\frac{x+2}{3} = 1```]
 
 
 
Find [:x:] that solves the equation: [:::(x+2)/3 = 1:::]
 
  +
>> [``\sum_{n=0}^{10} 2^n ``] is centered <<
 
Both produce the same results with inline math for the "x", and then displayed math on its own line for the equation.
 
   
 
== Interaction with PG ==
 
== Interaction with PG ==
Line 210: Line 202:
 
Suppose that a train leaves Chicago traveling [$a] miles per hour due south.
 
Suppose that a train leaves Chicago traveling [$a] miles per hour due south.
 
END_PGML
 
END_PGML
 
You can access array or hash entries similarly, e.g., <code>[$b[0]]</code> or <code>[$c{neg}]</code> or <code>[$d->{period}]</code>.
 
   
 
Note that a variable that holds a [[:Category:MathObjects|MathObject]] can produce either a TeX string or a calculator-notation string; which one it produces depends on the context in which it is used. If it is inserted inside of TeX math delimiters (e.g., inside <code>[`...`]</code>), it will produce its TeX form, while if it is inserted inside calculator delimiters (e.g., <code>[: ... :]</code>), or not inside any delimiters, then it produces calculator-style notation. So if <code>$f = Formula("(x+1)/(x-1)")</code>, then
 
Note that a variable that holds a [[:Category:MathObjects|MathObject]] can produce either a TeX string or a calculator-notation string; which one it produces depends on the context in which it is used. If it is inserted inside of TeX math delimiters (e.g., inside <code>[`...`]</code>), it will produce its TeX form, while if it is inserted inside calculator delimiters (e.g., <code>[: ... :]</code>), or not inside any delimiters, then it produces calculator-style notation. So if <code>$f = Formula("(x+1)/(x-1)")</code>, then

Please note that all contributions to WeBWorK_wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see The WeBWorK Project wiki:Copyrights for details). Do not submit copyrighted work without permission!

Cancel Editing help (opens in new window)