Latex 方程式序列与条件表达式

您所在的位置:网站首页 多条件格式公式怎么输入 Latex 方程式序列与条件表达式

Latex 方程式序列与条件表达式

2024-07-13 15:31| 来源: 网络整理| 查看: 265

方程式序列使用参考 如何输入一个方程式序列

人们经常想要一列整齐且居中的方程式序列。使用 \begin{align}…\end{align} 来创造一列方程式,其中在每行结尾处使用 \\ 。

使用方程式序列无需声明公式符号 $ 或 $$ (Markdown 中需声明)。

请注意 {align} 语句是 自动编号 的。

示例:

123456789 $$\begin{align}\sqrt{37} & = \sqrt{\frac{73^2-1}{12^2}} \\& = \sqrt{\frac{73^2}{12^2}\cdot\frac{73^2-1}{73^2}} \\ & = \sqrt{\frac{73^2}{12^2}}\sqrt{\frac{73^2-1}{73^2}} \\& = \frac{73}{12}\sqrt{1 - \frac{1}{73^2}} \\ & \approx \frac{73}{12}\left(1 - \frac{1}{2\cdot73^2}\right)\end{align}$$

显示:

\[ \begin{align} \sqrt{37} & = \sqrt{\frac{73^2-1}{12^2}} \\ & = \sqrt{\frac{73^2}{12^2}\cdot\frac{73^2-1}{73^2}} \\ & = \sqrt{\frac{73^2}{12^2}}\sqrt{\frac{73^2-1}{73^2}} \\ & = \frac{73}{12}\sqrt{1 - \frac{1}{73^2}} \\ & \approx \frac{73}{12}\left(1 - \frac{1}{2\cdot73^2}\right) \end{align} \]

在一个方程式序列的每一行中注明条件

在 {align} 中灵活组合 \text 和 \tag 语句。\tag 语句编号优先级高于自动编号。

示例:

12345 \begin{align}v + w & = 0 &\text{Given} \tag 1\\-w & = -w + 0 & \text{additive identity} \tag 2\\-w + 0 & = -w + (v + w) & \text{equations $(1)$ and $(2)$}\end{align}

显示:

\[ \begin{align} v + w & = 0 &\text{Given} \tag 1\\ -w & = -w + 0 & \text{additive identity} \tag 2\\ -w + 0 & = -w + (v + w) & \text{equations $(1)$ and $(2)$} \end{align} \]

本例中第一、第二行的自动编号被 \tag 语句覆盖,第三行的编号为自动编号。

条件表达式使用参考 如何输入一个条件表达式

使用 begin{cases} 来创造一组条件表达式,在每一行条件中插入 & 来指定需要对齐的内容,并在每一行结尾处使用 \\,以 end{cases} 结束。

条件表达式无需声明 $ 或 $$ (Markdown 中需声明)。

示例:

1234567 $$f(n) =\begin{cases}n/2, & \text{if $n$ is even} \\3n+1, & \text{if $n$ is odd}\end{cases}$$

显示:

\[ f(n) = \begin{cases} n/2, & \text{if $n$ is even} \\ 3n+1, & \text{if $n$ is odd} \end{cases} \]

条件表达式左侧对齐

若想让文字在 左侧对齐显示 ,则有如下方式:

示例:

123456789 $$\left.\begin{array}{l}\text{if $n$ is even:}&n/2\\\text{if $n$ is odd:}&3n+1\end{array}\right\}=f(n)$$

显示:

\[ \left. \begin{array}{l} \text{if $n$ is even:}&n/2\\ \text{if $n$ is odd:}&3n+1 \end{array} \right\} =f(n) \]

条件表达式适配行高

在一些情况下,条件表达式中某些行的行高为非标准高度,此时使用 \\[2ex] 语句代替该行末尾的 \\ 来让编辑器适配。

示例:

不适配[2ex]

1234567 $$f(n) = \begin{cases}\frac{n}{2}, & \text{if $n$ is even} \\3n+1, & \text{if $n$ is odd}\end{cases}$$

适配[2ex]

1234567 $$f(n) = \begin{cases}\frac{n}{2}, & \text{if $n$ is even} \\[2ex]3n+1, & \text{if $n$ is odd}\end{cases}$$

显示:

不适配[2ex] \[ f(n) = \begin{cases} \displaystyle\frac{n}{2}, & \text{if $n$ is even} \\ 3n+1, & \text{if $n$ is odd} \end{cases} \]

适配[2ex] \[ f(n) = \begin{cases} \displaystyle\frac{n}{2}, & \text{if $n$ is even} \\[2ex] 3n+1, & \text{if $n$ is odd} \end{cases} \]

一个 [ex] 指一个 "X-Height",即 x 字母高度。可以根据情况指定多个 [ex],如 [3ex]、[4ex] 等。

其实可以在任何地方使用 \\[2ex] 语句,只要你觉得合适。

Writing Enriches Life.



【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3