LaTex 数学之上标与下标
上标和下标的使用在涉及指数、索引和一些特殊运算符的数学表达式中非常常见。本文解释了如何在简单的表达式、积分、求和等中编写上标和下标。
定积分是一些最常见的数学表达式,让我们看一个例子:
\[ \int\limits _ 0 ^ 1 x^ 2 + y^ 2 \ dx \]
这个 LaTeX 代码产生:
按照惯例, L A T E X中的上标和下标分别使用字符^
和创建_
;例如,在上面的的代码片段中指数应用x和y上面。这些字符也可以与数学符号一起使用,例如上面示例中包含的整数(\int
),其中_
用于设置下限和^
用于设置上限。
该命令\limits
更改限制在积分中的显示方式,如果不存在,限制将在积分符号旁边而不是在顶部和底部:
更详细的例子
符号_
和^
也可以组合在同一个表达式中,例如:
\[ a_1^2 + a_2^2 = a_3^2 \]
这个 LaTeX 代码产生:
如果表达式包含长上标或下标,则需要将它们收集在大括号{...}
中,因为L a T e X通常将数学命令应用于以下字符: ^_
\[ x^{ 2 \alpha } - 1 = y_{ij} + y_{ij} \]
这个 LaTeX 代码产生:
下标和上标可以以多种方式嵌套和组合。但是,在嵌套下标/上标时,请记住每个命令必须引用单个元素;这可以是单个字母或数字,如上面的示例中所示,也可以是大括号或括号中收集的更复杂的数学表达式。例如:
\[ ( a^n ) ^{r + s} = a^{nr + ns} \]
使用下标和上标的运算符
一些数学运算符可能需要下标和上标。最常见的情况是积分\int
和求和(\sum
)运算符,它们的边界用下标和上标精确排版。
\[ \sum_{i=1}^{\infty} \frac{1}{n^s}
= \prod_p \frac{1}{1 - p^{-s}} \]
对于其他需要下标/上标的常用运算符,请查看参考指南。
在 Overleaf 中打开所有代码片段
\documentclass{article}
\begin{document}
Here are some examples of simple usage of subscripts and superscripts:
\[ \int\limits_0^1 x^2 + y^2 \ dx \]
\vspace{1cm}
Using superscript and subscripts in the same expression
\[ a_1^2 + a_2^2 = a_3^2 \]
\vspace{1cm}
Longer subscripts and superscripts:
\[ x^{2 \alpha} - 1 = y_{ij} + y_{ij} \]
\vspace{1cm}
Nested subscripts and superscripts
\[ (a^n)^{r+s} = a^{nr+ns} \]
\vspace{1cm}
Example of a mathematical equation with subscripts and superscripts
\[ \sum_{i=1}^{\infty} \frac{1}{n^s} = \prod_p \frac{1}{1 - p^{-s}} \]
\vspace{1cm}
Squared root usage
\[ \sqrt[4]{4ac} = \sqrt{4ac}\sqrt{4ac} \]
\end{document}
参考指南
其他示例和运算符
L A T E X标记 | 呈现为 |
---|---|
a_{n_i} | a n i {\displaystyle a_{n_{i}}} ani |
\int_{i=1}^n | ∫ i = 1 n {\displaystyle \int _{i=1}^{n}} ∫i=1n |
\sum_{i=1}^{\infty} | ∑ i = 1 ∞ {\displaystyle \sum _{i=1}^{\infty }} i=1∑∞ |
\prod_{i=1}^n | ∏ i = 1 n {\displaystyle \prod _{i=1}^{n}} i=1∏n |
\cup_{i=1}^n | ∪ i = 1 n {\displaystyle \cup _{i=1}^{n}} ∪i=1n |
\cap_{i=1}^n | ∩ i = 1 n {\displaystyle \cap _{i=1}^{n}} ∩i=1n |
\oint_{i=1}^n | ∮ i = 1 n {\displaystyle \oint _{i=1}^{n}} ∮i=1n |
\coprod_{i=1}^n | ∐ i = 1 n {\displaystyle \coprod _{i=1}^{n}} i=1∐n |
还有与 and类似的bigcup 和 bigccap 命令,但这些命令用于更大的表达式。 |