Scissor LaTeX 中的 amsmath
amsmath 套件在 Scissor LaTeX 中可用:align 和 gather 會為每一列編號,\tag、\intertext、subequations、\numberwithin、\genfrac、split、cases、各種矩陣環境和 \DeclareMathOperator 都和 LaTeX 一樣能用。
套件的用途
amsmath 是顯示數學式的標準工具箱。它提供對齊和分組方程式的環境、帶括號的矩陣、公式中的 \text、更好的分數和二項式係數,以及用來參照方程式的 \eqref。
在導言區用 \usepackage{amsmath} 載入它。在 Scissor LaTeX 中,即使沒有這一行,它的大多數指令也能用,但請保留它,讓你的文件在 TeX 安裝環境中也能編譯。
在這裡可用的功能
| 指令或環境 | 在 Scissor LaTeX 中 | 備註 |
|---|---|---|
equation, equation* | 可用 | 一個編號,或沒有編號。 |
align, align* | 可用 | |
gather, gather* | 可用 | |
multline, multline* | 可用 | |
flalign, alignat, eqnarray | 可用 | |
split, aligned, gathered | 可用 | 放在 equation 或 \[ ... \] 裡。 |
cases | 可用 | |
matrix, pmatrix, bmatrix, Bmatrix, vmatrix, Vmatrix, smallmatrix | 可用 | |
\text{...}, \operatorname{...} | 可用 | |
\DeclareMathOperator, \DeclareMathOperator* | 可用 | 放在導言區。 |
\dfrac, \tfrac, \cfrac, \binom, \dbinom, \genfrac | 可用 | |
\boxed, \substack, \overset, \underset, \smash | 可用 | |
\xrightarrow[...]{...}, \xleftarrow[...]{...} | 可用 | |
\eqref, \label | 可用 | |
\nonumber, \notag | 可用 | |
\tag{...}, \tag*{...} | 可用 | |
\numberwithin, subequations | 可用 | |
\intertext, \shortintertext | 可用 | |
\iint, \iiint | 可用 | \iiiint 和 \idotsint 會顯示紅色公式。 |
範例
在等號處對齊的方程式,並參照這個區塊:
align 搭配 \label 和 \eqref
\begin{align}
f(x) &= (x + 1)^2 \label{eq:square}\\
&= x^2 + 2x + 1
\end{align}
Expanding the square in \eqref{eq:square} gives three terms.用 cases 和 \text 寫的分段函數,以及在導言區宣告的運算子:
cases、\text 和 \DeclareMathOperator
\documentclass{article}
\usepackage{amsmath}
\DeclareMathOperator{\sgn}{sgn}
\begin{document}
\[
\sgn(x) =
\begin{cases}
1 & \text{if } x > 0,\\
0 & \text{if } x = 0,\\
-1 & \text{otherwise.}
\end{cases}
\]
\end{document}使用不同括號的矩陣,以及用 split 斷行的長公式:
矩陣和 split
\[
A = \begin{pmatrix} 1 & 2 \\ 3 & 44 \end{pmatrix},\quad
B = \begin{bmatrix} a & b \\ c & d \end{bmatrix},\quad
\det A = \begin{vmatrix} 1 & 2 \\ 3 & 44 \end{vmatrix} = 38
\]
\begin{equation}
\begin{split}
(a + b)^3 &= (a + b)(a + b)^2 \\
&= a^3 + 3a^2 b + 3a b^2 + b^3
\end{split}
\end{equation}分數、二項式係數、方框和堆疊的上下限:
\dfrac、\binom、\boxed 和 \substack
\boxed{\, \sum_{\substack{0 \le i \le n \\ i \text{ even}}} \binom{n}{i} = 2^{n-1} \,}
\qquad
\dfrac{1}{1 + \cfrac{1}{2 + \cfrac{1}{3}}}
\qquad
A \xrightarrow{\;f\;} B\intertext 會在 align 的各列之間插入一行文字:
兩列之間的 \intertext
\begin{align}
x &= 44 \intertext{and therefore}
y &= 2x
\end{align}相容性
- 從 TeX 安裝環境搬到這裡:文件會以相同的編號排版;只有上面標示為不支援的少數指令會顯示紅色公式。
- 從這裡搬到 TeX 安裝環境:文件在那裡不需修改就能編譯。
完整手冊在 CTAN 上:ctan.org/pkg/amsmath。如需逐步介紹,請見方程式、對齊與編號和矩陣。
常見問題
align 的每一列都有自己的編號嗎?
是的,和 TeX 安裝環境一樣。在不該編號的列上加上 \nonumber 或 \notag。
可以用 \tag 給方程式自訂標籤嗎?
可以。\tag{A} 會顯示 (A) 而不是編號,參照其標籤的 \eqref 也會印出 (A)。
支援 \DeclareMathOperator 嗎?
支援。和在 TeX 安裝環境中一樣,在導言區宣告運算子,然後像 \sin 一樣使用它。加星號的形式會在顯示數學式中把上下限放在名稱下方。
本頁的每個範例都在建置網站時由 Scissor LaTeX 排版。 最後更新:2026-11-07