在 Math Time Professional 中,需要使用
\ccases{}
代替
\begin{cases}
\end{cases}
以获得(漂亮的)花括号。是否可以用作\begin{cases} \end{cases}
新命令并获得\ccases{}
?
感谢您的帮助
答案1
我没有 MTPro,但我推测方法如下:
\documentclass{article}
\usepackage{amsmath,environ}
% YOU MAY DELETE THE FOLLOWING LINE WHEN USING MTPro
\providecommand\ccases[1]{\begin{cases}#1\end{cases}}
\NewEnviron{Cases}{\ccases{\BODY}}
\begin{document}
\[
y = \begin{Cases}x_1 & \text{first choice}\\x_2& \text{second choice}\end{Cases}
\]
\end{document}
我使用新定义的Cases
,以免抹杀原始cases
环境。
附录
为了回答 OP 的后续问题,我引入了\Left
和\Right
(为了不抹杀\left
和\right
)
\documentclass{article}
\usepackage{amsmath,environ}
% YOU MAY DELETE THE FOLLOWING 2 LINES WHEN USING MTPro
\providecommand\ccases[1]{\begin{cases}#1\end{cases}}
\providecommand\PARENS[1]{\left(#1\right)}
%
\def\Left#1#2\Right#3{
\ifx(#1\PARENS{#2}\else
% \ifx[#1\BRACKETS{#2}\else% AN EXAMPLE OF HOW TO CODE MULTIPLE TESTS
\left#1#2\right#3% USE DEFAULT IF NO ALTERNATE DEFINITION
% \fi
\fi
}
\NewEnviron{Cases}{\ccases{\BODY}}
\begin{document}
\[
y =
\begin{Cases}
\Left(\dfrac{x_1}{3}\Right) & \text{first choice}\\
x_2& \text{second choice}
\end{Cases}
\]
\end{document}