MLR103: Python escape in a non-raw Tex/MathTex literal corrupts a TeX command¶
qual reports MLR103 when a non-raw string literal passed to
MathTex, Tex, or SingleStringMathTex contains a short Python escape
(\f, \a, \b, \t, \v, \r) that together with the letters
immediately following it spells a known TeX command — for example \frac,
\alpha, \begin, \tau, \times, \vec, \rightarrow.
- Default severity:
error - Minimum confidence:
high - Implementation phase:
1 - Fix: unsafe suggestion adding an
rprefix
The check reads the raw source text of the literal, so a correctly
escaped "\\frac" and a raw r"\frac" never fire. Intentional \n
newlines are never flagged, and escapes that do not spell a plausible TeX
command (like "\tomato") stay silent. The suggested r prefix is
UNSAFE because a raw prefix changes the runtime value of every escape in
the literal.
Wrong:
Right: