how to display long equal like this in Mathjax?

392 views
Skip to first unread message

Jinjun He

unread,
Nov 16, 2020, 11:37:04 PM11/16/20
to MathJax Users

  Hello,

   I am switching from katex to mathjax, but I encountered a problem that the long equal sign cannot be rendered normally. 


   katex expression:  A =\!=\!= B

  


  I have checked the list supported by Latex, but I have not found the corresponding formula。http://docs.mathjax.org/en/latest/input/tex/macros/ 

  Does anyone know what to fix it?



pe...@krautzource.com

unread,
Nov 17, 2020, 3:19:29 AM11/17/20
to MathJax Users
Hi,

I can see the \! macro listed on that URL.
The \! macro creates negative spacing, so it will depend on the font and layout details if the equals signs touch/overlap.

For MathJax, e.g., $$ A =\!\!\!\!\!=\!\!\!\!\!= B$$ works in the demo at https://www.mathjax.org/#demo

A more semantic and less brittle way would be to use MathJax's extpfeil extension (http://docs.mathjax.org/en/latest/input/tex/extensions/extpfeil.html) which can create a single stretched equation sign, e.g.,

$$\require{extpfeil} \Newextarrow{\longeq}{1,1}{0x003D} A \longeq{\phantom{xxxx}} B$$

Regards,
Peter.

Jinjun He

unread,
Nov 18, 2020, 12:16:08 AM11/18/20
to MathJax Users
Thank you peter, it works like a charm.

Davide Cervone

unread,
Dec 3, 2020, 3:54:17 PM12/3/20
to mathja...@googlegroups.com
It turns out that this is due to an issue with how MathJax has mapped MathML mspace elements into the TeX spacing rules.  They were incorrectly being treated as class ORD, but should have been ignored for purposes of determining inter-element spacing.  I have made an issue tracker


and a pull request


to resolve the problem.  In the meantime you can use

<script>
MathJax = {
  startup: {
    ready() {
      const MmlMspace = MathJax._.core.MmlTree.MmlNodes.mspace.MmlMspace;
      const TEXCLASS = MathJax._.core.MmlTree.MmlNode.TEXCLASS;
      const MML = MathJax._.core.MmlTree.MML.MML;
      
      MML[MmlMspace.prototype.kind] = class extends MmlMspace {
        texClass = TEXCLASS.NONE
        setTeXclass(prev) {return prev}
      };
      
      return MathJax.startup.defaultReady();
    }
  }
};
</script>

to patch MathJax on the fly, provided you can modify the web pages involved.  This script should come BEFORE the script that loads MathJax itself.

Davide


On Nov 16, 2020, at 11:37 PM, Jinjun He <hejin...@gmail.com> wrote:

  Hello,

   I am switching from katex to mathjax, but I encountered a problem that the long equal sign cannot be rendered normally. 


   katex expression:  A =\!=\!= B

  <Auto Generated Inline Image 1.png>


  I have checked the list supported by Latex, but I have not found the corresponding formula。http://docs.mathjax.org/en/latest/input/tex/macros/ 

  Does anyone know what to fix it?




--
You received this message because you are subscribed to the Google Groups "MathJax Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mathjax-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mathjax-users/88a0745b-685c-4fa6-beed-d7831d35c452o%40googlegroups.com.
<Auto Generated Inline Image 1.png>

Reply all
Reply to author
Forward
0 new messages