Inline LaTeX parse-error highlighting

Powered by sourceOffsets on Compute Engine parser errors + MathfieldElement.applyStyle(). Type an invalid expression — the exact offending token is colored red, and a missing value (empty \sqrt / \frac slot) is flagged with a red placeholder box.

x^2 + 3x

Compute Engine MathJSON


          

Detected error offsets


          

Offsets are character ranges into the serialized LaTeX. The highlighter maps each range to a Mathfield selection and styles it — no PrairieLearn-specific code involved.