Forum Samples, Tips and Tricks

Support for MathJax 3

mikeday
The latest build of Prince now supports MathJax 3!

mathjax.png

It requires a small compatibility script and there is an example of how to use it here:

https://github.com/yeslogic/prince-scripts/tree/master/compatibility/MathJax
  1. mathjax.png12.4 kB
mikebesso
Thanks Mike. This will be handy on my next project.
emperor
Hi Mike, after a long hiatus, I finally tried out the exact same MathJax example HTML with compat.js as described in the README.md, using the latest Prince 15.1 on Ubuntu 22.04 amd64.

This resulted in the following error and no MathJax formulas rendered:
$ prince --input=html test.html --javascript --output=test.pdf
prince: https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-svg.js:1: error: SyntaxError: unexpected token reserved("class")

Edited by emperor

0scr
Greetings! Having the same issue as 'emperor' here, is there any fix available for it? Using the latest version of Prince.
mikeday
Prince does not support classes in JavaScript yet and unfortunately MathJax is being packaged with another library (for audio speech?) that uses them; I think it may be necessary to use Babel or something like that to process the script first so that Prince can run it.