9 ms·
This is amazing. Probably the final nail in the coffin of MathML; what’s the point of a non-human readable intermediary language that other higher-level languag
by MontyCarloHall 4y ago
This is amazing. Probably the final nail in the coffin of MathML; what’s the point of a non-human readable intermediary language that other higher-level languages get compiled to, that only works in certain browsers (and with browser-dependent rendering/implementation), when you can instead write directly in LaTeX and have KaTeX work identically everywhere?
- simplotek 4y agoI believe MathML is still the only way to get proper math typesetting in epub, and I doubt katex is an option.
- auggierose 4y agoUnfortunately MathML doesn't get you proper typesetting in epubs, so it has that in common with katex.
- Georgelemental 4y agoIt does if your EPUB reader supports it—which most don't, but a few do! I am partial to http://koreader.rocks/ http://koreader.rocks/
- auggierose 4y agoI have tried out a few readers, none I tried so far support it in satisfying quality comparable to what katex would deliver. Maybe koreader is an exception, but I doubt it. Will give it a try at some point.
- simplotek 4y ago> (...) comparable to what katex would deliver. You're comparing real world working implementations based on mathml with your hopeful expectations of how you wish katex could work in an epub implementation. It's good to have hopes and dreams and a positive outlook, but your perceived solution does not exist. It's hardly relevant to present it as a better alternative.
- auggierose 4y agoI have no need for real-world implementations that do not work as well as I need them to work. KaTeX is proof that math can be displayed properly in a browser-like environment. Anything less will not do it, at least for me. That's why I have exclusively PDFs in my digital library, except for books that are just text, like fiction. No hopes and dreams needed, just use PDF. But making epub work properly for math is not a problem in principle, just make katex work in an epub reader, problem solved. And people who are satisfied with substandard solutions are actually part of the problem, not the solution.
- Georgelemental 4y ago> just make katex work in an epub reader "Just write a full JavaScript and DOM implementation for your resource-constrained e-ink device"
- auggierose 4y agoI think you need that already if you want a compliant epub reader. Javascript is part of the epub standard.
- Georgelemental 4y agoAccording to the standard, it seems that basic MathML support is required for all conformant implementations (https://www.w3.org/publishing/epub32/epub-contentdocs.html#sec-xhtml-mathml-rs-conf https://www.w3.org/publishing/epub32/epub-contentdocs.html#s...), but scripting support is optional (https://www.w3.org/publishing/epub32/epub-contentdocs.html#sec-scripted-content-rs-reqs https://www.w3.org/publishing/epub32/epub-contentdocs.html#s...). Not that anyone actually follows the standard…
- iudqnolq 4y agoAnd that's one reason why the majority of ebooks purchased by consumers aren't in epub format.[1] For the vast majority of fiction a format constrained to bold, italicize, paragraph break, chapter heading, and chapter break allows a far superior user experience. [1] https://magnoliamedianetwork.com/ebook-publishing-platforms/ https://magnoliamedianetwork.com/ebook-publishing-platforms/
- Georgelemental 4y agoIf you need it to be pixel-perfect it will probably disappoint, yes. It's good enough for the few times I have made use of it. (It's also open-source, so you can always contribute improvements)
- auggierose 4y agoNever understood that need to contribute to open-source. Why would I try to meddle with somebody else's messed up implementation? I have enough messes of my own to clean up!
- hgsgm 4y agoTeam work makes the dream work.
- auggierose 4y agoMust be why Avenger movies are so popular.
- simplotek 4y ago> Team work makes the dream work. Except there is no team, and people dream differently. More often than not, open source creates problems for developers. See Rust's Actix framework.
- simplotek 4y ago> Unfortunately MathML doesn't get you proper typesetting in epubs (...) Wrong. MathML is a part of the Epub3 specification. All e-reader implementations that comply with the epub3 specs get you proper typesetting in books published in epub3 format.
- auggierose 4y agoI guess it is you that is living in a dream world. There are no epub3 compliant implementations then, because none of them display math properly. If they were compliant, they would also run KaTeX just fine, because Javascript and HTML are part of the standard, too.
- simplotek 4y ago> I guess it is you that is living in a dream world. There are no epub3 compliant implementations then, because none of them display math properly. To start off, you already have posts in this very discussion rejecting your misconception. Secondly, mathml works fine when we have an epub3 reader opening a epub3 doc created by epub3 generators from epub3+mathml input. If any of those requirements aren't met, you get issues. This happens with each and every single typesetting feature, not just mathml. Would you claim that epub fails to support tables if you open an epub doc with broken tables? Thirdly, a typical implementation shortcut taken by epub readers is to reuse whatever WebView they pick. If your epub reader uses an outdated or shitty WebView implementation, you get shitty epub docs. https://caniuse.com/?search=mathml https://caniuse.com/?search=mathml Why are you commenting on subjects you are clearly clueless about?
- deleted 4y ago[deleted]
- auggierose 4y agoI think I will indeed refrain from commenting in the future, as conversing with people as knowledgeable as you are is becoming a chore.
- mkl 4y agoKatex supports ahead-of-time server-side rendering which just generates HTML, so it may indeed be an option.
- mkl 4y agoMathML is not just for presentation. It encodes a lot of semantic information that Latex leaves out, and that information can be useful for accessibility, computer algebra system interoperability, etc. That said, I don't think it's used much for those things. I had really high hopes for MathML when it was first announced, but the poor browser support and consequential lack of use has been really disappointing.
- edflsafoiewq 4y agoMarking up the semantic structure of all your mathematical formulas is about as likely as marking up the parse tree and parts of speech for all your regular prose sentences. Presentational MathML is the only thing that matters; Semantic MathML is W3C semantic web wank.
- mkl 4y agoThe idea is the MathML is generated by a computer algebra system or similar which has all that data, not manually.
- Kwpolska 4y agoWhat if you do not have any computer algebra system in your pipeline? LaTeX can be written and read by actual humans, MathML cannot.
- throwaway290 4y agoYou can use latex to author mathml, like we everywhere use markdown to author HTML.
- Kwpolska 4y agoThe first hit in Google for "latex mathml converter" is https://temml.org/ https://temml.org/ . The list of supported LaTeX constructs looks fine, but the output… The example LaTeX converts to 67 lines of MathML. The vectors (arrows above B, l, E) are built like this: <mover> <mi>B</mi> <mo stretchy="false" style="transform:scale(0.75) translate(10%, 30%);">→</mo> </mover> But the hat above n is: <mover> <mi>n</mi> <mo stretchy="false" style="math-style:normal;math-depth:0;">^</mo> </mover> Markdown is great, but I can always take the HTML produced by a Markdown→HTML converter and edit it by hand, since HTML is human-readable and human-editable. MathML is neither. The output of MathML is also uglier than KaTeX’s, with wonky spacing. In Firefox, there’s an ugly space after all \d's (derivative sign). It’s better in Edgium, but there is still an ugly space in \d\vec{l}. If I need an intermediary tooling/format for math, I’d prefer beautiful LaTeX-esque output, and keep LaTeX code that wold be converted by KaTeX on the fly to whatever ugly HTML is required.
- Georgelemental 4y agoMathML is faster to render. KaTex is a lot faster than MathJax but the difference remains noticeable. (Firefox extension to force native MathML rendering: https://addons.mozilla.org/en-US/firefox/addon/native-mathml/ https://addons.mozilla.org/en-US/firefox/addon/native-mathml...)
- esperent 4y agoYou can pre-build katex, or render server side.
- xigoi 4y agoThat's better, but it generates a lot of markup, causing the sites to be very heavy (several megabytes). I know this because I'm using pre-rendered KaTeX to write my school notes, see for example: https://kmlinux.fjfi.cvut.cz/~blazead5/school/difr/ https://kmlinux.fjfi.cvut.cz/~blazead5/school/difr/ Notice that the page takes a while to load, even though it's mostly text.
- g8oz 4y agoIgalia is doing amazing work shipping native MathML support for Chromium based browsers. https://www.igalia.com/2023/01/10/Igalia-Brings-MathML-Back-to-Chromium.html https://www.igalia.com/2023/01/10/Igalia-Brings-MathML-Back-...
- tannhaeuser 4y agoMathML support in Chrome has been greatly enhanced just in January [1]. I don't have strong opinions, but I guess the advantage over TeX is, as always, that MathML is much better integrated with the web stack and markup such that you can target math formulas using CSS, that it has much better accessibility, internationalization, and search, that you can use JS/DOM access with MathML for educational and science presentation apps, etc. It's not like TeX is uncontroversially better (eg Turing completeness, terse, lacking editor support, print-oriented, purely presentational, ...) [1]: https://mathml.igalia.com/news/2023/01/10/mathml-in-chromium-project-is-completed/#new https://mathml.igalia.com/news/2023/01/10/mathml-in-chromium... Edit: arguably MathML is excessive as well but at least its XMLism such as insistence on enclosing every operand in tags as the primary source of bloat and incomprehensibility in presentational math can be somewhat mitigated using SGML, as was already suggested with MathML's precursor in 1995 or so [2] for high school math and/or custom math fragments. [2]: https://www.w3.org/MarkUp/html3/maths.html https://www.w3.org/MarkUp/html3/maths.html
- the__alchemist 4y agoI don't understand MathML's intent; likely because I have a different design mentality or model. I like to represent things like this in 3 forms: #1: Rendered notation for reading; what all these tools produce for people reading the document #2: A clean, well-documented API for writing. This is the Latex, Mathjax, katex syntax etc, replete with backslashes. #3: A representation in a computing language used to create the rendered form from the API. Depends on the language, but ie something like a set of structs and enums that can be manipulated by a compiler. MathML is none of these; it's neither readable, nor writable, nor manipulable natively by a programming language.
- runarberg 4y agoThink of MathML like SVG. It is a target language which browsers understand. With SVG you can write it in hand, but most likely you are gonna use a special editor (Inkscape) or a library (d3). With MathML you can write your equations e.g. in libreOffice or pick a library like MathJax or TeXZilla. In fact I wrote a library my self which compiles a AsciiMath derived language to MathML, it was my first time writing a compiler, and it was an absolute joy targeting MathML. The mapping between DOM nodes and XML nodes is a perfect fit for the web as it allows my to implement DOM as a direct target (`mathup(expression).toString()` vs. `mathup(expression).toDOM()` and even `mathup(expression).updateDOM(parentNode)`. The documentation for MathML on MDN if fine actually, good enough for me to write a compiler. The structure of the language is much easier to compile to than LaTeX by nature of actually having a standard (as opposed to an implementation which functions as a standard). MathML is a unique fit for what it was intended to do, which is a targeting language which browsers understand.
- camdenreslink 4y agoKaTeX is really old (like 9 or 10 years?). So if it was going to kill MathML, it probably already did it.
- RyEgswuCsn 4y agoI am not that familiar with MathML, but I can imagine programmatically manipulate math expressions with MathML; can TeX math expressions be manipulated in the same way?
- deleted 4y ago[deleted]