7 ms·
I really wish browsers would just render formulas directly from TeX. Let me write <tex>\sqrt{1+x}</tex> or whatever. TeX is the de facto standard for writing ma
by fdej 8y ago
I really wish browsers would just render formulas directly from TeX. Let me write <tex>\sqrt{1+x}</tex> or whatever. TeX is the de facto standard for writing mathematical formulas. That browsers don't render it natively just screams of NIH syndrome on the part of browser and web standards developers.
MathML still hasn't caught on after two decades, for three reasons: 1) not working in all browsers; 2) even when it worked, the rendering was often buggy or plain ugly; 3) no one wants to write MathML directly.
MathJax instantly solved all problems, which made it an overnight success. MathML might be able to overcome 1) and 2), but 3) should not be underestimated. MathJax will be around as long as it is the most convenient solution for showing equations in a browser (no user-side compilation required), and rendering times and network traffic will suffer accordingly.
- saagarjha 8y agoAlthough that does bring up the question of which subset of TeX browsers are willing to support.
- aplaice 8y agoWhen you write web-pages, do you usually write the raw HTML or do you use something like Markdown or Wikitext and have it converted to HTML? If the latter, then why would having LaTeX as part of the input and MathML as part of the output, be any different? Also, directly converting TeX to MathML, even client-side, is much easier and faster than MathJax's many-to-many approach (I'm not criticising MathJax — given the constraints, they're doing the best possible job).[0][1][2] (See also the Ascii to MathML converter[3] that has already been mentioned in another comment.) [0] http://fred-wang.github.io/MathUI2014/demos/7-web-component.html http://fred-wang.github.io/MathUI2014/demos/7-web-component.... [1] https://github.com/fred-wang/MathUI2014/blob/master/demos/7-web-component.html https://github.com/fred-wang/MathUI2014/blob/master/demos/7-... [2] https://github.com/fred-wang/x-tex https://github.com/fred-wang/x-tex [3] https://runarberg.github.io/ascii2mathml/ https://runarberg.github.io/ascii2mathml/
- ronsor 8y agoI do write the raw HTML actually
- runarberg 8y agoThink of MathML more like SVG. You can write it by hand (and in some cases you should), but in most cases you should use a graphical editor (like inkscape), or a library (like D3).
- qhwudbebd 8y agoThis is exactly the property that makes it actively worse than TeX notation. It makes equations a second class citizen compared to text because you can’t write them comfortably without external tools. MathML is a failure - because of its ludicrous verbosity. The correct solution may not be TeX notation, but it can’t be this bad a step backwards in usability.
- aplaice 8y agoHow's it worse? In either case, you can use TeX as your input, and if you do, you have to convert it, client-side or browser-side, into something usable by the browser; it's just that if the browser accepts MathML the rendering is faster and/or more convenient, plus you get other options.
- pvorb 8y agoI don't see why rendering TeX formulas would be slower than rendering MathML. It should be possible to maintain implementations for both variants with similar performance. MathML's parser should be simpler though, cause it's XML, which already has many efficient parsers.
- qhwudbebd 8y agoSorry, my claim was about the two notations: that the TeX one is writable, and the MathML is not. I’m not claiming that a JavaScript parser and complete renderer for TeX is better than a JavaScript parser that renders via MathML. The second option may indeed be more efficient - but making the browser parse a sensible notation for maths instead of an XML crapfest would be better than either.
- sharpneli 8y agoMathML is probably the best example of the late 90's early 2000's XML craze when everything was going to be XML and it was the best thing ever. https://en.wikipedia.org/wiki/MathML#Example_and_comparison_to_other_formats https://en.wikipedia.org/wiki/MathML#Example_and_comparison_... Comparison to LaTex is almost hilarious. Showing well how in the end XML managed to combine the properties of Binary and Text formats. It's slow to parse like text format and hard for humans to read, like binary formats. Personally I'd also really love that they'd just standardize LaTex or something similar. Why invent some non human readable mess when there is already a perfectly functional and widely used notation available?
- jahewson 8y agoMathML was created as a human-readable interchange format. It was never intended to be written by humans. Much like how HTML is often generated from markdown nowadays. It was specifically created to avoid TeX being used on the web, because TeX is ill-defined, loosely structured and lacks basic functionality such as Unicode support.
- phkahler 8y agoHTML was meant to be written by humans.
- conistonwater 8y agoMathML is not human-readable as shown by the example in the wikipedia link, and TeX is supposed to have Unicode support these days, assuming you have a properly configured modern system, that's not a good example.
- aplaice 8y agoXML is faster and far simpler to parse than TeX. To the extent that you need to (if for whatever reason you don't want to rely on a LaTeX to MathML or Ascii to MathML converter) you can make the quadratic equation MathML slightly more readable, by not using hex entities, but unicode for − and ±, and the named entity for ⁢.[0] Furthermore, you (and I!) are just far more familiar with TeX, which makes the comparison in readability not particularly fair. Finally, much of the invisible, seemingly redundant mark-up, such as ⁢ or ⁡, can help you avoid some of TeX's ambiguities — e.g. is $ f(a+x) $ the function $f$ acting on $(a+x)$ or $f$ multiplying $(a+x)$?[1] If you were to omit this mark-up (and if you're converting from TeX to MathML and don't want your converter to engage in guesswork, you have to) the MathML would be even simpler. Using the same format for equations as for the rest of the document (i.e. HTML/XML) is advantageous (in addition to the parsing benefits). In particular, you can use the same mechanisms for styling and transforming elements, as you can for the whole document. For instance, you could easily style parts of an equation, provide pop-ups that explain what each symbol means, when you hover over it, or interactively change the equation. (Much of this hasn't actually been done, outside experiments, because only Firefox properly(-ish) supports MathML, so it would have been wasted effort.) [0] https://gist.github.com/aplaice/266b092bc48afbbdd46cdbd0ca811da8#file-quadratic-xml https://gist.github.com/aplaice/266b092bc48afbbdd46cdbd0ca81... [1] Presentation MathML is still obviously not semantic, but it can be better in this respect than default TeX — there have been proposals for semantic TeX, but none of them have really caught on.
- nabla9 8y agoMarkup and rendering+typography should be orthogonal issues. Does TeX semantics have something that MathML does not yet have? MathJax works with both MathML and TeX. Is there difference in the rendering when using different markup with MathJax?
- jahewson 8y ago> Does TeX semantics have something that MathML does not yet have? It does not. In fact MathML captures much richer information than TeX. > MathJax works with both MathML and TeX. Is there difference in the rendering when using different markup with MathJax? There shouldn’t be. MathJax internally converts TeX input into an intermediate MathML AST before rendering.
- CJefferson 8y agoWhile MathJax is great, the biggest problem is that 'TeX' is a very poorly (read undefined) standard, and it's fairly easy to produce things which TeX renders fine, but MathJax and Katex both bork on. Of course, writing a clean "standard" which covers most of what people expect when they say "TeX", and implementing that, would hopefully produce the best of both worlds.
- felixfbecker 8y agoI'm sorry but Latex is an inconsistent touring-complete mess. Latex commands are far from intuitive, otherwise Detexify wouldn't be so popular. It's a million macros held together with duct type with no consistency in naming and syntax, and always dependent on which age-old package you're referencing. It's good at outputting pixel-perfect printable, non-accessible PDFs, and that's it. I'm excited by this because I hope that with a proper widely-supported system for math in HTML we can eventually write more papers to be digital-first. An HTML document is so much more accessible, searchable, semantically analysable and flexible than Latex and its PDF output. I dream of a world where the standard for papers is not Latex .pdf but .mhtml or .maff.
- MiroF 8y agoIf Latex can be rendered in HTMl, than the world you dream of could become reality. Nobody wants to learn a new type setting language. Latex is much less hard to learn and use than you imply I mean just look at MathML https://en.wikipedia.org/wiki/MathML#Example_and_comparison_to_other_formats https://en.wikipedia.org/wiki/MathML#Example_and_comparison_...
- felixfbecker 8y agoI think it can be, it's just nobody does it. I don't know what formulas get compiled to though - I would guess PNGs, at which point you lose the benefits over a PDF (at least for equations). With proper browser support for MathML it could always be MathML though, which would render sharp and be readable by a screen reader. It is unfortunate that MathML is not easily hand-written like the rest of HTML. What I find interesting in the link you posted though is that they embed the Latex or StarMath representation inside the MathML. It should be possible have tooling in text editors such that you only edit that Latex representation and on save the MathML representation is updated automatically.
- pvorb 8y agoWhile LaTeX might be hard to learn and inconsistent in its entirety, the formula is quite consistent and a lot easier to write by hand than MathML.
- jahewson 8y agoMathML was created specifically because TeX is not a standard, has no definition, has only one “true” implementation and does not capture enough structure of an equation to be a useful interchange format. Even ignoring syntax, the AST of TeX does not represent the underlying equation particularly well - just enough to use to as input to a typesetting system which behaves exactly the way that TeX does, e.g \sum has no way to specify what is being summed over (it’s irrelevant for typesetting in TeX - though not in general). Math typesetting is hard and stretchy characters in particular are not an easy fit into the browser layout model. It’s not been a priority for browser vendors. Hopefully that will change.
- whatshisface 8y ago>\sum has no way to specify what is being summed over I could usually tell you what was being summed over by reading the _ subscripts and ^ superscripts. However the thing written under the sigma is not always formal, nor should it be: oftentimes it will be an abbreviation of a fairly elaborate conditional that is described elsewhere in the text. Please, don't treat typesetting languages like they're programming languages where the computer has to be able to execute the formulas you write, we want to keep our close interweaving with natural language.
- stefan_ 8y agoThis comment sums up perfectly why it is such a failure. We don't want to run the frigging formulas! Typesetting is the point! Stop making it do everything, it will end up doing nothing!
- gsnedders 8y agoThere are two variants of MathML: semantic MathML (which does capture enough structure of an equation, and sees very very little use) and presentational MathML (which doesn't, but is much easier to author, and accounts for almost all MathML usage). There's no real difference in usefulness between presentational MathML and TeX.
- qhwudbebd 8y agoThe verbosity of MathML makes it completely impractical to type as working mathematician. It’s not just a small difference; it’s completely ridiculous.
- pvorb 8y agoIf you hadn't commented, this would be exactly what I'd have written.
- vnorilo 8y agoI write quite a bit of LaTeX, but I shudder at the thought of browsers embedding it. It is one of the more Lovecraftian codebases I've ever witnessed.