Link Search Menu Expand Document

Github Page

How to use LaTeX

kramdown is a free MIT-licensed Ruby library for converting text in one format to another, which is used in the page template. The following input and output formats are currently supported:

  • Input: kramdown (a superset of Markdown), Markdown, Github Flavored Markdown, HTML
  • Output: HTML, LaTeX, kramdown, RemoveHtmlTags (a special converter which removes HTML tags, normally used in conjunction with the LaTeX or kramdown converters)

MathJax is the default math engine of kramdown. As kramdown does not ship with the MathJax library, you can access MathJax with the following snippet at the beginning of your page:

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

where the center part

 MathJax = {
  chtml: {mathmlSpacing: true}
};

sets the mathmlSpacing option of the CHTML output in order to have MathJax use MathML spacing rules rather than TeX spacing rules. This document describes the ways of accessing MathJax more specifically.

By default, MathJax uses the LaTeX math delimiters, which are \\(...\\) for in-line math, and \\[...\\] for displayed equations. It also recognizes the TeX delimiters $$...$$ for displayed equations, but it does not define $...$ as in-line math delimiters. For examples:

\\(10^{2}\\), \(\frac{1}{2}\), $10^{2}$

$$10^{2}$$
\\[\sum a_{i}\\]

Outputs:

\(10^{2}\), (\frac{1}{2}), $10^{2}$

\[10^{2}\]

\[\sum a_{i}\]

This document provides more information about TeX and LaTeX support in MathJax.