GitHub Markdown Math Expression Support

GitHub has added support for writing and formatting mathematical expressions in markdown. A mathematical expression is a required feature if the project is related to data science, mathematician, and projects which depend on mathematical formulas.

GitHub now supports math expression rendering in markdown natively. So it will work everywhere on GitHub, like .md files, in GitHub issues, PR descriptions, Comments, etc.

MathJax is the library that is being used by GitHub for the rendering of math formulas. MathJax is a very popular library for showing math formulas. Starting in 2009, this MathJax is managed and maintained by the American Mathematical Society (AMS).

MathJax

You can check the full documentation for adding formula to markdown, provided by GitHub here: https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/writing-mathematical-expressions

Basic Rules

  • Inline expression starts and ends with a ‘$‘ sign.
  • Block expression starts and ends with a ‘$$‘ sign.
  • Other expressions provided by MathJax will be used whenever required. (Like \sqrt or \sum etc.)

Examples

Input (for inline): $a^2 + b^3+ c = 0$

Output:

Input (for inline): $\sqrt{a – b}+(c – d)^2$

Output:

Input (for block): $$ x = {-a \pm \sqrt{b^2-c} \over 2a} $$

Output:

Input (for block): $$\left( \sum_{k=1}^n a_k b_k \right)^2 \leq \left( \sum_{k=1}^n a_k^2 \right) \left( \sum_{k=1}^n b_k^2 \right)$$

Output:

Input: $\sqrt{\$4}$

Output:

For the full list of symbols/expressions check: https://www.onemathematicalcat.org/MathJaxDocumentation/TeXSyntax.htm#symbols

Check the documentation provided by GitHub, here: https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/writing-mathematical-expressions

Check the documentation provided by MathJax, check: http://docs.mathjax.org/en/latest/

Leave a Comment