Forum Samples, Tips and Tricks

Support for MathJax 3

The latest build of Prince now supports MathJax 3!


It requires a small compatibility script and there is an example of how to use it here:
  1. mathjax.png12.4 kB
Thanks Mike. This will be handy on my next project.
Hi Mike, after a long hiatus, I finally tried out the exact same MathJax example HTML with compat.js as described in the, 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: error: SyntaxError: unexpected token reserved("class")

Edited by emperor

Greetings! Having the same issue as 'emperor' here, is there any fix available for it? Using the latest version of Prince.
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.
It is still possible to access older version of mathjax from CDN, the latest version that still supported by Prince is