## WeBWorK Problems

### Re: Correct syntax for PGML display math in variables

by Danny Glin -
Number of replies: 0

When I tried to reproduce your issue I discovered that I only had problems if the display mode was set to images.  Further it appears that even in images mode PGML generates MathJax for its equations, but that's a bug for another thread.

It looks like the problem is that PGML isn't designed to handle \ [ and \ ] as delimiters for LaTeX (spaces added so the Moodle forum doesn't parse this as math).  Here's what worked for me:

Remove \ [ and \ ] from the string being generated by disSYS, then use the following in the BEGIN_PGML block:

[ [\$ds] ]

Though when I view this in images mode in the Homework Sets Editor it breaks each equation into two lines.  The three backticks indicate to use LaTeX display mode in PGML.

It's also worth noting that if the disSYS subroutine is used in multiple problems it should probably be put into a macro file.