\lim 是什么,它的条件为什么会挪位置
\lim 不是自带两个槽位的符号,而是一个数学算子——和 \max、\sum 同一类东西——在 LaTeX 内核里被声明成包进 \mathop 的一个正体名字。没有显式极限标记的算子会走 TeX 的默认值,而整套机制就藏在这个默认里:display 样式下,下标落到正下方、上标落到正上方,因为没有正文行需要保护;text 样式下两者都挪到侧面,因为叠起来的条件会比周围的字更高。amsmath 把这两条默认暴露成后贴开关 \displaylimits 与 \nolimits,而内核给 \sin 这一类名字用的正是 \nolimits,这就是它们从来不收纳极限的原因。
所以段落里的 $\lim_{n \to \infty} a_n$ 与独占一行的 \[ \lim_{n \to \infty} a_n \] 之间的差别,既不是排版事故,也不是什么要「修」的东西。有两个命令能在每次出现处盖掉默认:\lim\limits_{n \to \infty} 强行堆叠(行距你来付),\lim\nolimits_{n} 即使在 display 里也强行贴侧——条件很短、推导又密时,这是一个实实在在的排版选择。
条件的大小从不随位置改变:两种情形下都是 scriptstyle。这就是为什么 \lim_{x \to a^{+}} \frac{f(x)-f(a)}{x-a} 再往上下标里添结构会小到没法读——极限那个槽位是放短语的,不是放段落的。
\lim_{x \to a} f(x) = L
\lim_{n \to \infty} a_n \qquad \lim\limits_{n \to \infty} a_n \qquad \lim_{h \to 0^{+}} \frac{1}{h}
花括号:条件是一个整体参数
下标槽和数学里其它槽一样遵守单记号规则。\lim_x 只会把一个光秃秃的 x 放到 \lim 下面;\lim_{x \to 0} 放进去的才是整个短语。出错方式既安静又有辨识度:\lim_x \to 0 f(x) 编译通过,产生一个下标 x,然后把 \to 0 以正常高度当作正文行里的关系符印出来——一条说了你没说的话的公式,而且一眼看上去还挺像样。它是学生 LaTeX 里最高频的极限错误,恰恰因为输出并不难看,只是错。
同一个坑也等着等号右边。\lim_{n \to \infty} \frac{3n^{2}+1}{n^{2}-5} = 3 是关于一个数列的陈述;把表达式整个省掉的 \lim_{n \to \infty} = 3(手写带出来的习惯,纸上极限号在视觉上「扛着」表达式)是合法的 TeX 构造、却是一句废话。真想把表达式从算子上挪开,就连算子一起去掉:\frac{3n^{2}+1}{n^{2}-5} \to 3 再配一句 as n \to \infty,既更短、行内更好读,也不可能丢掉操作对象。
花括号还能层层嵌套:\lim_{n \to \infty} \lim_{m \to \infty} a_{n,m} 是两个算子各带一个括起来的条件,而不是 \lim_{n,m \to \infty}——后者是另一件(也更少见的)断言。
\lim_{n \to \infty} \frac{3n^{2}+1}{n^{2}-5} = 3 \qquad \lim_{x \to 0^{+}} \frac{1}{x} = +\infty
\lim_{x \to a} f(x) = L \qquad f(x) \to L \text{ as } x \to a
箭头:to、rightarrow 与趋近方向
\to 和 \rightarrow 是同一个数学字符的两个名字——同一字形、同一间距类别,一篇文档里挑一个用到底。\longrightarrow 更长,写在极限条件里通常是错的,因为那会让下标比它所隶属的算子还宽;它划得来的地方是当标签载体,比如 a_n \xrightarrow{n \to \infty} a,读作「a 子 n 收敛到 a」,而收敛方式写在箭头上。
方向编码在符号里。x \to a^{+} 与 x \to a^{-} 就是单侧极限,上标属于 a 不属于箭头,所以带括号的形式是 \lim_{x \to 0^{+}}。x \nearrow a、x \searrow a、x \uparrow、x \downarrow 除了极限还一并断言单调性,这是一条实实在在的数学声明:只在数列或参数确实递增、确实递减时才用。概率与统计里,\xrightarrow{p} 与 \xrightarrow{d} 表示依概率收敛与依分布收敛是通行惯例,也比塞一句 \text{…} 清楚得多。
还有一个常被压平的区别:\mapsto 把元素映到它的像(f \colon x \mapsto x^{2}),\to 把空间映到空间(f \colon \mathbb{R} \to \mathbb{R})。把对应规则写成 f : x \to x^{2} 是记号错误,审稿人会圈出来,这跟间距无关。
x \to \infty \qquad x \to -\infty \qquad x \to a^{-} \qquad x \nearrow a \qquad x \downarrow a
a_n \xrightarrow{n \to \infty} a \qquad a_n \overset{n \to \infty}{\longrightarrow} a \qquad a_n \to a
\documentclass[11pt,a4paper]{article}
\usepackage[T1]{fontenc}
\usepackage{amsmath,amssymb}
% A labelled arrow: the mode of convergence goes over the arrow, not in \text{}
\newcommand{\asto}{\xrightarrow{\;a \to \infty\;}}
\newcommand{\wpconv}{\xrightarrow{\;\mathrm{p}\;}}
\DeclareMathOperator*{\esssup}{ess\,sup}
\title{Arrows, limits and honest infinity}
\author{A. Student}
\date{\today}
\begin{document}
\maketitle
\section{The same character, three names}
\[
x \to \infty \qquad x \rightarrow \infty \qquad x \longrightarrow \infty
\]
The first two are identical in output; the long form only pays for itself
when it carries a label, as in \(a_n \asto a\).
\section{Direction of approach}
\[
x \to 0^{+}, \quad x \to 0^{-}, \quad a_n \nearrow a, \quad b_n \downarrow b
\]
The last two assert monotonicity, so use them only when the sequence is in
fact increasing or decreasing --- they are claims, not decorations.
\section{Divergence, in words}
Writing \(\lim_{x \to 0} 1/x = \infty\) hides a sign disagreement between
the one-sided limits. Say what happens:
\[
\lim_{x \to 0^{+}} \frac{1}{x} = +\infty,
\qquad
\lim_{x \to 0^{-}} \frac{1}{x} = -\infty,
\qquad
\lim_{x \to 0} \frac{1}{x} \text{ does not exist}.
\]
\end{document}
两个条件,以及多元函数的极限
需要一对条件的极限应该把它们叠起来,而 amsmath 在下标槽里干这件事的工具恰好只有一个:\substack。\lim_{\substack{x \to a \\ y \to b}} f(x,y) 把两行都居中、按 scriptstyle 排,并让整块留在极限槽位之内,于是 \lim 仍然是个算子。变体 \begin{subarray}{l}…\end{subarray} 同样干这件事但改成左对齐,两行共享同一前缀、只想让各自不同的尾巴对齐时用它。
另一条路是把趋近写成关于一个点的单一陈述:\lim_{(x,y) \to (0,0)}。这才是多元极限的诚实形式,因为它说的是「沿任何路径」;而把两个独立条件 \substack 在一起说的是另一件微妙不同的事——两个变量各自趋于,而非联合趋于。把两者混为一谈是一个数学错误,而 LaTeX 会一声不响地替你排出来。
该避开的是 \underset{n \to \infty}{\lim},很多人把它当成强制堆叠的法子发现了。它并不等价:\underset 是用 \lim 造一个「底下挂东西的普通符号」,结果丢了算子类别——两侧间距换成关系符的胶合宽度,条件相对名字如何居中由整个构造的宽度决定,而且之后再写 \limits 也不起作用了。\lim\limits_{n \to \infty} 同样能把活干对。
\lim_{\substack{x \to a \\ y \to b}} f(x,y) \qquad \lim_{(x,y) \to (0,0)} \frac{xy}{x^{2}+y^{2}}
\iint\limits_{\substack{0 \le t \le T \\ x \in \Omega}},以及 \sum_{\substack{i+j=n \\ i,j \ge 0}}。和 lim 行为一致的那批算子
认清这一族,就能完全不靠手搭。\limsup 与 \liminf 是预定义的,接受条件的方式和 \lim 一模一样;\varlimsup 与 \varliminf 是 AMS 风格的变体,无论哪种样式都把条件永远放在下方,它们存在是因为有些期刊对这两种写法排得不一样。\sup、\inf、\max、\min 属于 \displaylimits 算子,所以 \max_{1 \le i \le n} a_i 在 display 里堆叠、在行内贴侧——同一套自动行为,不需要 \limits。amsmath 的 \injlim 与 \projlim 给出正向极限与逆向极限,声明时带星号,因此在 display 里总是堆叠。
名单之外的名字归你管。只用一次:\operatorname*{arg\,min}_{x \in C} f(x)——星号买来的就是极限堆叠,里面那个 \, 保住两个词不被排成一个词。全文使用就在导言区声明一次:\DeclareMathOperator*{\argmin}{arg\,min}。少了星号,你拿到的是同样正体、但条件永远挂在侧面的名字,「在某集合上取 arg min」就是这么被写成下标事故的样子。
两种失败方式值得在别人的源码里一眼认出来。\arg\min_{x} 是两个算子粘在一起,条件只挂在 \min 上,于是名字印成「arg」后面跟一个堆叠的 min——每一层都是错的。而 \mathrm{arg\,min}_{x} 是一个 ordinary 原子,条件在 display 里停在侧面、看上去比应有的小;在它后面写 \limits 不只是难看,而是硬错误:「Limit controls must follow a math operator」。
\varlimsup_{n \to \infty} a_n \qquad \varinjlim_{i} A_i \qquad \projlim_{n} X_n
\max_{1 \le i \le n} a_i \qquad \sup_{x \in D} f(x) \qquad \operatorname*{arg\,min}_{x \in C} f(x)
无穷:这个符号被允许声称什么
\infty 是一个界限,不是一个数,排版要跟着这条事实走。x \to \infty 说的是变量怎么增长;+\infty 与 -\infty 区分扩实轴的两端,所以介绍它们的正确写法是 \overline{\mathbb{R}} = \mathbb{R} \cup \{-\infty, +\infty\}。别在独立成行的公式里把这个符号当算术材料用:\infty - \infty、把分式两边的 \infty 约掉、\frac{\infty}{\infty},全都能排得很漂亮而毫无含义;未定式属于极限,那里有箭头告诉你什么在趋近。
\lim_{x \to 0} \frac{1}{x} = \infty 这一句正是记号与数学打架的地方:两个单侧极限符号相反,所以正确的事实是 \lim_{x \to 0^{+}} \frac{1}{x} = +\infty、\lim_{x \to 0^{-}} \frac{1}{x} = -\infty,而不带限定的那个极限不存在。用「= \infty」表示发散是一些领域的约定、另一些领域拒绝它;两种都行,但第一次用到时说明你指的是哪个,也别和 \to 混在同一个 display 里。
别把 \infty 和基数符号搞混。\aleph_0 是 \mathbb{N} 的势,把它当作实数数列的极限毫无道理;\omega 在集合论里是序数、在物理里是频率,两种用法下它都是一个名字而不是界限。对 TeX 来说它们都只是普通符号,所以什么都不会提醒你。
\overline{\mathbb{R}} = \mathbb{R} \cup \{-\infty, +\infty\}
\sum_{n=1}^{\infty} a_n \text{ converges} \implies a_n \to 0
量词、epsilon 与一条定义需要的间距
epsilon–delta 定义是一堵短句拼起来的墙,它好不好读本质上是个间距问题。量词 \forall \varepsilon \gt 0 与 \exists \delta \gt 0 彼此是关系符,TeX 已经在它们之间放了厚胶合;在 \text{such that} 之前、或者在冒号之前补一个 \;,能防止逻辑部分和叙述部分糊在一起。\varepsilon 与 \delta 请一贯到底,别和 \epsilon 之类变体混着用——选哪个是自由的,不一致是看得见的,而 \varepsilon 才是多数分析教材用的月牙形。
蕴含箭头 \Rightarrow(或者自带空格的 \implies)在单独一行里把假设与结论分开;英文该写逗号的地方,在数学里写 \; 或 \quad,永远不是敲一个空格。如果这一行长到这份上,它其实是想当一个 aligned 或 gathered 块:第一行放条件,第二行放不等式。
定义里用到的冒号,在 TeX 眼里是标点——\{x \in \mathbb{R} : x \gt 0\} 会把冒号紧贴前面那个符号。关系类别的 \mid 给出分隔符想要的左右平衡间距,\colon 则是为映射准备的;这两件事在间距那一课里都会细讲,而一行「读起来别扭」的公式缺的通常就是它们中的一个。
\forall \varepsilon > 0 \; \exists \delta > 0 \; \text{such that} \; 0 \lt \lvert x - a \rvert \lt \delta \Rightarrow \lvert f(x) - L \rvert \lt \varepsilon
把极限写成让读者只解析一次的样子
论文里排得好的极限,几乎全部出自三条规则。条件挂在正在趋近的那个东西上,而不是句尾:写 \lim_{n \to \infty} a_n,不写 \lim a_n, \; n \to \infty。行文里优先用箭头形式 f(x) \to L,后面补 as x \to a——它留在基线上、不吃行距,而且读起来是一句话。当极限只是推导的一步时,在 aligned 的每一行都把算子重复写出来,别留一个空悬的 = \lim 让读者把条件跨行往下搬。
在 display 里保留堆叠形式时,顺带看一眼尾巴:\lim_{n \to \infty} \left(1 + \frac{x}{n}\right)^{n} = e^{x} 里那个自动缩放的括号,高度由分式决定,于是整块比极限号高出一层。这在行间无所谓,也正是同样这一行不该拿去写行内的原因之一;同一恒等式的行内版本是 (1 + x/n)^{n} \to e^{x},既更短,在正文字号下也更清楚。
最后,把「当 n \to \infty」当正文写进 display 需要 \text{as } n \to \infty——空格要写在大括号里面,写在外面会被丢掉。这个小细节就是「as n→∞」与「asn→∞」的差别,每次往数学里塞字都值得一查。
\left(1 + \frac{x}{n}\right)^{n} \to e^{x} \quad \text{as } n \to \infty
\documentclass[11pt,a4paper]{article}
\usepackage[T1]{fontenc}
\usepackage{amsmath,amssymb}
% A new operator whose condition must stack: the star is the declaration
\DeclareMathOperator*{\esssup}{ess\,sup}
\DeclareMathOperator{\supp}{supp}
\DeclareMathOperator{\plim}{plim} % no star: the condition always sits at the side
\title{Limits: notation and typography}
\author{A. Student}
\date{\today}
\begin{document}
\maketitle
\section{Display and inline}
In a display the condition goes underneath:
\[
\lim_{x \to 0} \frac{\sin x}{x} = 1.
\]
In running text the same source keeps it at the side, and that is the
behaviour you want --- forcing \verb|\lim\limits| inline opens the line.
Where the sentence is long, prefer the narrative form: as \(x \to \infty\),
\(f(x) \to 0\).
\section{One-sided and multivariable limits}
\[
\lim_{x \to 0^{+}} \ln x = -\infty,
\qquad
\lim_{\substack{(x,y) \to (0,0) \\ x \ne y}} \frac{xy}{x - y} \text{ does not exist}.
\]
\section{Definitions with quantifiers}
\[
\forall \varepsilon > 0 \; \exists N \in \mathbb{N} \; \forall n > N
\; : \; \lvert a_n - a \rvert \lt \varepsilon .
\]
The \verb|\;| between quantifiers is a thick space; a \verb|:| alone is
punctuation and will hug the symbol before it.
\section{Limits inside an aligned derivation}
\begin{align}
\frac{\mathrm{d}}{\mathrm{d}x} x^{2}
&= \lim_{h \to 0} \frac{(x+h)^{2} - x^{2}}{h} \notag \\
&= \lim_{h \to 0} (2x + h) = 2x.
\end{align}
Note that \verb|\lim| is repeated on the second line rather than written
as an empty \verb|&= \lim| --- a bare operator with no operand is legal
TeX and a reading error for the reader.
\end{document}
本课速查
每节抽一行关键代码:点小节名跳到对应位置,代码一键复制。
\lim_{x \to a} f(x) = L
\lim_{n \to \infty} \frac{3n^{2}+1}{n^{2}-5} = 3 \qquad \lim_{x \to 0^{+}} \frac{1}{x} = +\infty
\documentclass[11pt,a4paper]{article}
\lim_{\substack{x \to a \\ y \to b}} f(x,y) \qquad \lim_{(x,y) \to (0,0)} \frac{xy}{x^{2}+y^{2}}
\varlimsup_{n \to \infty} a_n \qquad \varinjlim_{i} A_i \qquad \projlim_{n} X_n
\overline{\mathbb{R}} = \mathbb{R} \cup \{-\infty, +\infty\}
常见错误
\lim_x \to 0 f(x):条件是一个多记号短语,必须括起来。少了括号,\to 0就以正常高度印在正文行里,整句话的意思跟着变。- 把
lim_{x \to 0}的反斜杠丢了:三个斜体变量相乘、下标贴在侧面、也没有正体算子名。 - 用
\underset{n \to \infty}{\lim}来强制堆叠。它改了原子类别、让条件不居中、还使后面的\limits失去意义;正确的构造是\lim\limits_{n \to \infty}。 - 两个词的名字写成
\arg\min_{x}或\mathrm{arg\,min}_{x}。用一次\operatorname*{arg\,min}_{x},或者在导言区\DeclareMathOperator*{\argmin}{arg\,min}。 - 在句子中间掏出
\lim\limits,只为让公式和上面那行 display 长得一样。堆叠装不进行高,TeX 只会把行距撑开:行内请用箭头形式。 \lim_{x \to 0} \frac{1}{x} = \infty只字不提单侧极限。两边符号相反,双侧极限并不存在——要么就这么说,要么写成x \to 0^{+}。- 一段里用
= \infty表示「数列无上界」,下一段又改用「发散」这个词:挑一个约定、说明一次,并且把箭头写法挡在同一个 display 之外。
关于本课的常见问题
怎么让 x → 0 出现在 LaTeX 里 lim 的正下方?
\lim_{x \to 0} f(x),条件会自动落到下方,因为 \lim 是一个 \displaylimits 算子。行内数学里它按设计停在侧面;\lim\limits_{x \to 0} 能强行堆叠,但会把这一行撑高,请省着用。为什么我的极限箭头印在 lim 旁边而不是下面?
\lim 按设计把条件放在侧面;要么你忘了花括号:\lim_x \to 0 f(x) 只把 x 放到下面,箭头以正常高度印回正文行。写成 \lim_{x \to 0} f(x),想在句子里堆叠就用 \lim\limits。\to 和 \rightarrow 有区别吗?
\longrightarrow 是更长的箭头,主要价值是在 \xrightarrow{n \to \infty} 这类写法里当标签载体;写进极限条件会让下标比算子本身还宽。LaTeX 里怎么写左极限和右极限?
\lim_{x \to 0^{+}} f(x) 与 \lim_{x \to 0^{-}} f(x)。需要单调趋近的记号时,x \nearrow a 与 x \downarrow a 除了极限还断言变量在朝极限递增或递减。limsup 和 liminf 怎么排?
\limsup 与 \liminf 是预定义的,接受条件的方式与 \lim 完全相同。\varlimsup 与 \varliminf 是 AMS 变体,在行文样式和行间样式里都把条件堆在下方,一些期刊要的就是这种。一个极限下面要挂两个条件怎么写?
\substack:\lim_{\substack{x \to a \\ y \to b}}。它保持两行居中、按 scriptstyle 排,并且不改变 \lim 的算子身份。但如果确实是二元函数的极限,\lim_{(x,y) \to (0,0)} 才是数学上正确的形式。实时演示:直接编辑 LaTeX,立刻看渲染结果
预览随输入实时更新——不妨故意写坏一次,看看报错长什么样。
继续读
同一个东西的三个入口:记法本身、讲它的那一课、以及真正用它写东西的一篇文章。