#107 TeX renders a lot smaller than MathML

closed-fixed
nobody
5
2010-10-10
2010-10-08
Chris
No

Within the same HTML environment the rendering of TeX formulas appears much smaller than when rendering the same formula from MathML. See an <a href="http://km-works.eu/mathel-wiki/Wiki.jsp?page=Sandbox2">example here</a>.
The above is true for both inline and display style. However, when using display style, in addition to being smaller font-size, TeX output uses up more vertical space and valign seems to be set to bottom instead of center.

Discussion

  • Davide P. Cervone

    I am not able to access the address you gave (I get a "no permission to access" error message). Can you open that up temporarily for me (or check that the URL is correct)? Thanks.

    I suspect there is something with the CSS that is interfering with MathJax. You could try commenting out the CSS files temporarily and see whether that makes a difference. If it does, add them back in one at a time until you find the one with the issue. Then that gives a starting place for looking into the CSS that might be the culprit.

    Davide

     
  • Chris

    Chris - 2010-10-08

    My apologies, your IP address somehow made its way onto the blocked list (my site is under heavy attack for some days now, so I had to arrange for some defences).
    It should work now, please retry.

     
  • Chris

    Chris - 2010-10-08

    Alright, found out why they are different.
    But, now BOTH are terrible small.

     
  • Chris

    Chris - 2010-10-08

    Guess I have to define CSS classes MathJax and MathJaxDisplay according to my sizing needs ?

     
  • Davide P. Cervone

    There reason that the math is small is because your math is within elements that use the monospace font. By default, the monospace font is smaller than the main font (I don't know why the browsers are set that way). MathJax tries to match the ex-height of the surrounding font, and so sets its size so that the "x" in mathematics will match the "x" in the surrounding text. But the font in the surrounding text is "monospace", which has a smaller "x" than the font you are using elsewhere, so the math looks small for you. The same applies in the <pre> tags that you are using.

    You should NOT set the font size on MathJax_Display, as that will confuse MathJax about the size of measurements on the page, and it will get its spacing wrong. If you want to globally enlarge MathJax output, set the menuSettings: {scale:120} configuration parameter instead. Note that changing .MathJax font size will do nothing, since MathJax overrides that itself (I will need to add that to .MathJax_Display as well).

    As for the spacing, by default MathJax_Display has "margin: 1em 0" style settings, so you could change that to "margin: 0" to avoid the space above. I would recommend going through MathJax's configuration for that rather than putting it in a .css file because MathJax sets this itself and you can avoid the problem of which setting takes precedence by telling MathJax what you want directly. E.g., in the MathJax/config/MathJax.js file, set the HTML-CSS configuration block's "style" to be

    style: {margin: 0},

    to remove the 1em top and bottom margin. There is extra space in the TeX block that I'll have to check into. It has something to do with how Firefox deals with <pre> tags (for some reason it thinks it needs an extra line break). This doesn't happen for me in other browsers, but I'll check into it.

    Finally, I have always felt that Firefox chooses too small a font for the mathematics it renders in MathML, so the fact that it looks small to you corresponds to what I usually see for Firefox.

    Davide

     
  • Davide P. Cervone

    • labels: --> Layout issues
    • status: open --> closed-fixed
     
  • Davide P. Cervone

    I have taken care of the extra space above the display math within the <pre> element (it was due to an empty text node being left in the DOM tree when the mathematics was the first thing in the <pre> tag. Firefox seems to think this requires a newline when MathJax inserts the <div> that it uses for its typeset math; other browsers don't. MathJax now checks for to see if the text node is empty after it removes the TeX code, and removes it if it is.

    This is in SVN 621.

    Davide

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks