Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mathjax not working with learn2 #5

Closed
abilbaotm opened this issue Oct 19, 2016 · 12 comments
Closed

mathjax not working with learn2 #5

abilbaotm opened this issue Oct 19, 2016 · 12 comments

Comments

@abilbaotm
Copy link

Hi!
I installed learn2 theme and mathjax plugin. But mathjax seems not to be working.
captura de pantalla 2016-10-19 a las 22 05 19
Any suggestion to debug or knowledge?

Regards.

@Sommerregen
Copy link
Owner

Hi @abilbaotm ,

don't know why it is not working. It may that Grav core API has changed a bit in the last releases. Will test it in the next days.

In general, MathJax works if the following settings enabled: true and active: true are satisfied. Can you tell me, which Grav version you are using?

@abilbaotm
Copy link
Author

I have recreated this issue again and seems to be working. Maybe some update?.
The version of Learn2 installed and working for me is v1.6.0 and Grav v1.1.5

Anyway, thanks for your attendance @Sommerregen

@Sommerregen
Copy link
Owner

Hi @abilbaotm ,

sorry for my silence. I had some problems in setting up a new machine and testing environment. To be clear, is the issue solved? It is unclear for me from your writing... However I tested with Grav v1.1.8 and MathJax v1.5.0 and didn't encounter the issue.

@abilbaotm
Copy link
Author

abilbaotm commented Nov 8, 2016

Yea, the issue is solved.

Thanks @Sommerregen

@jberr
Copy link

jberr commented Jun 22, 2017

Hi!

I am experiencing the same problem with the latest version of learn2 v1.6.3. I have installed MathJax v1.5.1 via the Admin Panel v1.4.2 (have tried manually as well). I have checked the console in Chrome and I'm getting the following 404 access errors when the plugin is trying to GET:

http://roymechi.co.uk/jax/input/TeX/config.js?V=2.7.1
http://roymechi.co.uk/extensions/tex2jax.js?V=2.7.1
http://roymechi.co.uk/extensions/MathMenu.js?V=2.7.1
http://roymechi.co.uk/extensions/MathZoom.js?V=2.7.1

Both enabled: true and active: true are set globally in the Admin Panel.

My site is HTTPS, could that be causing an issue?

screenshot1
screenshot2

Regards, J

@Sommerregen
Copy link
Owner

Hi @jberr ,

first of all I assume you have changed the cdn.url option (link) otherwise I don't where your links are coming from. Second, just clicking on http://roymechi.co.uk/extensions/tex2jax.js?V=2.7.1 for example redirects me to a Grav offline site (that is not JS). Apparently, there exists no file http://roymechi.co.uk/extensions/tex2jax.js (and the same for the others). If you want to use MathJax locally, you need to download and extract it somewhere on your webserver and adjust the already mentioned cdn.url option. Otherwise please stick to the default "https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML". Can you check your issue using the default settings?

@jberr
Copy link

jberr commented Jun 22, 2017

Hi @Sommerregen ,

Firstly thanks so much for replying!

My mathjax.yaml settings are as follows:

# Global plugin configurations
enabled: true # Set to false to disable this plugin completely
active: true # Enable or disable this plugin for a page
built_in_css: true # Use built-in CSS of the plugin
built_in_js: true # Use built-in JS of the plugin
weight: -5 # Set the weight (order of execution)

# Default values for MathJax configuration
CDN:
enabled: true # Use MathJax Content Delivery Network (CDN)
url: https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML

I haven't changed any other settings other than adding the tablesorter plugin. I disabled my HTTPS certificate (dreamhost letsenrcypt) but have since re-enabled it as it made no difference.

I did actually install MathJax locally to see if it made a difference but it did not, so I switched the CDN back on and the settings back to as above.

Thanks,
J

@jberr
Copy link

jberr commented Jun 22, 2017

I have switched off maintenance mode so you can see the issue at http://roymechi.co.uk/advanced/adv-topic-1

@jberr
Copy link

jberr commented Jun 23, 2017

Hi @Sommerregen ,

Just to clarify, I am using the default settings for both MathJax and the Learn2 theme. I have not modified anything to generate the links that are pointing to my local domain, I expected them all to be external and using the CDN. These locations do not exist on my web server.

Thanks for all your help @Sommerregen

@Sommerregen
Copy link
Owner

Dear @jberr ,

I can clearly see that MathJax is processed (i.e., look at the source code and search for <p class="mathjax mathjax--block">). However the JS seems to be missing. There is no url pointing to https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML . That's why MathJax is not processed in the browser.

However, I don't get the error messages you got, mine is working, and I don't think Tablesorter Plugin is the problem here. It might be an assets collection issue from Grav core itself as I see you pipeline all assets into one css or js file. The first thing is to switch this behaviour off and see whether the issue still persists. It might be that some latest changes in Grav cause the issue (I know there where some latest commits or at least one bug with external assets).

@jberr
Copy link

jberr commented Jun 26, 2017

Hi @Sommerregen ,

Thank you for looking in to this, I have set js_pipeline: false in the user/config/system.yaml file. MathJax is now loading from the CDN and the equations are displaying correctly!

It seems the Learn2 skeleton enables this setting by default. I am a bit new to this and I did not realise this would have an effect on it. What can I do re-enable the JS asset pipeline and include MathJax? There are a number of options shown in https://learn.getgrav.org/themes/asset-manager, I'm not sure which one is best to add the CDN path.

Kind regards,
@jberr

@Sommerregen
Copy link
Owner

Hi @jberr ,

Glad you solved it. First of all, please file a bug in the Grav core repository and reference this issue. It is related to the assets.js_pipeline_include_externals setting. Switching this option off, you can safely enable js_pipeline again.

Kind regards,
Sommerregen

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants