Forgot password?
 Create new account
View 247|Reply 3

$\verb|\cases|$,$\verb|\begin{cases}...\end{cases}|$在第二列有区别?

[Copy link]

3146

Threads

8493

Posts

610K

Credits

Credits
66158
QQ

Show all posts

hbghlyj Posted at 2022-4-24 15:24:08 |Read mode
为什么$\verb|\cases|$的第二列是文本模式而$\verb|\begin{cases}...\end{cases}|$是数学模式
$f(x)=\cases{0&-π≤x<0\\x&0≤x<π}$
$f(x)=\begin{cases}0&-π≤x<0\\x&0≤x<π\end{cases}$
  1. $f(x)=\cases{0&-π≤x<0\\x&0≤x<π}$
  2. $f(x)=\begin{cases}0&-π≤x<0\\x&0≤x<π\end{cases}$
Copy the Code

701

Threads

110K

Posts

910K

Credits

Credits
94172
QQ

Show all posts

kuing Posted at 2022-4-24 17:02:36
\cases 命令在最初的 TeX 里就已经有了:
\def\cases#1{\left\{\,\vcenter{\normalbaselines\m@th
\ialign{$##\hfil$&\quad##\hfil\crcr#1\crcr}}\right.}
(这段代码来自《The TEXbook》)
可以看到它的第二列是没加美元符的,所以就是文本模式。

后来 LaTeX 也继承了这一点:
\DeclareRobustCommand\cases[1]{\left\{\,\vcenter{\normalbaselines\m@th
\ialign{$##\hfil$&\quad{##}\hfil\crcr#1\crcr}}\right.}
(这段代码来自 source2e.pdf)

而 cases 环境是 amsmath 宏包定义的,而且加载该宏包后,\cases 命令不能再用。
Explanation: When the amsmath package is used, the old forms of \pmatrix, \matrix, and \cases cannot be used any longer because of naming conflicts. Their syntax did not conform with standard LATEX syntax in any case.
(来自 amsldoc.pdf)

而在这里竟然两个都能用,看来还是因为 MathJax 够宽容。

701

Threads

110K

Posts

910K

Credits

Credits
94172
QQ

Show all posts

kuing Posted at 2022-4-24 17:22:55
再后来,mathtools 宏包又给出了带 * 的 cases 环境,第二列为文本模式。
还有更多的:
QQ截图20220424172250.png
d 的就是 displaystyle;
r 的就是括号在右边。
推荐使用。(本论坛也已支持)

3146

Threads

8493

Posts

610K

Credits

Credits
66158
QQ

Show all posts

 Author| hbghlyj Posted at 2022-4-24 19:08:04
测试一下
$\begin{rcases}y=x^2\\z=y^2\end{rcases}⇒z=x^4$

手机版Mobile version|Leisure Math Forum

2025-4-20 22:13 GMT+8

Powered by Discuz!

× Quick Reply To Top Return to the list