Search code examples
htmlcssmathjax

MathJax not accurately computing end of exponent with custom font


I am using a custom font in MathJax- it seems that it has the length same issues that overbars had, which has been fixed in latest version- in that it computes all characters at fixed length. Therefore when inserted in html, the exponent crashes into the next character being displayed as some characters cause the line to be longer than MathJax computes it as . See example at this link: https://dl.dropboxusercontent.com/u/43267852/exponent.jpg It is especially bad with caps W and M . I am attempting a work-around, but it is inaccurate at times- any suggestions? Thanks!


Solution

  • any suggestions?

    Yes. Don't use custom fonts. MathJax does not have enough information about them to do a proper layout. If you use such fonts you are going to run into troubles.

    If you are really just trying to get a sans-serif font, MathJax includes one. See this post in the MathJax user's forum for several ways to have it used for letters and numbers.

    If you must use your own font, then you should set

    MathJax.Hub.Config({
      "HTML-CSS": {noReflows: false}
    });
    

    in your configuration so that MathJax will remeasure the widths of items when it lays out more complex mathematics.