Mathjax support on github with a Chrome browser plugin?

I would like Mathjax to work on all my github pages (e.g. Markdown displayed on github, release tracking). I have many files created by R Markdown that also have equations.

Although I would like github to provide additional support for Mathjax, I thought that a more realistic goal would be to have some kind of browser plugin that detects that I am on the github page and runs the mathjax script automatically.

  • Are there any browser plugins for the Chrome browser that automatically run the MathJaX script at the specified URLs (e.g. http*github* )?

Initial thoughts

Here's a pretty long discussion of MathOverflow . However, the discussion includes a discussion of a number of technologies (not just MathJax), and many of the solutions are specific to the Firefox browser.

+6
github r mathjax
Jun 29 '12 at 4:01
source share
1 answer

Here is a GreaseMonkey script that should do what you want: Run MathJax on Github . It should work in all major browsers (although some of them need plugins to run GreaseMonkey scripts, see the installation instructions for this question for details).

This script only loads MathJax into pages containing TeX or MathML markup (this is a very simple test for this, which can certainly be made more complex). Note that the default delimiters are \(...\) for embedded math and \[...\] or $$...$$ for math displayed. In particular, single dollars cannot be used as mathematical separators (since they occur too often in a regular non-mathematical text). If you want to enable one-dollar separators, you will need to edit the script to add the MathJax script configuration before loading MathJax.js itself.

The script is installed on the trigger at http://github.com/* and https://github.com/* . Not all GreaseMonkey implementations provide pattern matching in the main part of the URL, but if you do, you can make it more complex so that it also gets github subdomains.

Hope that does what you need.

Change The script now includes $...$ for inline math, as asser requested.

+4
Jul 01 2018-12-12T00:
source share



All Articles