MathJax(js:defer/async なし) サンプルページ
非同期読み込みの属性を付けない <script>
を <head>
内に設置する、jekyll-spaceship デフォルトのパターンです。スクリプトの読み込みと解析が完了するまで初期のレンダリングがブロックされますが、TBT が短く、FOUC がやや目立ちにくいパターンと言えます。
ディスプレイ数式(数式だけの行)
段落を分けるために前後を空行で囲むのが基本ルールです(例外あり)。
・$$...$$
$$
S=\sum_{n=1}^\infty a_n
$$
\textstyle
を追加すると、テキストスタイルになります。
$$ \textstyle
S=\sum_{n=1}^\infty a_n
$$
・\[...\]
前後に空行は必要ありませんが、二重の \\
で \
をエスケープする必要があります。1
テキスト
\\[
S=\sum_{n=1}^\infty a_n
\\]
テキスト
テキスト \[ S=\sum_{n=1}^\infty a_n \] テキスト
\textstyle
を追加すると、テキストスタイルになります。
テキスト
\\[ \textstyle
S=\sum_{n=1}^\infty a_n
\\]
テキスト
テキスト \[ \textstyle S=\sum_{n=1}^\infty a_n \] テキスト
・\begin{}...\end{}
KaTex と異なり、空行と$$...$$
で囲む必要がありませんが、split
が効きません。
テキスト
\begin{equation}
\begin{split}
a &= \int_0^\infty f(x) \sin x \cos x \, dx \\
&\quad + \int_0^\infty f(-x) \sin x \log x \, dx
\end{split}
\end{equation}
テキスト
テキスト
\begin{equation}
\begin{split}
a &= \int_0^\infty f(x) \sin x \cos x \, dx
&\quad + \int_0^\infty f(-x) \sin x \log x \, dx
\end{split}
\end{equation}
テキスト
ディスプレイ数式のまま split
を効かせるためには 前後の空行と $$...$$
が必要です。
$$
\begin{equation}
\begin{split}
a &= \int_0^\infty f(x) \sin x \cos x \, dx \\
&\quad + \int_0^\infty f(-x) \sin x \log x \, dx
\end{split}
\end{equation}
$$
1行に収まる方程式であれば \textstyle
が効きます。空行も $$...$$
も不要で、ディスプレイ数式(数式だけの行)として表示されます。
テキスト
\begin{equation} \textstyle
\sum_{k=1}^{n} k = 1 + 2 + 3 + \cdots + n = \frac{n(n+1)}{2}
\end{equation}
テキスト
テキスト \begin{equation} \textstyle \sum_{k=1}^{n} k = 1 + 2 + 3 + \cdots + n = \frac{n(n+1)}{2} \end{equation} テキスト
インライン数式(文章中の数式)
前後を空行で囲まず、1つの段落中に数式を記述します。
・$...$
デフォルトでは $...$
は使えないので、$$...$$
で囲みます。
テキスト
$$
(a+b)^2 = a^2 + 2ab + b^2
$$
テキスト
テキスト \((a+b)^2 = a^2 + 2ab + b^2\) テキスト
・\(...\)
二重の \\
で \
をエスケープする必要があります。1
テキスト
\\(
(a+b)^2 = a^2 + 2ab + b^2
\\)
テキスト
テキスト \( (a+b)^2 = a^2 + 2ab + b^2 \) テキスト
・\begin{}...\end{}
KaTeX と異なり、align
や equation
、split
もインライン数式(文章中の数式)で表示することができます(LaTeX ではエラーと定義されているパターンです)。
テキスト テキスト テキスト
$$
\begin{equation}
\zeta(2) = \sum_{n=1}^\infty \frac{1}{n^2} = \frac{\pi^2}{6}
\end{equation}
$$
テキスト テキスト テキスト テキスト テキスト テキスト テキスト テキスト テキスト テキスト
テキスト テキスト テキスト \(\begin{equation} \zeta(2) = \sum_{n=1}^\infty \frac{1}{n^2} = \frac{\pi^2}{6} \end{equation}\) テキスト テキスト テキスト テキスト テキスト テキスト テキスト テキスト テキスト テキスト
様々な数式
インライン式の記述
This sentence uses `$` delimiters to show math inline: $$\sqrt{3x-1}+(1+x)^2$$
This sentence uses $
delimiters to show math inline: \(\sqrt{3x-1}+(1+x)^2\)
リーマンのゼータ関数
$$
\begin{equation}
\zeta(s) = \sum_{n=1}^\infty \frac{1}{n^s}
\end{equation}
$$
連立方程式 (cases
)
$$
\begin{cases} x + 2y + 4z &= 5 \\ 3x - y &= 1 \\ 4x + 2y -5z &= 0 \end{cases}
$$
ボックスで囲まれた式
$$
\boxed{\left( \sum_{k=1}^n a_k b_k \right)^2 \leq \left( \sum_{k=1}^n a_k^2 \right) \left( \sum_{k=1}^n b_k^2 \right)}
$$