18
$\begingroup$

One of the (many) problems with MathJax is that formulas are rendered using a client-side JavaScript. Apart from the process itself being ridiculously slow, this also means that the entire page must be constantly reflowed, with things moving up and down a few times per second. In my opinion, this is extremely annoying.

There is a server-side version of MathJax: https://github.com/mathjax/MathJax-node. This server-side version only processes a formula once, after it is submitted to the server. The server can then serve the compiled version (i.e., an HTML file with a CSS style) to the user agent, which can then render the entire page almost instantly, compared to what it takes the client-side MathJax to render it.

Such a setup seems to be much superior to the current situation. Would it be possible to adjust the software accordingly?

Added 2018–3–11: The new version of MathJax-node seems to have full support for the HTML+CSS output. In light of this development, can we now revisit the question of switching to the server-side MathJax?

$\endgroup$
16
  • $\begingroup$ "The server can then serve the compiled version to the user agent," What exactly would this mean, in particular, what is "the compiled version" technically? $\endgroup$
    – user9072
    Commented Jul 18, 2015 at 12:15
  • $\begingroup$ @quid: The compiled version is HTML+CSS. $\endgroup$ Commented Jul 18, 2015 at 13:02
  • $\begingroup$ Thanks for the clarification. I believe this would also have some downsides, but I do not feel quite competent on these things, so I will wait for others' opinions. It might be interesting to know what the other large sites that use MathJax do. $\endgroup$
    – user9072
    Commented Jul 18, 2015 at 13:58
  • 7
    $\begingroup$ Is there a list of (some large) sites that use client-side and server-side MathJax? Comparison between existing examples might shed light on the pros and cons of the two options. $\endgroup$ Commented Jul 18, 2015 at 20:28
  • 3
    $\begingroup$ From the description it seems that this can only output SVG or MathML, not the HTML-CSS that is currently the default here. MathML is not supported widely enough, and SVG looks worse, at least for me in Chrome on Windows. $\endgroup$
    – user35354
    Commented Jul 20, 2015 at 7:32
  • 1
    $\begingroup$ @MadScientist: The package that I linked to is little more than an example for node.js. It basically calls the original MathJax library, and it's hardly difficult to call the function that outputs HTML+CSS instead of MathML or SVG. $\endgroup$ Commented Jul 20, 2015 at 11:18
  • 4
    $\begingroup$ @DmitriPavlov I took a quick look at the code, it doesn't look like HTML+CSS is an option. As far as I remember server-side rendering isn't possible with the old MathJax renderer, it needs certain measurements that are only available on the client browser. $\endgroup$
    – user35354
    Commented Jul 20, 2015 at 11:23
  • 3
    $\begingroup$ I found the comment from a MathJax developer confirming that HTML+CSS doesn't work yet with the server-side version: meta.math.stackexchange.com/questions/16809/… $\endgroup$
    – user35354
    Commented Jul 20, 2015 at 11:30
  • $\begingroup$ Could you please clarify the status of your comment "The compiled version is HTML+CSS." It appears this is not quite clear or precise (at least it seems there is a choice to be made). In addition, even if it were so, would this switch then deprive us of the possibility to choose between (HTML+CSS), MathML , SVG locally? $\endgroup$
    – user9072
    Commented Jul 20, 2015 at 11:57
  • $\begingroup$ @quid: MathJax can compile to several output formats: HTML+CSS, MathML, SVG. The first one works on all browsers (unlike MathML), so it makes sense to compile to it. As for the “possibility to choose” I don't see why one should bother about which format to choose if the outputs are identical. $\endgroup$ Commented Jul 20, 2015 at 12:34
  • $\begingroup$ @MadScientist: The comment is almost a year old, so it might not reflect the current state of affairs. $\endgroup$ Commented Jul 20, 2015 at 12:40
  • $\begingroup$ @MadScientist: As for “it needs certain measurements that are only available on the client browser”, another comment in your link seems to indicate that this was (or will be?) rectified in a newer version of MathJax. $\endgroup$ Commented Jul 20, 2015 at 12:42
  • 4
    $\begingroup$ @DmitriPavlov You can check the current status of the new HTML engine if you select FastHTML as the renderer on MathJax here on the site. It is still missing many features and breaks in many cases. $\endgroup$
    – user35354
    Commented Jul 20, 2015 at 12:48
  • 2
    $\begingroup$ Yes, I know there are several possibilities in principle (which should be evident from my comment). Indeed, this is why I originally asked what "the compiled version" is supposed to mean (how can one know what is even meant?). It now seems that it is not at all clear that what you proposed even would work. Leaving aside that it would limit users' choice; I think there are some that prefer MathML. As said I do not know all the technicalities, but I suppose the different options are not only offered "for fun" so there ought to be some difference in some circumstances. Maybe update the post. $\endgroup$
    – user9072
    Commented Jul 20, 2015 at 12:52
  • 1
    $\begingroup$ There is this feature request on meta.SE by @MadScientist which seems related: Implement server-side MathJax rendering. $\endgroup$ Commented Mar 12, 2018 at 6:55

0

You must log in to answer this question.

Browse other questions tagged .