Ikeq ChengIkeq Cheng

The whole problem with the world is that fools and fanatics are always so certain of themselves, but wiser people so full of doubts.

MathJax Server-Side Render Example

Jun 26, 2019535 words in 3 min

Pre-render MathJax with hexo-filter-mathjax-ssr.

Installation

1
npm install hexo-filter-mathjax-ssr --save

Done!

Examples

Most of the examples below are from https://www.mathjax.org/#samples .

Inline math

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}.

Block math

The Quadratic Formula

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

Cauchy’s Integral Formula

f(a) = \frac{1}{2\pi i} \oint\frac{f(z)}{z-a}dz

Double angle formula for Cosines

\cos(θ+φ)=\cos(θ)\cos(φ)−\sin(θ)\sin(φ)

Gauss’ Divergence Theorem

\int_D ({\nabla\cdot} F)dV=\int_{\partial D} F\cdot ndS

Curl of a Vector Field

\vec{\nabla} \times \vec{F} = \left( \frac{\partial F_z}{\partial y} - \frac{\partial F_y}{\partial z} \right) \mathbf{i} + \left( \frac{\partial F_x}{\partial z} - \frac{\partial F_z}{\partial x} \right) \mathbf{j} + \left( \frac{\partial F_y}{\partial x} - \frac{\partial F_x}{\partial y} \right) \mathbf{k}

Standard Deviation

\sigma = \sqrt{ \frac{1}{N} \sum_{i=1}^N (x_i -\mu)^2}

Definition of Christoffel Symbols

(\nabla_X Y)^k = X^i (\nabla_i Y)^k = X^i \left( \frac{\partial Y^k}{\partial x^i} + \Gamma_{im}^k Y^m \right)

Definition of Christoffel Symbols

A matrix

A= \begin{bmatrix} {a_{11}}&{a_{12}}&{\cdots}&{a_{1n}}\\ {a_{21}}&{a_{22}}&{\cdots}&{a_{2n}}\\ {\vdots}&{\vdots}&{\ddots}&{\vdots}\\ {a_{m1}}&{a_{m2}}&{\cdots}&{a_{mn}}\\ \end{bmatrix}

Source code

Markdown

post.md
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
## Inline math

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}.\]

## Block math

### The Quadratic Formula

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

### Cauchy's Integral Formula

\[f(a) = \frac{1}{2\pi i} \oint\frac{f(z)}{z-a}dz\]

### Double angle formula for Cosines

\[ \cos(θ+φ)=\cos(θ)\cos(φ)−\sin(θ)\sin(φ) \]

### Gauss' Divergence Theorem

\[ \int_D ({\nabla\cdot} F)dV=\int_{\partial D} F\cdot ndS \]

### Curl of a Vector Field

\[ \vec{\nabla} \times \vec{F} = \left( \frac{\partial F_z}{\partial y} - \frac{\partial F_y}{\partial z} \right) \mathbf{i}
+ \left( \frac{\partial F_x}{\partial z} - \frac{\partial F_z}{\partial x} \right) \mathbf{j} + \left( \frac{\partial
F_y}{\partial x} - \frac{\partial F_x}{\partial y} \right) \mathbf{k} \]

### Standard Deviation

\[\sigma = \sqrt{ \frac{1}{N} \sum_{i=1}^N (x_i -\mu)^2} \]

### Definition of Christoffel Symbols

\[(\nabla_X Y)^k = X^i (\nabla_i Y)^k = X^i \left( \frac{\partial Y^k}{\partial x^i} + \Gamma_{im}^k Y^m \right)\]

### Definition of Christoffel Symbols

### A matrix

\[
A= \begin{bmatrix}
{a_{11}}&{a_{12}}&{\cdots}&{a_{1n}}\\
{a_{21}}&{a_{22}}&{\cdots}&{a_{2n}}\\
{\vdots}&{\vdots}&{\ddots}&{\vdots}\\
{a_{m1}}&{a_{m2}}&{\cdots}&{a_{mn}}\\
\end{bmatrix}
\]

Config

hexo/_config.yml
1
2
3
mathjax:
inlineQuote: ['\(', '\)']
blockQuote: ['\[', '\]']

Buy me a cup of milk 🥛.