example
\documentclass{article}
\usepackage{amsmath}
\usepackage{xeCJK}
\begin{document}
$$
P_{r - j} =
\begin{cases}
0123 & \text{if $r - j$ is odd,} \\
a! \, (-1)^{(r - j)/2}
& \text{if $r - j$ is even.}
\end{cases}
$$
\begin{equation}
P_{r - j} =
\begin{cases}
0 & \text{if $r - j$ is odd,} \\
r! \, (-1)^{(r - j)/2}
& \text{if $r - j$ is even.}
\end{cases}
\end{equation}
\begin{equation}
f(x) =\begin{cases}
1 & \text{如果x为有理数,} \\
2
& \text{如果x为无理数,}\\
0 & \text{其他.}
\end{cases}
\end{equation}
\begin{gather}
\raisetag{-10pt}
\text{The sign function: \ }
\mathcal{S}(x) = \begin{cases}
-1 & x < 0 \\
0 & x = 0 \\
1 & x > 0
\end{cases}
\end{gather}
\end{document}
结果如下:
注意这个begin cases
的使用, 我还是第一次遇到这个,可以多加学习
此外在draw.io中可以使用
b
e
g
i
n
c
a
s
e
s
begin cases
begincases的语法,但是不能使用begin array
的东西,看下面的例子
$$M(i^{v_j},k^{v_l}) =\begin{cases}1, \lnot (i,k \in \mathrm H
),\\ |Q_{ik}-S^*(i^{v_j},k^{v_l})|^\beta, others.\end{cases}$$
这里是可以的,结果如下
但是这个draw.io对于复杂的公式只能手写,复制其中的代码是不行的,就很莫名其妙