Skip to main content
Logo image

Section 2.1 PGML Formatting and Verbatim Calisthenics

This section is designed to test various PGML formatting rules and verbatim content returned in answer hashes. Consult the source to see how the special characters and formatting are realized.

Checkpoint 2.1.1. PGML Formatting.

Smart double quotes: “Life is about making an impact, not making an income.”
Smart single quotes: ‘Whatever the mind of man can conceive and believe, it can achieve.’
Regular apostrophes: My siblings’ mother’s daughter isn’t my daughter’s siblings’ mother.
Emphasis: very important
Alert: do not do it
Braces: {text that looks like a set}
    Some pre-formatted text
                with an indented line
and an out-dented line
This should not be altered *a problem*
And this [$NDASH]* should not be an en-dash
Here is some inline code with special characters & < > " ' # $ % ^ _ { } ~ \ * [ ], and here is some
single-line display code with special characters & < > " ' # $ % ^ _ { } ~ \ * [ ]
and here is some
multi-line display   
code with special characters & < > " ' # $ % ^ _ { } ~ \ * [ ]   
Some raw characters, XML/HTML: & < > “ ‘
Some raw characters, : # $ % ^ & _ { } ~ \
Some raw characters, PGML: \ * # { } [ ]
Some characters that need special handling for PGML conversion to HTML or :
A non breaking space (invisble where a hyphen should be)
An ndash–right here.
An mdash—right here.
Some constructions in “normal” text, which need to be manipulated, lest they get interpreted as PGML markup:
>>This should not be a centered line <<
>>Nor a right-justified line, either
We should not get _a phrase in italics_ in the midst of this sentence.
Brackets, unpaired; ] with content between [
Brackets, paired, in PGML constructions; [$NDASH]*, [___]{$answer}
### This should not be a level 3 heading
=== Not a horizontal rule from three equal signs
== Not a horizontal rule from two equal signs
===== Not a horizontal rule from five equal signs
--- Not a horizontal rule from three hyphens
-- Not a horizontal rule from two hyphens
----- Not a horizontal rule from five hyphens
+ Not an unordered list item
- Not an unordered list item
Here we make MathObject String answers to see how they turn out in answer elements.

Checkpoint 2.1.2.

  1. Special characters used by XML, character escaping: <>&’";
    Now as a MathObject: <>&’";
  2. Special characters used by LaTeX, where LaTeX \text and MathJax \text disagree: #%&<>\^_`|~
    Now as a MathObject: #%&<>\^_`|~
  3. Special characters used by LaTeX, where LaTeX \text and MathJax \text can agree: ${}
    Now as a MathObject: ${}
  4. Alphanumeric characters: ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789
    Now as a MathObject: ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789
  5. Other characters: !()*+,-./:=?@[]
    Now as a MathObject: !()*+,-./:=?@[]
In answers, because of and MathJax divergence, the first two should come out in verbatim. (And so should any string containing even one of those characters.) The latter three should come out in regular text.
Answer 1.
\({\verb!<>&'";!}\)
Answer 2.
\({\verb!#%&<>\^_`|~!}\)
Answer 3.
\({\text{\$\{\}}}\)
Answer 4.
\(\text{ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789}\)
Answer 5.
\({\text{!()*+,-./:=?@[]}}\)
Occasionally (and probably very rarely) your PG code will include a string variable where the content is PGML syntax. If this is put into the exercise statement, it will be inserted after PGML processing is done, and therefore it won’t render as you might expect. To insert this content and also have it processed as PGML, use data="pgml". (This is not in the PreTeXt schema as of 3/26/2020, and is subject to change.)

Checkpoint 2.1.3.

some PGML math: [`\frac{1}{2}+\frac{3}{2}=2`]; and some *bold text* makes:
some PGML math: \(\frac{1}{2}+\frac{3}{2}=2\text{;}\) and some bold text
You have attempted of activities on this page.