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 Rendering #160

Open
Alekseyyy opened this issue May 3, 2017 · 24 comments
Open

Mathjax Not Rendering #160

Alekseyyy opened this issue May 3, 2017 · 24 comments

Comments

@Alekseyyy
Copy link

Hey there! For some reason, I can't get MathJax text to render (I highlighted an example in the screenshot below). Tried to do an 'apt purge remarkable' and a 'dpkg -i remarkable.deb' but it doesn't seem to work. Can anyone help me solve this, thanks ^_^
remarkable-not-rendering-mathjax

@aphirst
Copy link

aphirst commented May 15, 2017

I'm experiencing what I think is the same issue. Specifically, inline text ($math here$) does not render, but $$goes on a new line$$ does. I'm an Arch user so it's possible that the issue is due to some updated library, but neither do I keep logs of this, nor does Remarkable output anything to the terminal to suggest that there's anything wrong.

@aphirst
Copy link

aphirst commented May 15, 2017

@mathmare Does it at least work for you when you $$goes on its own line$$ expressions?

@aphirst
Copy link

aphirst commented May 15, 2017

I think I know what's going on here.

https://github.com/jamiemcg/Remarkable/blob/master/remarkable/RemarkableWindow.py#L87
Here is a reference to a MathJax URL which presumably pertains to the rendering of these inline statements, the URL being:
https://cdn.mathjax.org/mathjax/latest/MathJax.js

However if one visits that URL, and reads what's visible there, one notices this line:

    console.warn('WARNING: cdn.mathjax.org has been retired. Check https://www.mathjax.org/cdn-shutting-down/ for migration tips.')

I think that says it all. Remarkable needs to be updated in accordance with the advice visible on that final page, which is basically either to use a MathJax instance from a different CDN provider, or instead to use MathJax locally.

@aphirst
Copy link

aphirst commented May 15, 2017

I just tested whether simply changing the URL on that line to one of the new MathJax CDNs fixes this issue, and it seems that it does, so that can be considered a workaround for now. However, I'm kind of surprised that the Internet is involved at all in this process - I would have expected this to all be done locally.

At least for Arch users, there is a mathjax package in the main repositories, which (if I understand correctly) seems to work without any special configuration (other than pointing to the correct local files from the HTML page to be rendered, which seems to be standardised as

/usr/share/mathjax/latest.js

, as the built in test .html files from their git repo render equations fine with my installed copy with no modifications necessary).

Is there some reason for doing it online, @jamiemcg ?

(as a side comment, I wonder why $$these$$ equations were working fine, and only $these$ were affected...)

@Alekseyyy
Copy link
Author

oh yeah I fixed it now, thanks!

@emilhe
Copy link

emilhe commented May 21, 2017

I am experiencing the same issue. How did you, @mathmare , apply this fix? Did you build from sources or did you path your local installation? In any case, could you elaborate on the process and/or provide links to relevant documentation?

Answer: The fix can be applied simply by replacing the URL in the local copy of the remarkable python package which is located in the /dist-packages/remarkable folder of your Python installation.

@aphirst
Copy link

aphirst commented May 21, 2017

@emilhe Exactly right, that's what I did locally while waiting for an upstream solution (for example, the simple fix in my PR). I've still not tested whether you can also "easily" point to a local MathJax installation... Maybe I will get around to that when I have some more time.

@etveritas
Copy link

@emilhe Yeah,it works when I replace URL to https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/MathJax.js?config=TeX-MML-AM_CHTML in the https://github.com/jamiemcg/Remarkable/blob/master/remarkable/RemarkableWindow.py#L87
file in lines 87.

@xspkwy
Copy link

xspkwy commented Nov 1, 2017

@jiww I have changed the original URL https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML to https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/MathJax.js?config=TeX-MML-AM_CHTML, but when I restart remarkable, it doesn't work.
Should I also change the first URL in lines 87 in the file or something else?
Thanks!

@etveritas
Copy link

@xspkwy Does it work now?You can try to change the url in the file on line 87 on your computer.

@xspkwy
Copy link

xspkwy commented Nov 2, 2017

@jiww I'm sorry but it didn't work, and I don't know why.
I changed line87 from
self.default_html_end = '<script src="http://cdnjs.cloudflare.com/ajax/libs/highlight.js/8.1/highlight.min.js"></script><script>hljs.initHighlightingOnLoad();</script><script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script><script type="text/javascript">MathJax.Hub.Config({"showProcessingMessages" : false,"messageStyle" : "none","tex2jax": { inlineMath: [ [ "$", "$" ] ] }});</script></body></html>'
to
self.default_html_end = '<script src="http://cdnjs.cloudflare.com/ajax/libs/highlight.js/8.1/highlight.min.js"></script><script>hljs.initHighlightingOnLoad();</script><script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/MathJax.js?config=TeX-MML-AM_CHTML"></script><script type="text/javascript">MathJax.Hub.Config({"showProcessingMessages" : false,"messageStyle" : "none","tex2jax": { inlineMath: [ [ "$", "$" ] ] }});</script></body></html>'
was there anything wrong?

@etveritas
Copy link

@xspkwy In my system,the file is in "/usr/lib/python3/dist-packages/remarkable/RemarkableWindow.py".Did you modify it?

@xspkwy
Copy link

xspkwy commented Nov 3, 2017

Yes, the same path. I don't know why.
Anyway, I find Typora great and I will use it.
Thanks~

@Dubrzr
Copy link

Dubrzr commented Feb 10, 2018

If you are using cloudflare, disable the "Rocket Loader" Speed option.

@eciii
Copy link

eciii commented Apr 5, 2018

Please note that this might not be the actual solution of the problem. The real problem here is that the inline configuration of MathJax is being defined after the loading of the MathJax file via CDN. The MathJax documentation explicitly states that the inline configuration should be defined before the loading of the MathJax file: see https://docs.mathjax.org/en/latest/configuration.html#using-in-line-configuration-options. I guess the problem started to appear because after the shut down of the old CDN the MathJax library takes more time to load and thus the inline configuration was never read.

On the other hand just writing the inline configuration before the script tag that loads the MathJax file but leaving it as it is right now will throw a javascript error because the MathJax object is not yet defined. It is necessary to define the configuration in the global window object as explained here: https://docs.mathjax.org/en/latest/configuration.html#using-plain-javascript.

All in all, the infamous line 87 in the RemarkableWindow.py file should read:

self.default_html_end = '<script src="http://cdnjs.cloudflare.com/ajax/libs/highlight.js/8.1/highlight.min.js"></script><script>hljs.initHighlightingOnLoad();</script><script type="text/javascript">window.MathJax = {"showProcessingMessages" : false,"messageStyle" : "none", "tex2jax": {"inlineMath": [ ["$","$"] ]}};</script><script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.4/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script></body></html>'

where a decision has to be made on wether a fixed version of MathJax is going to be used (in this case version 2.7.4) or just the latest version.

@csbenz
Copy link

csbenz commented Apr 9, 2018

I'm on Lubuntu 17.10 running Remarkable 1.87 and replacing the line 87 doesn't work. Remarkable doesn't launch anymore after changing the line.

@eciii
Copy link

eciii commented Apr 10, 2018

@csbenz I have the exact same line that I posted before and I'm also running Remarkable v. 1.87 but on a Debian stretch machine. It works as expected. Have in mind that you should paste the above line leaving 8 blank spaces at the beginning in order to have the same indentation as the surrounding lines. If that's not the problem my guess is that your problem isn't located at line 87.

@csbenz
Copy link

csbenz commented Apr 10, 2018

@eciii I had left a tab at the beginning of the line instead of 8 blank spaces. Problem solved! Thank you.

@jacksonloper
Copy link

is this still an issue? i'm certainly still experiencing it? confused about what the solution is.

@johnblommers
Copy link

Remarkable 1.8.7 installed via Snap won't render either inline or display LaTeX formulas on my Ubuntu 19.10 system.

@eindiran
Copy link

I was still having the issue where inline MathJax expressions wouldn't render with the 1.87 version of the .deb package on Ubuntu 18.04; running the version in master via run.sh, the problem is fixed.

@ghost
Copy link

ghost commented Apr 16, 2020

Can confirm this issue on: Ubuntu 18.04.4 LTS and Kubuntu 19.10

@megodoonch
Copy link

This is still a problem for me on Ubuntu 20.04.2 LTS, running Remarkable version 1.87 (latest version).

@jaghili
Copy link

jaghili commented Mar 12, 2022

Had the same problem with Remarkable 1.87 installed on Arch. I fixed it by replacing https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML with https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS-MML_HTMLorMML in the file /usr/lib/python3.10/site-packages/remarkable/RemarkableWindow.py around line 40.

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

No branches or pull requests