GithubHelp home page GithubHelp logo

Comments (1)

dpvc avatar dpvc commented on June 27, 2024 1

You are right that there should be more detail about this.

MathML and TeX approach the spacing between items in very different ways. MathML inserts spacing on both sides of <mo> elements (Math Operator elements) based on the Operator Dictionary and the position of the <mo> within the surrounding <mrow> (the <mo> will be in a prefix, infix, or postfix position in the expression). Some renderers also add space in other locations, but that is not required by the specification as it currently stands. For example, Firefox will put a small amount of space between <mi> (Math Identifier) elements when the mathvariant attribute is different between the two <mi>. This means that <mi>sin</mi><mi>x</mi> will have a small space between "sin" and "x", since the multi-character <mi>sin</mi> has the normal variant by default, while the single-character <mi>x</mi> has the italic variant.

TeX, on the other hand, determines spacing based on the class of adjacent items in the expression (not just at operators). TeX assigns each item a TeX class (OP = large operator, BIN = binary operator, REL = relation, OPEN = open delimiter, etc.) and specifies a spacing too use between each possible pairing of adjacent classes (see the TeXBook Chapter 18 (p. 170)). So TeX can have spacing in palces that MathML doesn't, and the spacing does not always agree between the two.

For example, TeX does not put spacing between two adjacent relations; e.g., x == y in TeX will have no extra space between the two equal signs (other than what is part of the glyph in the font itself). But in MathML, both equal signs are in infix position, and so get an equal amount of space on both sides, meaning there will be twice that extra space between the two equals.

MJX-1 vs. MML-1

TeX does some rewriting of classes to make some situations work better. For example, in x + -y to make the minus sign act as negation rather than a binary operator, whereas an extra <mrow> is needed for this case in MathML (and the TeX input jax doesn't add one).

MJX-2 vs. MML-2

Other places involve the spacing between two things neither of which is an <mo>, though the conditions where these include spacing is rare. One is the spacing for \sin x, where both are <mi> nodes:

MJX-3 vs. MML-3

Firefox handles that by putting space between <mi> that have different variants, as discussed above, though MathJax doesn't do that. That approach introduces extra space in places where TeX would not, for example, in a\mathbf{i}.

I hope that helps clarify the difference between the two modes.

from mathjax-docs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.