Alex Zorn
Alex Zorn

Reputation: 247

Using MathJax on a Github Page?

I am asking a basic question here. I'm trying to figure out a simple and effective way of writing LaTeX-style formulas on a Github web page.

The top answer here suggests that MathJax is a possible solution.

This thread seems to imply MathJax isn't supported.

Personally, I've followed the directions Here, but the math equations aren't appearing.

Thoughts?

Upvotes: 13

Views: 7352

Answers (2)

nullromo
nullromo

Reputation: 2647

2022 Answer

MathJax is now natively supported when viewing .md files on GitHub. However, it is not automatically supported in GitHub Pages. To enable MathJax in GitHub Pages, the easiest option is to include the script from a CDN.

TAKE NOTE: the CDN has changed! The updated script tag to include is below. Add this script tag inside the <head/> of your _layouts/default.html file.

<script type="text/javascript" id="MathJax-script" async
  src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js">
</script>

For more information, read the MathJax Docs page about using a CDN.

Additional Help

If you want to use dollar signs (i.e. $1 + 2$) to escape math sequences, add the following as well:

<script>
  MathJax = {
    tex: {
      inlineMath: [['$', '$']]
    }
  };
</script>

see the docs for more information.

Upvotes: 9

Takeshi Ikeda
Takeshi Ikeda

Reputation: 49

you can use Mathjax on Github Page by adding next code in tag in your html code.

<script type="text/javascript" charset="utf-8" 
src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML,
https://vincenttam.github.io/javascripts/MathJaxLocal.js"></script>

I refered this page. https://vincenttam.github.io/blog/2014/11/09/mathjax-local-configuration-file/

Upvotes: 4

Related Questions