Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert MathJax to SVG for epub using (gulp-)mathjax-node #198

Closed
arthurattwell opened this issue Nov 11, 2017 · 4 comments · Fixed by #328
Closed

Convert MathJax to SVG for epub using (gulp-)mathjax-node #198

arthurattwell opened this issue Nov 11, 2017 · 4 comments · Fixed by #328
Assignees

Comments

@arthurattwell
Copy link
Member

Epub readers that support Javascript well can render MathJax just fine (surprisingly, Adobe Digital Editions). But other readers can't, including Kindle via Kindlegen.

We might be able to include a processing step using mathjax-node or gulp-mathjax-node to turn the maths into PNG (using mathjax-node) or SVG (using gulp-mathjax-node, which doesn't provide PNG rendering).

@arthurattwell
Copy link
Member Author

We may also need mathjax-node-svg2png.

@arthurattwell
Copy link
Member Author

arthurattwell commented Oct 26, 2018

Good progress on this in this branch.

So far, I have math working in PDF on Windows without PhantomJS. The output script uses gulp + mathjax-node-page to convert TeX to MathML before passing the HTML to Prince. It's much faster than using PhantomJS and the rendered math looks better. We'll need lots of testing in the wild to see where and whether we encounter issues with fonts.

Still to do:

  • use gulp + mathjax-node-page in epub and app outputs, so that we don't need the MathJax JS in those packages (I also need to find out what MathML support is like in ereaders; if it's low, we may still need the embedded MathJax option available, or try getting maths and PNG from mathjax-node-page).
  • replace the PhantomJS step with gulp + mathjax-node-page in the OSX and Linux output scripts.

@arthurattwell arthurattwell self-assigned this Oct 26, 2018
@arthurattwell
Copy link
Member Author

Work-in-progress notes:

  • Epub reader support for MathML is spotty and largely untested. So we will need to either use MathJax with SVG or use mathjax-node to render PNGs. PNGs may not be practical because we'd have to somehow add them to the epub manifest on the fly. So I think we'll stick with our MathJax+TeX/MML+SVG approach.
  • I didn't realise Chrome had dropped support for MathML. This means that for web and app outputs we still need MathJax. We could use the same local MathJax we use for epub, but for web output, provide an easy way to switch to the CDN version with HTML+CSS MathJax output for prettier maths online.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant