# [SOLVED] ckeditor mathjax plugin

## Recommended Posts

I'm really not able to get this working!

The first time with latest version, than i tried 4.10 version which should be the version in processwire at the moment.

I edited the field Body and turned on all the plugins, plus i added the Mathjax to the toolbar.

I have also 'config.mathJaxLib = '//cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.4/MathJax.js?config=TeX-AMS_HTML';', in config.js.

And i added the script to show formula on pages.

The fact is that i get the the botton on the toolbar, i get formulas viewed on pages but in the editor they don't show up.

It's blank in editor when i insert a formula. Also in the formula windows i don't get the preview.

It's really not working the editing part, is able to insert it as an object, but is not able to reproduce in the editor.

##### Share on other sites

Hi and welcome,

3 hours ago, procnewie said:

The fact is that i get the the botton on the toolbar, i get formulas viewed on pages but in the editor they don't show up.

It's blank in editor when i insert a formula. Also in the formula windows i don't get the preview.

You likely have an issue with document encoding (while pasting the url in the config.js file), you can check it in the Network tab of your browser developer tool, 404 error happen for sure, try recopying from here or write the url by hand :

config.mathJaxLib = '//cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.4/MathJax.js?config=TeX-AMS_HTML';

Error diff from your previous "pasted" line :

Result:

##### Share on other sites

Nevermind. Thank you anyway since you pointed me in the right direction.

Opening the console and loading the page showed me an error saying that mathjax was missing the configuration.

So i went again to configuration file and i discovered that if some-config.js exist, options in config.js are ignored...
So i moved the conf from config.js to config-body.js and now is working.

Is really really slow thought.

##### Share on other sites

1 minute ago, procnewie said:

Is really really slow thought.

Then download it from the cdn server and load the file locally.

1 minute ago, procnewie said:

options in config.js are ignored...

Nah, you had a typo in your url 😉

##### Share on other sites

On Chrome it's fast.

On Firefox console i get a lot of errors related to a missing  header CORS “Access-Control-Allow-Origin” .

I guess that will slow down a bit things since there a lot of related to http://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.4/fonts/HTML-CSS/TeX/otf/MathJax*.otf

Even if i'm not really sure where those links come from... They are not in my sources anywhere...

##### Share on other sites

And if i local the library, it doesn't work at all.

Even if i see in the development console that the file is loaded fine.

##### Share on other sites

I was able to use it via AdminOnSteroids module,even though displaying it on the frontend was tricky as I remember.

##### Share on other sites

I'm sorry that i can not edit my previous posts.

The firefox issue is documented in mathjax. I need to set something in my web server to solve it.

I really don't like to use a cdn, but including a local versionl seems more than just the simple javascript file.

About the AdminOnSteroids, i'm not sure i would load such a thing only to get mathjax.

##### Share on other sites

To use it locally it's simple.

Download Mathjax from Github and extract the following file and folders from the downloaded archive into the CKEditor Mathjax plugin dir :

Left panel =  CKEditor mathjax plugin dir  /  Right panel = Mathjax downloaded folder

• Modify your config.js (or config-body.js)

before :

config.mathJaxLib = '//cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.4/MathJax.js?config=TeX-AMS_HTML';

after :

config.mathJaxLib = ProcessWire.config.urls.root + 'site/modules/InputfieldCKEditor/plugins/mathjax/MathJax.js?config=TeX-AMS_CHTML';

Note :  on the config line, the config get value (?config=TeX-AMS_CHTML) need to be the name of one config file existing under the mathjax/config dir.

Refresh your page and voila.

• 2
##### Share on other sites

Thank you! Is working just perfectly! 😀

• 1
##### Share on other sites

• 2 years later...

Hello guys,
I am trying to integrate mathJax but I cannot get it show in the toolbar. Can you share the steps that you are following? I started from here https://ckeditor.com/cke4/addon/mathjax, but I cannot get it to be displayed in my editor.

Thanks!

## Create an account or sign in to comment

You need to be a member in order to leave a comment

## Create an account

Sign up for a new account in our community. It's easy!

Register a new account