I'd like Mathjax to work on all my github pages (e.g., Markdown displayed on github, issue trackers). I have a lot of files generated from R Markdown that also have equations.
While I'd love github to provide optional support for Mathjax, I thought a more realistic aim would be to have some browser plugin that detects that I'm on a github page and automatically runs the mathjax script.
http*github*
)?There's quite a long discussion on MathOverflow. However, the discussion includes discussion of a range of technologies (not just MathJax) and many of the solutions are specific to the Firefox browser.
GitHub supports Latex/MathJax since May 2022.
you can use Mathjax on Github Page by adding next code in tag in your html code. sorry, adding code is "vincenttam.github.io/javascripts/MathJaxLocal.js" after cdn.mathjax.org/mathjax/latest/…
MathJax is an open-source JavaScript display engine for LaTeX, MathML, and AsciiMath notation that works in all modern browsers.
Here is a GreaseMonkey script that should do what you want: Run MathJax in Github. It should work in all the major browser (though some need plugins to run GreaseMonkey scripts; see the installation instructions for this question for details).
This script only loads MathJax on pages that contain TeX or MathML markup (it does a very simple test for that, which certainly could be made more sophisticated). Note that the default delimiters are \(...\)
for in-line math and \[...\]
or $$...$$
for displayed math. In particular, single-dollars aren't enable as math delimiters (since they occur too frequently in ordinary non-math text). If you wanted to enable single-dollar delimiters, you would need to edit the script to add a MathJax configuration script prior to loading MathJax.js itself.
The script is set to trigger on http://github.com/*
and https://github.com/*
. Not all the GreaseMonkey implementations provide for pattern matching in the host part of the URL, but if yours does, you can make it more sophisticated so that it will get subdomains of github as well.
Hope that does what you need.
Edit: The script now enables $...$
for in-line math, as requested by the asker.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With