
我正在嘗試編寫這四個分段定義的函數。
我寫了這段程式碼:
\begin{equation}
\theta = \begin{cases}
\theta r + Se \left( \theta s - \theta r \right) & Hp < 0 \\
\theta s & Hp \geq 0
\end{cases} \\
\end{equation}
\begin{equation}
Se = \begin{cases}
\frac{1}{[1 + |\alpha Hp|^n]^m} & Hp < 0 \\
1 & Hp \geq 0
\end{cases} \\
\end{equation}
\begin{equation}
C_m = \begin{cases}
\frac{\alpha m}{1 - m} \left( \theta s - \theta r \right) Se^{\frac{1}{m}} [1 - Se^{\frac{1}{m}} ]^m & Hp < 0 \\
0 & Hp \geq 0
\end{cases} \\
\end{equation}
\begin{equation}
K_r = \begin{cases}
Se^ l [1-[1- Se^{\frac{1}{m}}]^m] ^2 & Hp < 0 \\
1 & Hp \geq 0
\end{cases}\\
\end{equation}
我得到了這個結果:
如何將這四個分段定義的函數分開?
答案1
僅使用一個 & 符號,&
.
請參閱 lshort 中的第 68 頁:https://tobi.oetiker.ch/lshort/lshort.pdf
例子:
\begin{equation*}
|x| = \begin{cases}
-x & \text{if } x < 0,\\
0 & \text{if } x = 0,\\
x & \text{if } x > 0.
\end{cases}
\end{equation*}
生產:
答案2
cases
除了按照 Tommy L 的回答使用之外,您還可以:
- 使用
align
環境,因為您有多個連續的方程, - 使用 a
\makebox
來取得 的對齊方式conditions
。
筆記:
\MakeBox
只需要在其中一種情況下套用巨集即可。- 我使用了該
mathtools
軟體包,因為它包含了一些修復,amsmath
儘管在這種特殊情況下它沒有什麼區別。
代碼:
\documentclass{article}
\usepackage{mathtools}
\usepackage{calc}
\newcommand*{\WidestExpression}{\frac{\alpha m}{1 - m} \left( \theta s - \theta r \right) Se^{\frac{1}{m}} [1 - Se^{\frac{1}{m}} ]^m}
\newcommand*{\MakeBox}[1]{\makebox[\widthof{$\WidestExpression$}][l]{$#1$}}
\begin{document}
\begin{align*}
\theta &= \begin{cases}
\theta r + Se \left( \theta s - \theta r \right) & Hp < 0 \\
\MakeBox{\theta s} & Hp \geq 0
\end{cases} \\
Se &= \begin{cases}
\frac{1}{[1 + |\alpha Hp|^n]^m} & Hp < 0 \\
\MakeBox{1} & Hp \geq 0
\end{cases} \\
C_m &= \begin{cases}
\WidestExpression & Hp < 0 \\
0 & Hp \geq 0
\end{cases} \\
K_r &= \begin{cases}
Se^ l [1-[1- Se^{\frac{1}{m}}]^m] ^2 & Hp < 0 \\
\MakeBox{1} & Hp \geq 0
\end{cases}\\
\end{align*}
\end{document}