-
Notifications
You must be signed in to change notification settings - Fork 1
Math support
In _config.yml, add the following lines (from)
# Build settings
markdown: kramdown
Create a file named mathjax.html in the _include directory as follows (from part 3 in tutorial). (Note the inclusion of STIX fonts enables the \\llbracket) and \\rrbracket symbol definitions. This is using the older MathJax 2, because MathJax v3 does not support the fonts. However, v4 will do so but is still in beta phase .)
The xr, as, dm and va macros are used for M-layer notation.
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
"HTML-CSS": { fonts: ['STIX-Web'] },
SVG: {font: 'STIX-Web'},
TeX: {
equationNumbers: {autoNumber: "AMS"},
Augment: {
Definitions: {
delimiter: {
'\\llbracket': '27E6',
'\\rrbracket': '27E7'
}
}
},
Macros: {
xr : ['{ \\llbracket #1 \\rrbracket }', 1],
as : ['{ \\langle #1 \\rangle }', 1],
dm : ['{ [ #1 ] }', 1],
va : ['{ \\{ #1 \\} }', 1]
}
},
tex2jax: {
inlineMath: [ ['$','$'], ['\\(', '\\)'] ],
displayMath: [ ['$$','$$'], ['\\[', '\\]'] ],
processEscapes: true,
}
});
</script>
<script type="text/javascript" async src="https://cdn.jsdelivr.net/npm/mathjax@2.7.9/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
Update file _include/head.html, include the above template file.
{% if page.mathjax %}
{% include mathjax.html %}
{% endif %}
In order to use the math formula in markdown page, it must have a variable mathjax which is set to true.
For example,
---
layout: tutorial
title: "Using MathJax in Jekyll"
date: 2018-07-10
tags: [MathJax, Mathematic]
mathjax: true
---
On the top of the posts that you’d like to add mathjax support (it’s called the YAML ‘‘front matter’’) , add the following line:
usemathjax: true
Note the following:
- The inline formula is between
$ ... $. - The display formula is between
$$ ... $$or\[and\]. However, a leading escape\seems necessary in markdown for\[. - You can use the math envrionment directly, for example,
\begin{equation}...\end{equation}or\begin{align}...\end{align}. - Whenever in the inline math or display math, the star character
*must be escaped. - In the multi-lines display math, the line break symbol double-backslash
\\should be escaped, i.e., use four backslash\\\\.