2018-10-17 04:51:09 +00:00
title: MathJax Plugin
date: 2018-01-01
2017-03-11 13:07:04 +00:00
categories:
2018-10-24 04:22:46 +00:00
- Plugins
- General
2017-03-11 13:07:04 +00:00
tags:
2018-10-17 04:51:09 +00:00
thumbnail: /gallery/math.jpg
2017-03-11 13:07:04 +00:00
---
< math xmlns = "http://www.w3.org/1998/Math/MathML" display = "block" > < mrow > < mi > f< / mi > < mrow > < mo > (< / mo > < mi > a< / mi > < mo > )< / mo > < / mrow > < / mrow > < mo > =< / mo > < mrow > < mfrac > < mn > 1< / mn > < mrow > < mn > 2< / mn > < mi > π < / mi > < mi > i< / mi > < / mrow > < / mfrac > < msub > < mo > ∮ < / mo > < mrow > < mi > γ < / mi > < / mrow > < / msub > < mfrac > < mrow > < mi > f< / mi > < mo > (< / mo > < mi > z< / mi > < mo > )< / mo > < / mrow > < mrow > < mi > z< / mi > < mo > − < / mo > < mi > a< / mi > < / mrow > < / mfrac > < mi > d< / mi > < mi > z< / mi > < / mrow > < / math >
2018-10-17 04:51:09 +00:00
### Configuration
2017-03-11 13:07:04 +00:00
To enable MathJax support, just set `plugins.mathjax = true` in your theme `_config.yml` file.
```yml
# Plugins
plugins:
...
mathjax: true # options: true, false
```
<!-- more -->
For further MathJax configurations, please edit `<theme folder>/layout/plugin/scripts.ejs` :
```html
< % if (theme.plugins.mathjax) { %>
<!-- Edit here -->
< script type = "text/x-mathjax-config" >
MathJax.Hub.Config({ tex2jax: { inlineMath: [['$','$'], ['\\(','\\)']] } });
< / script >
< %- js('https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML') %>
< % } %>
```
2018-10-17 04:51:09 +00:00
### TeX and LaTeX input
2017-03-11 13:07:04 +00:00
> Please be noted that when you write Tex/LaTeX in Markdown files, you need to use escape characters to prevent certain signs from being processed by Markdown interpreter.
2018-10-17 04:51:09 +00:00
##### Input
2017-03-11 13:07:04 +00:00
```
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}.$$
```
2018-10-17 04:51:09 +00:00
##### Result
2017-03-11 13:07:04 +00:00
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}.$$
2018-10-17 04:51:09 +00:00
### MathML input
2017-03-11 13:07:04 +00:00
> Attention: please be noted that newline characters will be transformed to `<br>` tag by Markdown interpreter and this will interfere with MathML notation. Please write all MathML inline.
2018-10-17 04:51:09 +00:00
##### Input
2017-03-11 13:07:04 +00:00
```
When< math xmlns = "http://www.w3.org/1998/Math/MathML" > < mi > a< / mi > < mo > ≠ < / mo > < mn > 0< / mn > < / math > , there are two solutions to < math xmlns = "http://www.w3.org/1998/Math/MathML" > < mi > a< / mi > < msup > < mi > x< / mi > < mn > 2< / mn > < / msup > < mo > +< / mo > < mi > b< / mi > < mi > x< / mi > < mo > +< / mo > < mi > c< / mi > < mo > =< / mo > < mn > 0< / mn > < / math > and they are
< math xmlns = "http://www.w3.org/1998/Math/MathML" display = "block" > < mi > x< / mi > < mo > =< / mo > < mrow > < mfrac > < mrow > < mo > − < / mo > < mi > b< / mi > < mo > ± < / mo > < msqrt > < msup > < mi > b< / mi > < mn > 2< / mn > < / msup > < mo > − < / mo > < mn > 4< / mn > < mi > a< / mi > < mi > c< / mi > < / msqrt > < / mrow > < mrow > < mn > 2< / mn > < mi > a< / mi > < / mrow > < / mfrac > < / mrow > < mtext > .< / mtext > < / math >
```
2018-10-17 04:51:09 +00:00
##### Result
2017-03-11 13:07:04 +00:00
When< math xmlns = "http://www.w3.org/1998/Math/MathML" > < mi > a< / mi > < mo > ≠ < / mo > < mn > 0< / mn > < / math > , there are two solutions to < math xmlns = "http://www.w3.org/1998/Math/MathML" > < mi > a< / mi > < msup > < mi > x< / mi > < mn > 2< / mn > < / msup > < mo > +< / mo > < mi > b< / mi > < mi > x< / mi > < mo > +< / mo > < mi > c< / mi > < mo > =< / mo > < mn > 0< / mn > < / math > and they are
< math xmlns = "http://www.w3.org/1998/Math/MathML" display = "block" > < mi > x< / mi > < mo > =< / mo > < mrow > < mfrac > < mrow > < mo > − < / mo > < mi > b< / mi > < mo > ± < / mo > < msqrt > < msup > < mi > b< / mi > < mn > 2< / mn > < / msup > < mo > − < / mo > < mn > 4< / mn > < mi > a< / mi > < mi > c< / mi > < / msqrt > < / mrow > < mrow > < mn > 2< / mn > < mi > a< / mi > < / mrow > < / mfrac > < / mrow > < mtext > .< / mtext > < / math >
2018-10-17 04:51:09 +00:00
### AsciiMath input
2017-03-11 13:07:04 +00:00
> Attention: please be noted that when you write AsciiMath in Markdown files, you need to use escape characters to prevent certain signs from being processed by Markdown interpreter.
2018-10-17 04:51:09 +00:00
##### Input
2017-03-11 13:07:04 +00:00
```
When \`a != 0\`, there are two solutions to \`ax^2 + bx + c = 0\` and they are< p style = "text-align:center" > \`x = (-b +- sqrt(b^2-4ac))/(2a) .\`</ p >
```
2018-10-17 04:51:09 +00:00
##### Result
2018-10-24 04:22:46 +00:00
When \`a != 0\`, there are two solutions to \`ax^2 + bx + c = 0\` and they are< p style = "text-align:center" > \`x = (-b +- sqrt(b^2-4ac))/(2a) .\`</ p >
< a style = "background-color:black;color:white;text-decoration:none;padding:4px 6px;font-size:12px;line-height:1.2;display:inline-block;border-radius:3px" href = "https://unsplash.com/@jeshoots?utm_medium=referral&utm_campaign=photographer-credit&utm_content=creditBadge" target = "_blank" rel = "noopener noreferrer" title = "Download free do whatever you want high-resolution photos from JESHOOTS.COM" > < span style = "display:inline-block;padding:2px 3px" > < svg xmlns = "http://www.w3.org/2000/svg" style = "height:12px;width:auto;position:relative;vertical-align:middle;top:-1px;fill:white" viewBox = "0 0 32 32" > < title > unsplash-logo< / title > < path d = "M20.8 18.1c0 2.7-2.2 4.8-4.8 4.8s-4.8-2.1-4.8-4.8c0-2.7 2.2-4.8 4.8-4.8 2.7.1 4.8 2.2 4.8 4.8zm11.2-7.4v14.9c0 2.3-1.9 4.3-4.3 4.3h-23.4c-2.4 0-4.3-1.9-4.3-4.3v-15c0-2.3 1.9-4.3 4.3-4.3h3.7l.8-2.3c.4-1.1 1.7-2 2.9-2h8.6c1.2 0 2.5.9 2.9 2l.8 2.4h3.7c2.4 0 4.3 1.9 4.3 4.3zm-8.6 7.5c0-4.1-3.3-7.5-7.5-7.5-4.1 0-7.5 3.4-7.5 7.5s3.3 7.5 7.5 7.5c4.2-.1 7.5-3.4 7.5-7.5z" > < / path > < / svg > < / span > < span style = "display:inline-block;padding:2px 3px" > JESHOOTS.COM< / span > < / a >