PREP 2014 Question Authoring - Archived

Constructing arrays in PGML, and short answer blocks

Re: Constructing arrays in PGML, and short answer blocks

by Davide Cervone -
Number of replies: 0
Unfortunately, tables is one of the features that still needs to be added to PGML (there are versions of Markdown that include tabling, so there are specifications that could be used).

On the other hand, you can still use the PG macros that you are using from within PGML. In PGML, [@ ... @]* acts like \{...\} does in BEGIN_TEXT/END_TEXT, so you could simply replace \{ with [@ and \} by @]* (the star at the end is to prevent PGML from altering the results by quoting special characters; you want the results of the tabling macros to be inserted verbatim). Or you could do them all in one block by concatenating the results of each command using perl's "dot" operator, as in:

BEGIN_PGML
Find all Nash equilibria in pure strategies for the zero-sum game given below.

>> [@ 
  begintable(3) .
  row( " ", "Left", "Right" ) .
  row( "Up", "$a, -$a", "$d, -$d" ) .
  row( "Down", "$b, -$b", "$c, -$c" ) .
  endtable()
@]* <<

If both players play their optimal strategy, the Row player will have a payout of [________]{"[$b]"}.  
Explain your reasoning for your answer above. 
[@ ANS(essay_cmp()); ans_box(5,40) @]*
END_PGML