MathJax icon indicating copy to clipboard operation
MathJax copied to clipboard

Missing spaces around the `\perp` symbol in Mathjax v4

Open c-forrest opened this issue 5 months ago • 2 comments

Issue Summary

The spacing around the \perp symbol is incorrect in Mathjax v4 — it appears too tight compared to expected LaTeX behavior.

Steps to Reproduce

  1. Open the MathJax live demo.

  2. Enter:

    $a \perp b$
    
  3. Observe the rendered output:

Image

Expected Behavior

In MathJax v3 (and in LaTeX), \perp is treated as a relation symbol (REL) (according to some unofficial TeX syntax notes), so extra spacing is inserted around it:

Image

Possible Cause

In the HTML output, \perp is currently classified as ORD, resulting in missing relational spacing:

<mjx-texatom data-mjx-texclass="ORD" texclass="ORD">
  <mjx-mo data-latex="\perp" ... data-semantic-operator="infixop,⟂">⟂</mjx-mo>
</mjx-texatom>

It looks like MathJax may be handling \perp the same way as \bot, classifying it as ORD instead of REL.

c-forrest avatar Sep 22 '25 01:09 c-forrest

In response to #3322, MathJax v4 remapped \perp from the incorrect character U+22A5 (UP TACK) to the correct U+27C2 (PERPENDICULAR). The TeX class for \perp was being assigned automatically from the operator dictionary, which had U+22A5 set to REL (though it shouldn't be). Unfortunately, U+27C2 is not in the MathJax operator dictionary, and so it received a default ORD class.

This is being corrected in the next release, along with a broader update to the operator dictionary.

dpvc avatar Sep 28 '25 11:09 dpvc

In the meantime, you can incorporate

MathJax = {
  startup: {
    ready() {
      const {OPTABLE, MO} = MathJax._.core.MmlTree.OperatorDictionary;
      OPTABLE.infix['\u27C2'] = MO.REL;
      MathJax.startup.defaultReady();
    }
  },
};

into your MathJax configuration to work around the issue.

Als note that this is a duplicate of #3440 (which the author closed).

dpvc avatar Sep 28 '25 11:09 dpvc