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!
Support for displaying math expressions has been a highly requested feature for over 8 years. From today, you can use the $ and $$ delimiters natively in Markdown on GitHub to insert math expressions in TeX and LaTeX style syntax. This content is then rendered using the highly popular MathJax library.
To insert in-line math use the $ symbol within a Markdown cell. For example, the text $this_{is}^{inline}$ will produce: t h i s i s i n l i n e .
You can now use LaTeX style syntax to render math expressions within Markdown inline (using $ delimiters) or in blocks (using $$ delimiters).
Mathematical formula We can use LaTeX to write mathematical equations in Markdown. To write inline LaTeX formula use a single $ before and after the equation and use a double $ to display equations.
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
![equation](https://latex.codecogs.com/gif.latex?1%2Bsin%28mc%5E2%29%0D%0A)
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
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
I wrote an article showing the steps, I hope it can help math divulgation: see Math on GitHub Pages.
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