[LaTex]分数和二项式

分数和二项式系数是具有相似特征的常见数学元素 —— 一个数字位于另一个数字之上。 本文介绍了如何在LATEX中对它们进行排版。

引言

在表达式中使用分数和二项式系数很简单直观的。

The binomial coefficient is defined by the next expression:

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

为了使这些命令起作用,必须在文件的序言中添加如下一行来导入包amsmath:

\usepackage{amsmath}

显示分数

分数的外观可能会根据上下文而变化

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 将更改分数的样式,就好像它是文本的一部分一样。

连续分数

分数的用法非常灵活,可以嵌套它们以获得更复杂的表达式。

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}}}
\]

上一个示例中显示的第二个小数部分使用了软件包amsmath提供的命令\cfrac {} {}(请参见介绍),该命令显示嵌套的小数部分而不更改字体大小。 对连续分数特别有用。

二项式系数

二项式系数是数学表达式中的常见元素,在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}\).

如您所见,命令 \binom {} {} 将使用括号内传递的参数来打印二项式系数。

参考指南

与连续分数的稍有不同并且更复杂的示例

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}
  }}}
\]

 

完整的源码:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{geometry}
\geometry{textwidth=7cm}
\usepackage{amsmath}

\title{Fractions and Binomials}
\author{An example from Overleaf}

\begin{document}

\maketitle
%Introductory example
%--------------------------------------------------------------------
Given two polynomials $P(x)$ and $Q(x)$, a rational expression can be defined as the ratio of the two polynomials
$f(x)=\frac{P(x)}{Q(x)}$. These expressions are also called polynomial fractions.
%--------------------------------------------------------------------

\vspace{1cm}

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}\]

\vspace{1cm}


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)} \]

\vspace{1cm}

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}}}
\]

\newpage
%Combinatorial coefficients
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}\).

\vspace{1cm}

%Final examaple
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}
  }}}
\]





\end{document}

翻译如下文章:

原文:https://www.overleaf.com/learn/latex/Fractions_and_Binomials

  • 1
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值