question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Feature: XHTML output for EPUB

See original GitHub issue

Is your feature request related to a problem? Please describe. I saw someone mentioning that math support in epub is in a sad state. A quick search shows that MathML is the current only method of doing so, but we all know how painful it is to write, and on top of that not every reader is capable of rendering it.

Now the obvious solution is to use some front-end to convert something easier-to-write to MathML and some fallback – precisely what KaTeX is designed to do. From some playing around on https://validator.nu, it looks like the only thing preventing validation with the XHTML + SVG 1.1 + MathML 3.0 schema (where the unversioned XHTML refers to “HTML5”) is a lack of xmlns on the <svg> element. Other asepcts of the generation are strict enough for XML as far as I can tell.

Describe the solution you’d like:

  1. Add the attribute xmlns="http://www.w3.org/2000/svg" to generated <svg> elements. (Okay, that’s #2725.)
  2. Preferably add a section in node.md talking about the XHTML usage.
  3. (While we are at it, the demo and readme can use some mention on the MathML capability. Like #2881.)

Link to or name of a (La)TeX package that provides the same feature: Not applicable.

Describe alternatives you’ve considered: I originally considered requesting an HTML/XHTML output mode switch for (1), but the difference feels too small to justify it.

Additional context: The EPUB people at https://github.com/w3c/epub-specs/issues/845 are talking about the mathml situation too. KaTeX’s output fits into the fifth proposed method.

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:1
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
edemainecommented, Jul 21, 2021

@Artoria2e5 I finally merged #2725 – sorry for the delay. I checked that a simple document passed the XHTML + SVG 1.1 + MathML 3.0 schema. Would you like to write a PR to document this feature?

0reactions
universemastercommented, Oct 22, 2021

Adding the svg namespace adds 0.4% to my uncompressed file size, which perhaps isn’t a big deal on its own, but for a fringe use case it seems contrary to the efforts and philosophy in https://github.com/KaTeX/KaTeX/issues/2194.

Epub production surely is not the majority use case of KaTex, surely almost all usage is for html in browsers.

The additional file size seems like death by 1000 papercuts.

I feel similarly about the mathml namespace - it’s just unnecessary bytes for almost all recipients of it - see https://github.com/ronkok/Temml/issues/3 .

My proposal: We add XHTML / epub compliment output as an option at https://katex.org/docs/options.html , and exclude the mathml and svg namespaces as default? Thoughts?

Read more comments on GitHub >

github_iconTop Results From Across the Web

EPUB Output - MadCap Flare's Online Help
Following are some of the features of the EPUB format in Flare: Reflowable EPUB output allows for reflowable content, such as word wrap...
Read more >
EPUB Content Documents 3.2 - W3C
This specification defines profiles of HTML, SVG, and CSS for use in the context of EPUB® Publications.
Read more >
A look inside an EPUB file - Opensource.com
EPUB files are a great way to publish content using an open format. The EPUB file format is XML metadata with XHTML content,...
Read more >
EPUB Reading Systems 3.3 - W3C on GitHub
EPUB ® 3 defines a distribution and interchange format for digital publications and documents. The EPUB format provides a means of representing, ...
Read more >
Export InDesign documents to an EPUB format - Adobe Support
You can export a document or book as reflowable or fixed layout EPUB format. Do one of the following: Open the document and ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found