一、gather的用法

基本用法,公式编号

\begin{gather}
a+b = b+a \\
a\times b = b \times a
\end{gather}

a+b=b+aa×b=b×a \begin{gather} a+b = b+a \\ a\times b = b \times a \end{gather} a+b=b+aa×b=b×a
可以使用gather*不编号

\begin{gather*}
a+b = b+a \\
a\times b = b \times a
\end{gather*}

a+b=b+aa×b=b×a \begin{gather*} a+b = b+a \\ a\times b = b \times a \end{gather*} a+b=b+aa×b=b×a
或者在\\前用\notag命令阻止指定的行不编号,
a+b=b+aa×b=b×aa−b=−b+a \begin{gather} a+b = b+a \notag \\ a\times b = b \times a \notag \\ a-b=-b+a \\ \end{gather} a+b=b+aa×b=b×aab=b+a

二、align环境

gather环境中每行公式是剧中的,而align可以按照等号或其它关系符对齐

\begin{align}
a+b &= b+a \\
a\times b  + 1 &= b \times a + 1
\end{align}

a+b=b+aa×b+1=b×a+1 \begin{align} a+b &= b+a \\ a\times b + 1 &= b \times a + 1 \end{align} a+ba×b+1=b+a=b×a+1

三、 alignat环境

alignat环境通过手动增加间距,有一个参数,表示每行要对齐的公式个数,每两列一组,例如把列间隔设定为一个\quad,即1em.

\begin{alignat}{2}
x &= \sin t & \quad & \text{水平方向} \\
y &= \cos t && \text{垂直方向}
\end{alignat}

x=sin⁡t水平方向y=cos⁡t垂直方向 \begin{alignat}{2} x &= \sin t & \quad & \text{水平方向} \\ y &= \cos t && \text{垂直方向} \end{alignat} xy=sint=cost水平方向垂直方向

四、cases环境

将几行公式前面用花括号括起来

\begin{equation}
f(x) = \begin{cases}
1, & \text{if } x \in [0, 1]; \\
0, & \text{if } x \in [-1, 0).
\end{cases}
\end{equation}

f(x)={1,if x∈[0,1];0,if x∈[−1,0). \begin{equation} f(x) = \begin{cases} 1, & \text{if } x \in [0, 1]; \\ 0, & \text{if } x \in [-1, 0). \end{cases} \end{equation} f(x)={1,0,if x[0,1];if x[1,0).

Logo

有“AI”的1024 = 2048,欢迎大家加入2048 AI社区

更多推荐