Latex 分数

Latex 分数 首页 / Latex入门教程 / Latex 分数

分数定义为以分子和分母的形式表示的数值。

使用以下命令创建分数:

\frac{numerator}{denominator}

align 环境还用于实现分数,如下所示:

\begin{align*}
.......
\end{align*}

声明了 align 环境以对齐方程式。在一个环境中不可能写两个方程。为了克服这个问题,星号( * )与 align 命令一起使用。带有align的 * 符号表示未编号在此环境中输入的方程式。

下面给出了使用align环境的代码:

\documentclass[12pt]{article}
\usepackage{mathtools}
\begin{document}

\begin{align*}
  a + b = c \\
  5 - 4 = 1 \\
  x ^2 + y^2 = z^2
\end{align*}

\end{document}

输出将在单独的行中显示以上代码中列出的三个方程式,这在 equation 环境下是不可能的。您需要为每个方程式使用单独的方程式环境。

您会注意到以下输出:

Latex Fractions

对齐环境类别中通常有两个环境。

1) falign 环境用于在页边距两侧对齐文本。

下面给出了该示例的代码:

\documentclass[8pt]{article}
\usepackage{mathtools}
\begin{document}

\begin{flalign}
  a & = b &   % 对于第一列的元素,插入了两个与符号。
  12 & = 21 \\
  ABC & = DEF &
  c & = e + d
\end{flalign}

\end{document} 

输出:

Latex Fractions 1

multialign 环境用于在不同的行中对齐长文本。否则,文本将无法正确对齐。

让我们考虑一个例子。

  • 使用 multialign

此类示例的代码如下:

\documentclass[12pt]{article}
\usepackage{mathtools}
\begin{document}

\begin{multline}
  1 + 2 + 3 + 4 + 5 + 6 \\
  + 7 + 8 + 9 + 10 + 11 + 12 \\
  + 13 + 14 + 15 + 16 + 17 + 18
\end{multline}

\end{document}

输出:

Latex Fractions 2
  • 不使用 multialign

此类示例的代码如下:

\documentclass[12pt]{article}
\usepackage{mathtools}
\begin{document}

  1 + 2 + 3 + 4 + 5 + 6 \\
  + 7 + 8 + 9 + 10 + 11 + 12 \\
  + 13 + 14 + 15 + 16 + 17 + 18

\end{document}

输出:

Latex Fractions 3

分数类型

让我们通过几个例子来理解分数。

示例1:第一个示例的代码如下:

\documentclass[12pt]{article}
\usepackage{mathtools}
\begin{document}

\begin{align*}
  \frac{a}{b} = \frac{c}{d}
\end{align*}

\end{document}

输出:

Latex Fractions 4

示例2:第二个示例的代码如下:

\documentclass[12pt]{article}
\usepackage{mathtools}
\begin{document}

\begin{align*}
  r(x) = \frac{1}{x^2 + y^2 + z^2} = 1 \\\\% 您可以根据需要插入任何类型的分数。
  g(x) = \frac{\frac{1}{a}+\frac{1}{b}}{a - b} \\\\
  f(x) = \frac{a - b}{\frac{1}{a} - \frac{1}{b}} \\
\end{align*}

\end{document}

输出:

Latex Fractions 5

斜分数

小数通常在分子和分母之间具有一条直线。但是要创建分子和分母之间的斜线,可以使用\sfrac 命令。

\sfrac 命令用于创建斜线,而\frac 命令用于创建分子和分母之间的直线。

要实现\sfrac ,我们需要使用 xfrac 软件包。程序包写为\usepackage {xfrac}

数学math环境用于实现此类命令。该环境写为:

\begin{math}
..................
\end{math}

让我们用几个例子来理解。

示例1 :第一个示例的代码如下:

\documentclass[8pt]{article}
\usepackage{mathtools}
\usepackage{xfrac}
\begin{document}

\begin{math}
  $\sfrac{a}{b}$  \\ % 斜分数首先在数学模式中声明
  Fraction = \sfrac{a}{b}  % 声明后,您可以在文档的任何位置使用上述命令
\end{math}

\end{document}

输出:

Latex Fractions 6

示例2 :第二个示例的代码如下:

\documentclass[8pt]{article}
\usepackage{mathtools}
\usepackage{xfrac}
\begin{document}

\begin{math}
 Pour \: 5 \times $\sfrac{1}{2}$ \: water, \\\\
 = 2{}^1/_2 \: Liter   % 我们使用 \: 来保持单词之间的空格。您可以在文档中的任何地方使用,只要您需要在句子中的单词之间添加更多空格。
\end{math}

\end{document}

输出:

Latex Fractions 7

二项式

二项式模式通常在阶乘中使用。 \binom 命令用于以二项式形式表示变量。

让我们看一个例子。

链接:https://www.learnfk.comhttps://www.learnfk.com/latex/latex-fractions.html

来源:LearnFk无涯教程网

\documentclass[8pt]{article}
\usepackage{mathtools}
\usepackage{xfrac}
\begin{document}

\begin{align*}
  The \: formula \: for \: the \:Combination \:in \:Permutation \: and \: Combination \: is: \\
  \frac{n!}{r!(n-r)!} = \binom{n}{r} 
  % 默认情况下,单词之间没有空格。为了保持间距,在 Latex 中的每个单词之后都使用 \: 。
\end{align*}

\end{document}

输出:

Latex Fractions 8

平方根

根在数学中被广泛使用。 \sqrt { expression } 命令用于创建根。它被称为平方根。大括号内的表达式是词根下的术语。如果要更改根的大小,则需要使用\sqrt [ magnitude ] { expression } 命令。

下面是第一个示例的代码:

\documentclass[8pt]{article}
\usepackage{mathtools}
\usepackage{xfrac}
\begin{document}

\begin{align*}
  \sqrt{9} \\\\
  \sqrt{1 + x^2 + 2xy} \\\\
  \sqrt{\frac{a + b}{c - d}}
\end{align*}

\end{document}

输出:

Latex Fractions 9

下面给出第二个示例的代码:

\documentclass[8pt]{article}
\usepackage{mathtools}
\usepackage{xfrac}
\begin{document}

\begin{align*}
  \sqrt[a]{d} \\\\
  \sqrt[4]{16} = 2 \\\\
  \sqrt[3]{27} = 3   % 上面的例子是变化幅度的根源。您可以根据需要设置大小的值。
\end{align*}

\end{document}

输出:

Latex Fractions 10

连续分数

连续分数以梯形或连续形式表示。这些分数通常用于各种主题或主题的阶梯结构中。

\cfrac 命令用于实现连分数。

我们可以使用方程式环境来创建连续分数。

\documentclass[8pt]{article}
\usepackage{mathtools}
\usepackage{xfrac}
\begin{document}

The continue fraction is written as: \\
\begin{equation}
    x = b_0 + \cfrac{1}{b_1 + \cfrac{1}{b_2 + \cfrac{1}{b_3 + \cfrac{1}{b_4 + \cfrac{1}{ b_5 + \cfrac{1}{b_6} } } } } } 
\end{equation}
% 您可以根据需要添加任意数量的分数。
\end{document}

输出:

Latex Fractions 11

求和

sum命令用于插入求和符号。我们可以指定求和符号的参数和限制。

sum命令写为:

\sum{value at bottom of symbol}^{value at top of the symbol} text

让我们用两个例子来理解。

下面是第一个示例的代码:

\documentclass[12pt]{article}
\usepackage{mathtools}
\begin{document}

\begin{math}
  \sum_{i=0}^{N - 1} a_i % 您可以根据要求修改值
\end{math}

\end{document}

输出:

Latex Fractions 12

下面给出第二个示例的代码:

\documentclass[10pt]{article}
\usepackage{mathtools}
\begin{document}

\begin{math}
  \sum_{\substack{  % \substack 命令用于在多行中显示限制。
     0<i<k \\
     k<j<n
    }} 
   R(k,n)
\end{math}

\end{document}

输出:

Latex Fractions 13

祝学习愉快!(内容编辑有误?请选中要编辑内容 -> 右键 -> 修改 -> 提交!)

技术教程推荐

快速上手Kotlin开发 -〔张涛〕

Android开发高手课 -〔张绍文〕

Web协议详解与抓包实战 -〔陶辉〕

Linux实战技能100讲 -〔尹会生〕

移动端自动化测试实战 -〔思寒〕

图解 Google V8 -〔李兵〕

SRE实战手册 -〔赵成〕

流程型组织15讲 -〔蒋伟良〕

零基础GPT应用入门课 -〔林健(键盘)〕

好记忆不如烂笔头。留下您的足迹吧 :)