[翻译] [LaTeX] 分式和二项式 - Fractions and Binomials

原  文:Fractions and Binomials
译  者:Xovee
翻译时间:2020年6月24日

Fractions and Binomials

分式和二项式系数是非常常见的数学元素,它们有着一些共同的特点:一个数字位于另外一个数字的上方。本篇文章解释如何在 LaTeX 中输入它们。

介绍

在表达式中使用分式和二项式是非常直接的:

The binomial coefficient is defined by the next expression:

\[
    \binom{n}{k} = \frac{n!}{k!(n-k)!}
\]

在这里插入图片描述
为了让这些命令生效,你必须先引入amsmath包,在文档的序言部分引入:

\usepackage{amsmath}

在 Overleaf 中打开这个例子

分式

分式的样式取决于它所在的上下文环境:

Fractions can be used alongside the text, for 
example \( \frac{1}{2} \), and in a mathematical 
display style like the one below:

\[\frac{1}{2}\]

在这里插入图片描述

你肯定已经猜到了,\frac{1}{2}就是输入分式的命令。在命令的两个大括号里,分别是分子和分母。

另外,分式的大小取决于它所在的环境。你可以手动设置这一点:

When displaying fractions in-line, for example \(\frac{3x}{2}\) 
you can set a different display style: 
\( \displaystyle \frac{3x}{2} \).

This is also true the other way around

\[ f(x)=\frac{P(x)}{Q(x)} \ \ \textrm{and} 
\ \ f(x)=\textstyle\frac{P(x)}{Q(x)} \]

在这里插入图片描述
命令\displaystyle会将分式的样式设置为展示模式下的样式。相对地,命令\textstyle会将分式的样式设置为行内模式下的样式。

在 Overleaf 中打开这个例子

连续分式

分式的使用方法非常灵活,它们可以互相嵌套:

The fractions can be nested

\[ \frac{1+\frac{a}{b}}{1+\frac{1}{1+\frac{1}{a}}} \]

Now a wild example

\[
  a_0+\cfrac{1}{a_1+\cfrac{1}{a_2+\cfrac{1}{a_3+\cdots}}}
\]

在这里插入图片描述

在上一个例子中,我们使用了\cfrac{}{}命令,这个命令由amsmath包提供,它可以让嵌套的分式拥有相同的字体大小。这一点在连续分式中非常有用。

在 Overleaf 中打开这个例子

二项式系数

在数学表达式中,二项式系数经常出现。这个命令在 LaTeX 中与分式命令非常类似:

The binomial coefficient is defined by the next expression:

\[
    \binom{n}{k} = \frac{n!}{k!(n-k)!}
\]

And of course this command can be included in the normal 
text flow \(\binom{n}{k}\).

在这里插入图片描述

在 Overleaf 中打开这个例子

参考指南

下面展示一个不同的更复杂的连续分式:

Final example

\newcommand*{\contfrac}[2]{%
{
  \rlap{$\dfrac{1}{\phantom{#1}}$}%
  \genfrac{}{}{0pt}{0}{}{#1+#2}%
}
}
\[
  a_0 +
  \contfrac{a_1}{
  \contfrac{a_2}{
  \contfrac{a_3}{
  \genfrac{}{}{0pt}{0}{}{\ddots}
  }}}
\]

在这里插入图片描述

延伸阅读

更多信息请见:

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章