WeBWorK Problems

PGML display math

PGML display math

by Alex Jordan -
Number of replies: 4
In PGML, [``...``] produces inline math preceded by a \displaystyle.
  1. Was this an intentional decision instead of having it produce actual display math? If so, can anyone speak to what led to that?
  2. Could there be something like [```...```] that actually makes display mode?
The distinction matters for PreTeXt output, and I can't get away with something like wrapping centering markup around the current [``...``].
In reply to Alex Jordan

Re: PGML display math

by Alex Jordan -
OK, I have implemented this in a branch. Before I submit it with a pull request, is there any objection to [``` ```] for delimiters? (And [::: :::]for ASCIIMath input.) It's long, but it makes sense as an extension of [` `] and [`` ``].
In reply to Alex Jordan

Re: PGML display math

by Davide Cervone -
Yes, that was done on purpose, for several reasons.

First, the centered displayed equation is frequently not appropriate for WeBWorK problems (especially in the original days of PGML before the layout was changed to include the grey background and border, which limits the width of the problem, the output could be very wide, and centered equations made reading the problem difficult).

Second, the layout was intended to be controlled by PGML, not TeX, so if you wanted an equation on a separate line with centering, you would indicate that through PGML, via

>> [`` ... ``] < <
on a separate line proceeded by a blank line.

Third, people often wanted display-style rendering (for fractions or summations) in their in-line formulas, so [`` ... ``] made that easy.

Fourth, people often wanted their displayed equations left-justified (or just indented), rather than centered. That is also easy by just indenting the [`` ... ``] by four spaces.

Can you explain why the distinction matters in PreTeXt, and why centering is insufficient? The only thing I can think of is that equations with equation numbers or \tag{} macros would be easier that way. Since PG problems don't usually have numbered or tagged equations, that was not considered to be an issue for PGML when it was designed.

In reply to Davide Cervone

Re: PGML display math

by Alex Jordan -
Thanks Davide, those explanations all make sense. I had thought about a few of them, but I never would have guessed about the background border issue for one.

> Can you explain why the distinction matters in PreTeXt, and why centering is insufficient?

The philosophy with PreTeXt is almost entirely to write logically marked up content, with almost no acknowledgment of formatting. For a simple example, you would never indicate to italicize something. You might mark up that something should be emphasized, or that something is a foreign word, which are issues of content and not styling. A combination of PTX's translation style sheets and personal styling CSS or preambles would likely make these things italicized for the final output.

Consequently, there is no way in PreTeXt to specifically mark up centering or indentation. With the PGML centering delimiters or indentation patterns, I have to just nullify those when outputting PTX. Conceivably we could recognize centering-surrounding-math and then output the PTX markup for display math, but since that is a combination of two distinct PGML constructs, I don't think the current PGML structure makes that an easy thing to recognize.

Also, we can't just make the double-backslash convert to PTX display math, for reasons like OPL problems that intentionally used it inside a sentence for something like tall fractions.

So what was (is) happening is that a PTX author would mark up display math for a WBWK problem in their book. Then that would translate to centered-double-backtick PGML. But then on the return trip (necessary for print copies of the book) you would just get left-justified math with the \displaystyle out front.

Having a single PGML delimiter for display math makes it easy. In the PR I submitted for this, it just tosses it to PGbasicmacros' display math, which is already set up to output PTX's display math tag.