Skip to content

MLR110: Definite TeX brace/environment imbalance in a literal

qual reports MLR110 when the joined positional string literals of a MathTex / SingleStringMathTex / Tex call contain a structural TeX error that survives Manim's own repairs: a } closing a group that never opened, or a mismatched \begin{...} / \end{...} pair.

  • Default severity: error
  • Minimum confidence: high
  • Implementation phase: 4
  • Fix: none

The verdict mirrors what Manim actually compiles (tex_mobject.py): _remove_stray_braces repairs pure count imbalances (so \frac{1}{ is NOT an error), multiple arguments are joined with arg_separator and judged jointly (so MathTex(r"e^{i", r"\tau} = 1") is fine), an unmatched array environment blanks the string, and imbalanced \left/\right pairs are rewritten to \big.

Per the DESIGN 7.2 prose the parser is strictly conservative: literals containing macros (\def, \newcommand, ...), comments (%), verbatim, TeX conditionals, catcode games, Manim's {{ ... }} split notation, delimiter-sized braces (\left{), the wrapper environment's own name, or escape-corrupted values (MLR103 territory) are Unknown and stay silent.

Wrong:

MathTex(r"a}b{c")                        # } closes before { opens
MathTex(r"\begin{cases} x \end{matrix}")  # crossed environments

Right:

MathTex(r"a{b}c")
MathTex(r"\begin{cases} x \end{cases}")