cases
包的环境对于amsmath
定义在不同区域采用不同值的函数很有用。例如:
\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{equation}
f(x) = \begin{cases}
g_1(x), & \text{if condition 1}; \\
g_2(x), & \text{if condition 2}; \\
g_3(x), & \text{if condition 3}; \\
g_4(x), & \text{if condition 4}; \\
g_5(x), & \text{if condition 5}; \\
g_6(x), & \text{if condition 6}; \\
g_7(x), & \text{if condition 7}. \\
\end{cases}
\end{equation}
\end{document}
对于如此长的表达式,cases
环境很容易阅读;但是,它占用了太多的垂直空间(对于期刊和会议论文,空间总是很宝贵)。有没有其他方法来格式化这种表达式,使其可读性强,但占用的空间比cases
环境少?
答案1
cases
设置\arraystretch
为 1.2。您可以减小此值:
\documentclass{article}
\usepackage{amsmath}
\makeatletter
\def\env@cases{%
\let\@ifnextchar\new@ifnextchar
\left\lbrace
\def\arraystretch{1}%
\array{@{}l@{\quad}l@{}}}
\makeatother
\begin{document}
\begin{equation}
f(x) = \begin{cases}
g_1(x), & \text{if condition 1}; \\
g_2(x), & \text{if condition 2}; \\
g_3(x), & \text{if condition 3}; \\
g_4(x), & \text{if condition 4}; \\
g_5(x), & \text{if condition 5}; \\
g_6(x), & \text{if condition 6}; \\
g_7(x), & \text{if condition 7}. \\
\end{cases}
\end{equation}
\end{document}