When I write an R markdown file in RStudio and Knit HTML
, my formulas (inline using $..$ or display using $$..$$) can be displayed properly. However, when I push my .md file to GitHub, these formulas cannot be displayed. They only show $..$ and $$..$$. Is there a way to let GitHub know how to parse latex formulas? Thanks!

- 10,616
- 23
- 67
- 107
-
5No. Github does not support Mathjax, except in their Wikis. The only alternative is to generate your HTML locally using jekyll and pushing it to github. – Ramnath Sep 19 '12 at 20:46
-
GitHub supports [Latex/MathJax since May 2022](https://stackoverflow.com/a/72310304/6309). – VonC May 19 '22 at 19:48
2 Answers
Is there a way to let GitHub know how to parse latex formulas?
Some sites provide users with a service that would fit your need without any javascript involved: on-the-fly generation of images from url encoded latex formulas.
given the following markdown syntax

it will display the following image
Note: In order for the image to be properly displayed, you'll have to ensure the querystring part of the url is percent encoded. You can easily find online tools to help you with that task, such as www.url-encode-decode.com
-
-
By using `svg.latex` in the link, you get a nice `SVG` image file. – Dylan Richard Muir Feb 21 '17 at 13:11
I also looked for how to render math on GitHub pages, and after a long time of research I found a nice solution.
I used KateX to render formulas server side: it is really faster than MathJaX.
Please note that same solution could be arranged to work also client side, but, I prefer server side rendering, cause
- you know your server environment, but you don't know the client environment of your visitors
- it is also faster client side, if the formulas are rendered on the server, only once.
I wrote an article showing the steps, I hope it can help math divulgation: see Math on GitHub Pages.

- 3,303
- 1
- 32
- 20