答案1
以下内容摘自amsmath
并使用\genfrac
- 通用分数函数:
\documentclass{article}
\usepackage{amsmath}% http://ctan.org/pkg/amsmath
\DeclareRobustCommand{\stirling}{\genfrac\{\}{0pt}{}}
\begin{document}
% Source: http://en.wikipedia.org/wiki/Stirling_numbers_of_the_second_kind
In mathematics, particularly in combinatorics, a Stirling number of the second kind
is the number of ways to partition a set of $n$~objects into $k$~non-empty subsets and
is denoted by~$S(n,k)$ or~$\stirling{a}{b}$. Stirling numbers of the second kind occur
in the field of mathematics called combinatorics and the study of partitions.
\end{document}
这是如何工作的?\genfrac
需要五个参数来创建一个结构(从amsmath
文档; 部分4.11.3\genfrac
命令,第 14 页):
最后两个对应于
\frac
的分子和分母;前两个是可选的分隔符 [...];第三个是线条粗细覆盖 [0 表示不可见规则];第四个参数是数学样式覆盖:整数值 0-3 分别选择\displaystyle
、\textstyle
、\scriptstyle
和\scriptscriptstyle
。如果第三个参数留空,则线条粗细默认为“正常”。
因此,\genfrac\{\}{0pt}{}
创建一个具有不可见水平线(第三个参数是0pt
)的分数,左分隔符和右分隔符分别由\{
和给出\}
,并且没有特定的数学样式({}
第四个参数为空)。\stirling
不包括第五个和第六个参数\genfrac
(分子和分母),因为这是用户隐式提供的作为两个“参数” \stirling
。
以类似的方式(也许可以参考),amsmath
定义
\newcommand{\frac}[2]{\genfrac{}{}{}{}{#1}{#2}}
\newcommand{\tfrac}[2]{\genfrac{}{}{}{1}{#1}{#2}}
\newcommand{\binom}[2]{\genfrac{(}{)}{0pt}{}{#1}{#2}}
使用\genfrac
。
答案2
这是一个简单的 pdfTeX 解决方案,只是为了说明 Knuth 对这些数字使用了什么类型的排版(他就这个主题写了几篇论文)
% ========= Fonts
\font\sc=cmcsc10
% ========== Heading macros
\magnification =\magstep 1
\overfullrule =0pt
%
\noindent 1. {\sc Stirling numbers} ---
Stirling cycle numbers ${ n\brack m}$ are defined by
$$ \ln^m(1+z) = m! \sum_n (-1)^{n+m} { n\brack m} {z^n\over n!}
\ .\leqno(1a) $$
The numbers $(-1)^{n+m}{n\brack m}$ are also called Stirling numbers of the first kind.
Stirling subset numbers ${n\brace m}$, also called Stirling numbers
of the second kind, are defined by
$$ \left( e^z-1\right)^m = m! \sum_n {n\brace m} {z^n\over n!}
\ ,\leqno(1b) $$
and 2-associated Stirling subset numbers ${n\brace m}_{\ge 2}$ are
defined by
$$ \left( e^z-1-z\right)^m = m!\sum_n {n\brace m}_{\!\ge 2} {z^n\over n!}
\ .\leqno(1c) $$
\bye
您可以查看更多示例Knuth 论文
答案3
一次性定义所有内容是有意义的:
\documentclass{article}
\usepackage{amsmath}
\newcommand{\genstirlingI}[3]{%
\genfrac{[}{]}{0pt}{#1}{#2}{#3}%
}
\newcommand{\genstirlingII}[3]{%
\genfrac{\{}{\}}{0pt}{#1}{#2}{#3}%
}
\newcommand{\stirlingI}[2]{\genstirlingI{}{#1}{#2}}
\newcommand{\dstirlingI}[2]{\genstirlingI{0}{#1}{#2}}
\newcommand{\tstirlingI}[2]{\genstirlingI{1}{#1}{#2}}
\newcommand{\stirlingII}[2]{\genstirlingII{}{#1}{#2}}
\newcommand{\dstirlingII}[2]{\genstirlingII{0}{#1}{#2}}
\newcommand{\tstirlingII}[2]{\genstirlingII{1}{#1}{#2}}
\begin{document}
The Stirling symbol of the first kind $\stirlingI{n}{k}$
or of the second kind $\stirlingII{n}{k}$
\[
\stirlingI{n}{k} \ne \stirlingII{n}{k}
\]
We can also choose the size
\[
\frac{\stirlingI{n}{k}+\stirlingII{n}{k}}{3}\quad
\frac{\dstirlingI{n}{k}+\dstirlingII{n}{k}}{3}
\]
\end{document}