WeBWorK Main Forum

TeX affecting the Problem Editor text coloring

TeX affecting the Problem Editor text coloring

by Larry Riddle -
Number of replies: 1

We are running WW 2.19. While writing a problem recently, I noticed that a TeX expression was messing up the text coloring in the problem editor. The problem runs fine so this is not a serious issue, but I was just curious if this might be a small bug in the problem editor. Here is a color screenshot of a smaller version of the problem showing how the text after the TeX expression appears not to be colored in the appropriate way. If I remove the TeX expression, the text coloring changes back to the correct style (e.g. END_PGML is now in purple).

screenshot of a pg WeBWorK problem

And here is the actual problem if you want to try it yourself.

DOCUMENT();

loadMacros(
    "PGstandard.pl", "MathObjects.pl",
    "PGML.pl",       "contextPiecewiseFunction.pl",
);
Context("PiecewiseFunction");
BEGIN_PGML
Suppose
[```
f(x) = 
\left\{
\begin{array}{r@{\quad}l}
x + 1 & \text{if } x \leq 2 \\
-3x + d & \text{if } x > 2
\end{array}
\right.
```]
where [`d`] is a constant. What value of [`d`] makes [`f`] continuous?

[`d =`] [_]{Real(9)}

END_PGML

ENDDOCUMENT();

In reply to Larry Riddle

TeX affecting the Problem Editor text coloring

by Glenn Rice -

There were numerous issues like that with the CodeMirror 5 pg language syntax highlighting. For WeBWorK 2.20 that has all been completely rewritten for CodeMirror 6, and generally will do a much better job with syntax highlighting. It also features code completion suggestions.