Introduction to MathJax!

Introduction to MathJax!

Jason-JP-Yang

Mathjax 从入门到入土 | Introduction of MathJax rendering - inline math, display math, line breaks, equation numbering, matrices, tables, cases, and complex formulas.

Figure 1. MathJax Rendering

MathJax is an open-source JavaScript display engine for LaTeX, MathML, and AsciiMath notation that works in all modern browsers, with built-in support for assistive technology like screen readers, including automatic speech generation and an expression explorer that can be used to investigate typeset mathematics on a more granular level than the complete expression. It requires no setup on the part of the user (no plugins to download or software to install), so the page author can write web documents that include mathematics and be confident that users will be able to view it naturally and easily. Simply include MathJax and some mathematics in a web page, and MathJax does the rest.

See http://www.mathjax.org/ for additional details about MathJax, and https://docs.mathjax.org for the MathJax documentation.

使用MathJax时,需要用一些适当的标记告诉MathJax某段文本是公式代码。此外,MathJax中的公式排版有两种方式,inline和displayed。inline表示公式嵌入到文本段中$...$,displayed表示公式独自成为一个段落$$ \n...\n $$

Hexo-theme-Redefine-X配备的Mathjax v4.1.1支持以single $和double $$作为Mathjax标识符。

1. Inline Math 行内公式

Here are some examples of the Inline Math

The quadratic formula is <!--mathjax:0:inline:sp-->, where

.

Euler’s identity: . And here is a subscript test: .

Greeek Letters

Lowercase Greek letters: , , , .

You may take reference to following latex:

1
\alpha, \beta, \gamma, \delta, \epsilon, \varepsilon, \zeta, \eta, \theta, \vartheta, \iota, \kappa, \lambda, \mu, \nu, \xi, o, \pi, \varpi, \rho, \varrho, \sigma, \varsigma, \tau, \upsilon, \phi, \varphi, \chi, \psi, \omega

For uppercase Greek letters, some of them can directly represented by the English capital letters. Uppercase Greek Letters with latex: , .

You may take reference to following latex:

1
\Gamma, \Delta, \Theta, \Lambda, \Xi, \Pi, \Sigma, \Upsilon, \Phi, \Psi, \Omega

Some variations of Greek letters: , , .

You may take reference to following latex:

1
\hbar, \imath, \jmath, \ell, \Re, \Im, \aleph, \beth, \gimel, \daleth, \wp, \mho, \backepsilon, \partial, \eth, \complement, \Bbbk, \circledS, \S

2. Display Math 行间公式

Font Types

Use \mathbb or \Bbb to display blackboard bold characters. This font is often used to represent real numbers, integers, rational numbers, and complex numbers.

Use \mathbf to display bold text

Use \mathrm to display Roman fonts

Use \mathscr to display cursive fonts

Use \mathfrak to display Fraktur letters (a type of German font)

Use \mathtt to display printer fonts

3. Line Breaks with \\ 换行测试

Sometimes, it might be necessary to align the equal signs in a series of formulas, such as:

At this point, a format like \begin{align}... \end{align} is required. Within this format, & is used to indicate the positions where alignment is needed.

4. Equation Numbering 公式编号

1
2
3
4
5
$$
\begin{equation}
E = mc^2 \tag{1}
\end{equation}
$$
1
2
3
4
5
$$
\begin{equation}
i\hbar \frac{\partial}{\partial t} \Psi(\mathbf{r}, t) = \hat{H} \Psi(\mathbf{r}, t) \tag{2}
\end{equation}
$$
1
2
3
4
5
6
7
8
$$
\begin{align}
\nabla \cdot \mathbf{E} &= \frac{\rho}{\epsilon_0} \tag{Maxwell I} \\
\nabla \cdot \mathbf{B} &= 0 \tag{Maxwell II} \\
\nabla \times \mathbf{E} &= -\frac{\partial \mathbf{B}}{\partial t} \tag{Maxwell III} \\
\nabla \times \mathbf{B} &= \mu_0 \mathbf{J} + \mu_0 \epsilon_0 \frac{\partial \mathbf{E}}{\partial t} \tag{Maxwell IV}
\end{align}
$$

5. Matrices 矩阵

Plain matrix:

1
2
3
4
5
6
7
$$
\begin{matrix}
1 & 2 & 3 \\
4 & 5 & 6 \\
7 & 8 & 9
\end{matrix}
$$

Parenthesized matrix:

1
2
3
4
5
6
$$
\begin{pmatrix}
a & b \\
c & d
\end{pmatrix}
$$

Bracketed matrix:

1
2
3
4
5
6
7
$$
\begin{bmatrix}
1 & 0 & 0 \\
0 & 1 & 0 \\
0 & 0 & 1
\end{bmatrix}
$$

Augmented Matrix:

1
2
3
4
5
6
7
8
$$
\left[
\begin{array}{cc|c}
1 & 2 & 3 \\
4 & 5 & 6
\end{array}
\right]
$$

Determinant:

1
2
3
4
5
6
7
$$
\begin{vmatrix}
a_{11} & a_{12} & a_{13} \\
a_{21} & a_{22} & a_{23} \\
a_{31} & a_{32} & a_{33}
\end{vmatrix}
$$

Giatn Matrix:

1
2
3
4
5
6
7
8
9
$$
\mathbf{A} = \begin{pmatrix}
a_{11} & a_{12} & a_{13} & \cdots & a_{1n} \\
a_{21} & a_{22} & a_{23} & \cdots & a_{2n} \\
a_{31} & a_{32} & a_{33} & \cdots & a_{3n} \\
\vdots & \vdots & \vdots & \ddots & \vdots \\
a_{n1} & a_{n2} & a_{n3} & \cdots & a_{nn}
\end{pmatrix}
$$

Small inline matrix: The rotation matrix rotates a vector by angle .

6. Tables (Arrays) 表格

7. Cases 分类式 (Piecewise Functions)

8. Complex / Large Formulas 复杂大型公式

Taylor Series 泰勒展开

Fourier Transform 傅里叶变换

Product notation

Nested fractions 嵌套分式

Multi-line aligned derivation 多行对齐推导

Multiline equation system 方程组

Decorated expressions

9. Special Symbols & Operators 特殊符号

10. Mixed Content 混合内容

Here is a paragraph with inline math and then immediately a display equation:

And after the equation, we continue with more text. The Christoffel symbols are used in differential geometry.

Here is an extremely complex example of a MathJax array table, which combines multi-line merging (visual merging), nested arrays, various mathematical symbols (calculus, linear algebra, complex functions, special functions), and double-line borders, fully demonstrating the complex layout capabilities of the array environment.

Here are some extra equations provided for references:

  • Title: Introduction to MathJax!
  • Author: Jason-JP-Yang
  • Created at : 2026-02-20 12:00:00
  • Updated at : 2026-09-09 13:12:58
  • Link: https://blog.jason-yang.top/2026/02/20/MathJax-Introduction/
  • License: This work is licensed under CC BY-NC-SA 4.0.
Comments