# Mathjax Plone 5

Hi, everyone.
I'm trying to integrate mathjax in a new installed plone 5.0.6 portal.

• i've installed collective.mathjax via buildout
• activated the add-on in site control panel
but it doesn't work, a small waring appears a the bottom left of every page saying:

In the developer tools console of the browser appears
Failed to load resource: the server responded with a status of 404 (Not Found) http://plonesite.tld:8080/extensions/MathMenu.js

I would appreciate any help you can give me to make this work.

GC

Hi German,

What I did to integrate Mathjax was to add it directly in a custom theme.

You can make a copy of the Barceloneta Theme and in the index.html file add the following lines inside the header tag:

<script type="text/javascript" async
src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML">
</script>


you can also add mathjax configuration like:

<script type="text/x-mathjax-config">
MathJax.Hub.Config({
tex2jax: {inlineMath: [['$','$'], ['\$','\$']]}
});
</script>
<script type="text/javascript" async
src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML">
</script>


Not sure if this is the best way, but it works.

2 Likes

@gil Thank you very much for your help. It worked perfectly.
It's a pity that the add-on doesn't work properly. I'll fire an issue in the collective repo.

2 Likes

Slightly off topic: I need to add quite a bit of text with a lot of 'math'.
Unfortunately, it is written in Word.
Is there any smart way to 'convert' it 'to something useful' ?

1 Like

Add to where? How much text? Could you provide a sample file?

In case anyone has any interest in this:

Most of what I have tried does not do this 'properly', but it looks like using several 'tools', and then cutting and pasting a bit might do the trick.

Worth looking into:
pandoc
calibre
mathtype

I also plan to make epubs from Plone, so if anyone has any knowledge of how to use mathjax in epubs please let me know.

MathJax and EPUB?

Forget it - due to the lack of cross-device compatiblity.

You need to render MathML or LaTeX formula using MathJAX to bitmaps.

https://print-css.rocks/blog/2016-10-06/integrating-mathjax.html

-aj

1 Like

This is for students for a certain school, so if it would work in a few of the main readers, that would be ok.

That said: the javascript needs to be part of the epub , would be nice to give it a try anyway, as the bitmaps are not working properry (baselines are not correct, so it needs too much manual tweaking).

Is there anyone that could help me with reduce the size of mathjax ?
My knowledge of

is zero

Is it possible to make just one javascript file (I only need (La)TEX in and SVG out.

If anyone should be interested in this:

I got quite a lot of this working, and will continue working on it for a while.

Getting the math out of Word:
Mathtype does a pretty decent job of getting thing converted to latex.
It crashes a lot on OS X, especially if you forget to set the 'language' setting on export.
After exporting the content from Word, I still have to fix a few things , like two backslashes that should have been one.

Showing the math in Plone:
This is pretty straightforward when using mathjax.
If converting equations to images, it is difficult to 'keep the baseline",

Exporting to PDF.
This works quite well, both with pandoc and wkhtmltopdf, but some CSS is not working ( page-break-before is not working, while page-break-inside works). (Works on OS X Firefox, print to PDF)

Showing in epub.
I managed to shrink the JS to about 1,5 Mb.
The ebooks shows correctly in Calibre, iBooks (OS X) , Supreader (Android), Icecream Ebook Reader (Windows).
(but not in 'most others' FBReader etc).

1 Like

No you don't:
For PDF, at least phantomjs an wkhtml2pdf takes care of converting the math to vector.
Actually, for PDF conversion I have not found any LaTEX math that does not render well in PDF.

For epub, some reader (iBooks, Superreader ++) can display mathjax if you make and embed a smaller version of mathjax.

Plone Foundation Code of Conduct