Rewrite Rulesbase/mkern-to-mspace

base/mkern-to-mspace

Collapse mkern to the explicit mspace command.

Rewrite patterns#

  1. \mkern #1\mspace{#1}

Examples#

Each example shows this rule applied in isolation. A complete normalization profile may make additional changes.

mkern between text glyphs#

Before

\text{A\mkern 1em B}

After this rule

\text{A\mspace{1em}B}

Rendering verified with the declared packages.

mkern mu length#

Before

A\mkern 2mu B

After this rule

A\mspace{2mu} B

Rendering verified with the declared packages.

Text mkern braced space loss#

Before

\text{A\mkern{1em} B}

After this rule

\text{A\mspace{1em}B}

The rendered result has pixel differences from the input.

Same family#

Notes#

MathJax base/math gives \mkern a nobreak flag that \mspace does not preserve. In text content, MathJax's unbraced dimension scanner also consumes one ASCII space after the unit, while a braced dimension preserves it; TeXForm's AST cannot distinguish those scalar source forms, so canonicalizing the common primitive form can drop an intentional space after a braced argument. Both gaps make worst-case fidelity approximate. The base record owns this name by package import order.

Disable this rule#

TransformEngine(profile="corpus", disable_rules=["base/mkern-to-mspace"])
new TransformEngine({ profile: 'corpus', disableRules: ['base/mkern-to-mspace'] })

Open in Playground