yeslogic / prince-scripts

Useful javascript helper scripts for Prince
MIT License
6 stars 6 forks source link

MathJax equations are not rendered #3

Open OpenFoam-User opened 2 years ago

OpenFoam-User commented 2 years ago

Hello

I have tried your example here: https://github.com/yeslogic/prince-scripts/tree/master/compatibility/MathJax (I have used your html input, and downloaded also the compat.js file)

I have Prince 14.2 installed on Ubuntu 20.04.

When I convert it using the following command:

prince --javascript input.html -o output.pdf

The resulting pdf doesn't render Mathjax:

image

Thanks

adrianwong commented 2 years ago

Hi @SignificantCell2,

If I recall correctly, version 14.2 did not yet support MathJax 3. Prince should have printed an error, something like:

MathJax(?): undefined value is not an object

Could you try one of the latest builds?

OpenFoam-User commented 2 years ago

Hi thank you for your reply. You're right, I get it working with the latest builds of Prince! But the end result (the equation) are not selectable in the output PDF document.

adrianwong commented 2 years ago

That's because the example uses the SVG output processor, and not the CommonHTML one. Replacing:

<script id="MathJax-script" src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-svg.js"></script>

with

<script id="MathJax-script" src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-chtml.js"></script>

should make the equations selectable (for a certain definition of selectable).