在latex写代码时,if条件的源代码
If {condition1}
State a=1
ElsIf {condition2}
State a=2
Else
State a=3
EndIf
\documentclass{article}
\usepackage{amsmath}
\begin{document}
% 单侧大括号方程组
\begin{equation}
f(x) =
\begin{cases}
x^2 + 1 & \text{if } x \geq 0 \\
-x^3 + 2x & \text{if } x < 0
\end{cases}
\end{equation}
% 多行条件方程组
\begin{equation}
\begin{cases}
a_1x + b_1y = c_1 \\
a_2x + b_2y = c_2 \\
a_3x + b_3y = c_3
\end{cases}
\end{equation}
\end{document}