【Overleaf 中可以很容易编辑文章和查看生成的文章预览效果】
数学表达式中在涉及指数,索引以及某些特殊运算符时,上标和下标的使用非常普遍。 本文介绍了如何在简单的表达式,积分,求和等中编写上标和下标。
介绍
定积分是一些最常见的数学表达式,让我们看一个例子:
\[ \int\limits_0^1 x^2 + y^2 \ dx \]
在LATEX中,下标和上标使用符号^和_编写,在本例中,使用这些代码编写 x 和 y 指数。 这些代码也可以用于某些类型的数学符号,在示例中包括的积分,_用于设置下限,^用于设置上限。 命令\limits更改了极限在积分中的显示方式,如果不存在,则极限将在积分符号旁边而不是顶部和底部。
更详细的例子
符号_和^也可以在同一表达式中组合,例如:
\[ a_1^2 + a_2^2 = a_3^2 \]
如果表达式包含长上标或下标,则需要将它们放在大括号中,因为LATEX通常将数学命令^和_仅应用于它的下一个字符:
\[ x^{2 \alpha} - 1 = y_{ij} + y_{ij} \]
下标和上标可以以多种方式嵌套和组合。 但是,在嵌套下标/上标时,请记住,每个命令都必须引用一个元素。 如上例所示,它可以是单个字母或数字,也可以是大括号或圆括号中收集的更复杂的数学表达式。 例如:
\[ (a^n)^{r+s} = a^{nr+ns} \]
使用下标和上标的运算符
一些数学运算符可能需要下标和上标。 最常见的情况是积分\int(参考介绍中的例子)和求和(\sum)运算符,它们的范围是使用下标和上标精确排版的。
\[ \sum_{i=1}^{\infty} \frac{1}{n^s}
= \prod_p \frac{1}{1 - p^{-s}} \]
对于其他需要下标/上标的常用运算符,请参阅下面的参考指南。
参考指南
LATEX标记 | 渲染为 |
a_{n_i} | |
\int_{i=1}^n | |
\sum_{i=1}^{\infty} | |
\prod_{i=1}^n | |
\cup_{i=1}^n | |
\cap_{i=1}^n | |
\oint_{i=1}^n | |
\coprod_{i=1}^n |
还有bigcup和bigcap命令,类似于cup和cap,但较大用于较大的表达式。
完整代码以及生成的文档
\documentclass{article}
\usepackage[utf8]{inputenc}
\title{Subscripts and Superscripts}
\author{An example from Overleaf}
\begin{document}
\maketitle
%-----------------------------------------------------------
Here are some examples of simple usage of subscripts and superscripts:
\[ \int\limits_0^1 x^2 + y^2 \ dx \]
witout limits
\[ \int_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} \]
\[ a_{n_i} \]
\[ \int_{i=1}^n \]
\[ \sum_{i=1}^{\infty} \]
\[ \prod_{i=1}^n \]
\[ \cup_{i=1}^n \]
\[ \cap_{i=1}^n \]
\[ \oint_{i=1}^n \]
\[ \coprod_{i=1}^n \]
\[ \bigcup_{i=1}^n \]
\[ \bigcap_{i=1}^n \]
\end{document}
翻译如下文章
原文:https://www.overleaf.com/learn/latex/Subscripts_and_superscripts