此頁歡迎共筆。
HackMD 是透過 MathJax 支援
,雖未支援所有語法,對多數人應已足夠,一起把 Web 上醜死的公式換成美美的吧~
\LaTeX % 大小寫須正確
$\textstyle$
$$\displaystyle$$
%comment
\grave apple % 標重音
{\bf AB} % 粗體 boldface
\bar{A}
{ a+b \brace c+d }
\overline{AB}
\vec{v}
\frac{b}{a}
% 或
{b \over a}
\dfrac{b}{a} % d for \displaystyle
\tfrac{b}{a} % t for \textstyle
90^\circ
e^{\theta i}
S_{n}
\lim\limits_{n\to \infty}
\sum\limits_{x = 0}^k{x^2}
\bigcup\limits_{i = 1}^{\infty}{U_i}
\bigcap\limits_{i = 1}^{\infty}{U_i}
\mathop{\vcenter{\huge\times}}_\limits{i=1}^n{U_i}
\int_a^b x^2 \mathrm{d} x
\sqrt[n]{1+x+x^2+x^3+\dots+x^n}
% 或
\root n \of {1+x+x^2+x^3+\dots+x^n}
A \implies B
A \impliedby B
A \iff B
f: A \to B
A \leftarrow B
\xrightarrow{中文亦可}\ \xleftarrow{中文亦可}
a\,\overset{?}{=}\,b
\forall x \in X, \exists x \in b
\not\in, \not\gt, \not\lt, \not= % 利用 \not 組合表示否定
\vert a \vert, \Vert a \Vert % absolute value and norm
a_{1}, a_{2}, \ldots, a_{n}
a_{1} + a_{2} + \cdots + a_{n}
\begin{pmatrix}
a_{11} & a_{12} & \cdots & a_{1n}\\
a_{21} & a_{22} & \cdots & a_{2n}\\
\vdots & \vdots & \ddots & \vdots\\
a_{m1} & \cdots & \cdots & a_{mn}
\end{pmatrix}
% ldots: low dots
% cdots: center dots
% ddots: diagonal dots
% vdots: vertical dots
\left\{
\begin{array}{c}
a_1x+b_1y+c_1z=d_1 \\
a_2x+b_2y+c_2z=d_2 \\
a_3x+b_3y+c_3z=d_3
\end{array}
\right.
\begin{align*} # align equations using equal sign
a + b = 0 \\ # switch line
a + b + c = 1
\end{align*}
Binomial :
或 \binom a b
或 { a \choose b }
\tbinom a b (t for \textstyle)
\dbinom a b (d for \displaystyle)
\begin{pmatrix}
A\\B % \\ 為 newline(換行)
\end{pmatrix}
% 或
\pmatrix{A\\B}
\begin{bmatrix}
A\\B
\end{bmatrix}
\begin{vmatrix}
A\\B
\end{vmatrix}
\begin{Vmatrix}
A\\B
\end{Vmatrix}
\begin{bmatrix}
a & b \\
c & d
\end{bmatrix}
\alpha \quad \beta \quad \gamma
\boldsymbol{}
\boldsymbol{\alpha \quad \beta \quad \gamma}
pmb{}
\pmb{\alpha \quad \beta \quad \gamma}
https://oeis.org/wiki/List_of_LaTeX_mathematical_symbols#Set_and.2For_logic_notation
\style{background-color:#eeeeee}{\frac{x+1}{y+2}} % 直接以 CSS 改變 style
f(x) = a{\color{red}{x}} + b
% 或
f(x) = a{\color{#ff0000}{x}} + b
\require{color}
\colorbox{#eeeeee}{Color Box}
{\cal ABCDE12345abced} % callgraphic mode
\fbox{boxed text} % in textstyle
\boxed{boxed\ text} % in displaystyle
\text{text $E=mc^2$}
{\frak ABCDE12345abcde}
{\it abefg12345}\ abcdefg12345 % italic
\min\limits_{n}
If you want to represent bold greek letters.
link for Blod of Greek
\{x \mid x\gt 1\} % 請用 \mid 寫 Set 才好看
\left(\dfrac{x^2}{y^3}\right)
\left\{ \dfrac{1}{2} \right\}
f(x) = \left\{
\begin{array}{r}
x + by = c \\
dx + ey = f
\end{array}
\right.
% {r} for right alignment within array
% {l} for left alignment within array
% 或
\array{
x + by = c \\
dx + ey = f
}
z = \overbrace{
\underbrace{x}_\text{real} + i
\underbrace{y}_\text{imaginary}
}^\text{complex number}
\begin{aligned}
f(x) &= ax + by + cz + d \\
&= 2x + 3y + 5z + 1
\end{aligned}
% 或
\begin{align}
f(x) &= ax + by + cz + d \\
&= 2x + 3y + 5z + 1
\end{align}
% 或
\eqalign{
f(x) &= ax + by + cz + d \\
&= 2x + 3y + 5z + 1
}
\begin{align}
a_{1} + b_{1} &= c_{1} \\
a_{2} + b_{2} &= c_{2} \\
&\vdots \\
a_{10} + b_{10} &= c_{10}
\end{align}
\begin{cases}
n/2, & \text{if $n$ is even} \\
3n+1, & \text{if $n$ is odd}
\end{cases}
% 或
\cases{
n/2, & \text{if $n$ is even} \\
3n+1, & \text{if $n$ is odd}
}
\begin{pmatrix}
aaa & bbb \\
cc & dd
\end{pmatrix}
\begin{matrix}
xxxxxx & xxxxxx & xxxxxx \cr
ab & \hfil ab & ab\hfil \cr % 以 \hfil 自動填空
\end{matrix}
\begin{array}{rrrrrr|r}
& x_1 & x_2 & s_1 & s_2 & s_3 & \\ \hline
s_1 & 0 & 1 & 1 & 0 & 0 & 8 \\
s_2 & 1 & -1 & 0 & 1 & 0 & 4 \\
s_3 & 1 & 1 & 0 & 0 & 1 & 12 \\ \hline
& -1 & -1 & 0 & 0 & 0 & 0
\end{array}
\overset{上組合技}{\implies} 或 \underset{下組合技}{\impliedby}
\require{extpfeil}
x \xtofrom[f^{-1}]{f} y
\require{mhchem}
x \xrightleftharpoons[f^{-1}]{f} y
\require{ams}
\begin{equation}
\tag{1}\label{eq:eq_1} E = mc^2
\end{equation}
% MathJax 照理說已支援 Auto Number,但 HackMD 不支援。
% 只能手動自己加 \tag{1}\label{eq:equation_name}
reference\ equation\eqref{eq:eq_1}
\begin{equation*}
E = mc^2
\end{equation*}
% 不加入 Auto Number,但在 HackMD 上沒差別。
% 若命令又長又重複,可用 \def 自訂
\def \kton{\sum\limits_{k=0}^{n}}
\begin{aligned}
(1+\frac{1}{n})^n &= \kton \binom{n}{k}1^{n-k}(\frac{1}{n})^{k}\\
&= \kton \binom{n}{k} \frac{1}{n^{k}}\\
&= \kton \frac{n!}{k!(n-k)!}\times\frac{1}{n^k}\\
&= \kton \frac{1}{k!} \frac{\overbrace{n(n-1)(n-2)\ldots(n-k+1)}^{共\ k\ 項}}{n^k}\\
&= \kton \frac{1}{k!} (\frac{n}{n}\frac{n-1}{n}\cdots\frac{n-k+1}{n})
\end{aligned}
\DeclareMathOperator {\total}{總計}
\total_a^b(x)
% 自訂 Operator,命名限 [a-z|A-Z],不可含數字。
% 加入多個空格在數學公式後面
x_{ij} = A_{i}X_{j} + b_{i} ~~~~~~~~~~~~~~~ i=1 \ldots m; ~~ j = 1 \ldots n
\mathbb - Used to turn on blackboard-bold for uppercase letters and lowercase 'k'.
\mathbf - Used to turn on boldface for uppercase and lowercase letters and digits.
\mathit - forces the math italic mode.
\mathcal - Used to turn on calligraphic font for uppercase letters and digits.
\mathfrak - turn on fraktur font for uppercase and lowercase letters and digits (and a few other characters).
\mathrm - Used to turn on roman typestyle for uppercase and lowercase letters.
\mathscr - Used to turn on script typestyle for uppercase letters. If lowercase script letters are not available, then they are typeset in a roman typestyle.
\mathsf - Used to turn on sans serif typestyle for uppercase and lowercase letters and digits; also affects uppercase greek.
\mathtt - Used to turn on typewriter typestyle for uppercase and lowercase letters and digits.
\oldstyle - Used to turn on oldstyle font.
If you want to represent bold greek letters.
link for Blod of Greek
\mathord - forces the argument to be treated in the 'ordinary' class.
\mathrel - forces the argument to be treated in the 'relation' class.
\mathinner - forces the argument to appear 'inside' other formulas, and should be surrounded by additional space in certain circumstances.
\mathbin - Used to give the correct spacing to make an object into a binary operator.
\mathstrut - Used to achieve more uniform appearance in adjacent formulas as an invisible box whose width is zero.
\mathpunct
\mathopen
\mathclose
\mathop
\mathxxx{argument}
\mathchoice - provides content that is dependent on the current style (display, text, script, or scriptscript).
\mathchoice{D}{T}{S}{SS}
LaTeX