Files
site/themes/minimo/exampleSite/content/docs/mathjax-support.md
2021-09-06 13:02:12 -04:00

2.4 KiB

date, lastmod, title, authors, categories, tags, slug, mathjax
date lastmod title authors categories tags slug mathjax
2018-02-27T18:00:00+06:00 2019-09-28T21:00:00+06:00 MathJax Support
muniftanjim
features
config
mathjax-support true

For enabling MathJax, add this to your content's frontmatter:

---
mathjax: true
---

MathJax Syntax for Markdown

In your Markdown content, use \\(...\\) delimiters for in-line mathematics.

For mathematics blocks you can use either $$...$$ or \\[...\\] as delimiters.

Here's an example Markdown content:

When \\( a \ne 0 \\), there are two solutions to

$$ ax^2 + bx + c = 0 $$

and they are:

\\[ x = {-b \pm \sqrt{b^2-4ac} \over 2a} \\]

Output:

When \( a \ne 0 \), there are two solutions to

ax^2 + bx + c = 0

and they are:

\[x = {-b \pm \sqrt{b^2-4ac} \over 2a}\]

Customize MathJax Configuration

You can customize the default behavior of MathJax if you want.

Minimo picks up configuration for MathJax from the /data/config/mathjax.json file.

The default configuration options look like this:

{
  "library": {
    "path": "//unpkg.com/mathjax@2.7.5/MathJax.js",
    "config": "TeX-MML-AM_CHTML"
  },
  "config": {}
}
  • library [Object]:
    • path [String]: URL for the main MathJax.js file.
    • config [String]: Configuration file's name/path
  • config [Object]:
    • In-line configuration options

So, if you want to tinker with it's configuration options:

  • Create a /data/config/mathjax.json file in your site's repository
  • Copy the default configuration options
  • Start hacking

For exmaple, if you want to enable $...$ delimiters for in-line mathematics, you probably want something like this:

{
  "library": {
    "path": "//unpkg.com/mathjax@2.7.5/MathJax.js",
    "config": "TeX-MML-AM_CHTML"
  },
  "config": {
    "tex2jax": {
      "inlineMath": [["$", "$"], ["\\(", "\\)"]],
      "processEscapes": true
    }
  }
}

Notice

MathJax version above 2.7.5 is not guaranted to work.