
iopart文件類別在iopart.cls
文件中定義了以下內容
\def\cases#1{%
\left\{\,\vcenter{\def\\{\cr}\normalbaselines\openup1\jot\m@th%
\ialign{\strut$\displaystyle{##}\hfil$&\tqs
\rm##\hfil\crcr#1\crcr}}\right.}%
amsmath
這是環境的替代品嗎cases
?我該如何使用它?該定義出現在文件中的其他位置。
如何手動實現案例環境的問題已經被問到了這裡。我想知道考慮到該帖子的年齡,是否仍然需要這樣做。
答案1
\cases
(不是環境)的這個定義是 LaTeX 內核中定義的修改,本質上與純 TeX 中的相同。
順便說一句,諸如\rm
和 之類的命令\bf
已經過時,並且已被棄用了近三十年。
有一個非常簡單的方法可以amsmath
與 一起加載iopart
。我還將使用一個技巧來比較iopart
's\cases
和amsmath
's的結果cases
。
\documentclass[10pt]{iopart}
% for using amsmath
\expandafter\let\csname equation*\endcsname\relax
\expandafter\let\csname endequation*\endcsname\relax
%%% This is just to compare the results
\let\iopartcases\cases
%%%
\usepackage{amsmath}
\begin{document}
In the following display I'll be using \verb|\cases| as
defined by \verb|iopart| in order to check the differences
\[
f(x)=\iopartcases{1 & abc \\ 0 & uvw}
\]
The following display will use \verb|cases| as defined by
\verb|amsmath| in order to check the differences
\[
f(x)=\begin{cases} 1 & abc \\ 0 & uvw \end{cases}
\]
Now we can decide which one to use.
\end{document}
如果您喜歡這種方式iopart
,您可以定義一個iopcases
環境(我不會覆蓋amsmath
一個環境)。
\documentclass[10pt]{iopart}
% for using amsmath
\expandafter\let\csname equation*\endcsname\relax
\expandafter\let\csname endequation*\endcsname\relax
%%% This is just to compare the results
\let\iopartcases\cases
%%%
\usepackage{amsmath}
\usepackage{mathtools}
\makeatletter
\newcases{iopcases}{\tqs}
{$\m@th\displaystyle##$\hfil}
{##\hfil}
{\lbrace}
{.}
\makeatother
\begin{document}
In the following display I'll be using \verb|\cases| as
defined by \verb|iopart| in order to check the differences
\[
f(x)=\iopartcases{1 & abc \\ 0 & uvw}
\]
The following display will use \verb|iopcases| as defined
above in order to check the differences
\[
f(x)=\begin{iopcases} 1 & abc \\ 0 & uvw \end{iopcases}
\]
Now we can decide which one to use.
\end{document}
您想要像現在這樣的薄空間iopart
嗎?變成
\makeatletter
\newcases{iopcases}{\tqs}
{$\m@th\displaystyle\,##$\hfil}
{##\hfil}
{\lbrace}
{.}
\makeatother
你會得到
我不會用於iopart
私人目的。還有其他幾個課程不需要技巧就可以使用基本工具來排版數學。