Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Limits of sum incorrectly placed if sum is entered as unicode character #3349

Open
felixlen opened this issue Mar 24, 2025 · 2 comments
Open
Labels
Accepted Issue has been reproduced by MathJax team Code Example Contains an illustrative code example, solution, or work-around v3 v4

Comments

@felixlen
Copy link

Issue Summary

There is a difference in rendering if the macro \sum or the corresponding unicode character ∑ is used. LuaLaTeX rendering leads to identical placement of limits, while MathJax always treats limit positions for ∑ with inline style.
This issue occurs with Safari and OS X.

Steps to Reproduce:

Rendering

$$ ∑_{k=1}^{n} - \sum_{k=1}^n $$

yields the following output:

Image

With LuaLaTeX on the same snippet both sum signs and placement of limits look identical.

Technical details:

  • MathJax Version: 3.2
  • Client OS: (e.g., Mac OS X 10.8.4)
  • Browser: (e.g., Chrome 29.0.1547.57)
@dpvc dpvc added Accepted Issue has been reproduced by MathJax team v3 v4 labels Mar 24, 2025
@dpvc
Copy link
Member

dpvc commented Mar 24, 2025

Yes, some macros set properties that are not part of the unicode character itself. Mostly these are the large operators like \sum. You can use the following configuration to map the unicode characters for these large operators to their associated macros:

MathJax = {
  tex: {
    packages: {'[+]': ['unicode-largeops']}
  },
  startup: {
    ready() {
      const {MacroMap} = MathJax._.input.tex.SymbolMap;
      const {Configuration} = MathJax._.input.tex.Configuration;
      const BaseMethods = MathJax._.input.tex.base.BaseMethods.default;
      const ParseMethods = MathJax._.input.tex.ParseMethods.default;
      new MacroMap('unicode-largeops', {
        '\u220F': ['Macro', '\\prod'],
        '\u2210': ['Macro', '\\coprod'],
        '\u2211': ['Macro', '\\sum'],
        '\u22C0': ['Macro', '\\bigwedge'],
        '\u22C1': ['Macro', '\\bigvee'],
        '\u22C2': ['Macro', '\\bigcap'],
        '\u22C3': ['Macro', '\\bigcup'],
        '\u2A00': ['Macro', '\\bigodot'],
        '\u2A01': ['Macro', '\\bigoplus'],
        '\u2A02': ['Macro', '\\bigotimes'],
        '\u2A04': ['Macro', '\\biguplus'],
        '\u2A06': ['Macro', '\\bigsqcup'],
      }, {
        Macro: BaseMethods.Macro
      });
      Configuration.create('unicode-largeops', {
        handler: {character: ['unicode-largeops']}
      });
      MathJax.startup.defaultReady();
    }
  }
}

You can add other unicode characters if you need special mappings for them as well.

@dpvc dpvc added the Code Example Contains an illustrative code example, solution, or work-around label Mar 24, 2025
@felixlen
Copy link
Author

Thanks a lot, your solution works well for me! Is it planned to include these macros at some point or is it out of scope for MathJax? If not I am happy to close here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Accepted Issue has been reproduced by MathJax team Code Example Contains an illustrative code example, solution, or work-around v3 v4
Projects
None yet
Development

No branches or pull requests

2 participants