下面的代码
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{amsthm}
\usepackage{amsmath}
\usepackage[left=1.5in, right=1.5in, top=0.5in]{geometry}
\newtheorem{definition}{Definition}
\newtheorem{theorem}{Theorem}
\theoremstyle{remark}
\begin{document}
\title{Extra Credit}
\maketitle
\begin{definition}
If f is analytic at $z_0$, then the series
$$f(z_0) + f'(z_0)(z-z_0) + \frac{f''(z_0)}{2!}(z-z_0)^2 + \cdots = \sum_{n=0}^{\infty} \frac{f^{(n)}(z_0)}{n!}(z-z_0)^n \hspace{1cm}(1)$$
is called the Taylor series for f around $z_0$.
\end{definition}
\begin{theorem}
If f is analytic inside and on the simple closed positively oriented contour $\Gamma$ and if $z_0$ is any point inside $\Gamma$, then
$$f^{(n)}(z_0) = \frac{n!}{2\pi i} \int_{\Gamma} \frac{f(\zeta)}{(\zeta - z_0)^{n+1}}d\zeta \hspace{1cm} (n=1,2,3, \cdots )$$ \hfill (2)
\end{theorem}\hrulefill
我怎样才能对齐 (1) 和 (2),并且让 (2) 与 (n=1,2,3,...) 位于同一条线上?
答案1
我强烈建议使用不同的方法:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{amsthm}
\usepackage{amsmath}
\usepackage[left=1.5in, right=1.5in, top=0.5in]{geometry}% I do not recommend to use this naiv canons of page construction for typographic reasons.
\usepackage[noabbrev]{cleveref}%new package
\newtheorem{definition}{Definition}
\newtheorem{theorem}{Theorem}
\theoremstyle{remark}
\begin{document}
\title{Extra Credit}
\maketitle
\begin{definition}
If f is analytic at $z_0$, then the series
\begin{align}%observe that empty line is removed
f(z_0) + f'(z_0)(z-z_0) + \frac{f''(z_0)}{2!}(z-z_0)^2 + \cdots = \sum_{n=0}^{\infty} \frac{f^{(n)}(z_0)}{n!}(z-z_0)^n \label{eq:Taylor}
\end{align}%observe that empty line is removed
is called the \emph{Taylor series} for f around $z_0$.%The definition is not in italics here to emphasize the term.
\end{definition}
\begin{theorem}
If f is analytic inside and on the simple closed positively oriented contour $\Gamma$ and if $z_0$ is any point inside $\Gamma$, then
\begin{align}
f^{(n)}(z_0) = \frac{n!}{2\pi i} \int_{\Gamma} \frac{f(\zeta)}{(\zeta - z_0)^{n+1}}d\zeta \hspace{1cm} (n=1,2,3, \cdots ).%every parenthesis should be ended with a dot.
\end{align}
\end{theorem}
\noindent\hrulefill %alternative: \hrule
You can use refer to the equation by: \eqref{eq:Taylor} or \cref{eq:Taylor}. %This is the usual approach to refer to formulas.
\end{document}
请阅读代码中的注释并 $$、\[、align、equation 和 displaymath 之间有什么区别?. 其他有用的人员写在https://ctan.org/pkg/short-math-guide,https://ctan.org/pkg/lshort-english, 和对于 LaTeX 初学者来说有哪些好的学习资源?。
答案2
使用另一种方法,equation
环境如下:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{amsthm}
\usepackage{amsmath}
\usepackage[left=1.5in, right=1.5in, top=0.5in]{geometry}
\newtheorem{definition}{Definition}
\newtheorem{theorem}{Theorem}
\theoremstyle{remark}
\begin{document}
\title{Extra Credit}
\maketitle
\begin{definition}
If f is analytic at $z_0$, then the series
\begin{equation}
f(z_0) + f'(z_0)(z-z_0) + \frac{f''(z_0)}{2!}(z-z_0)^2 + \cdots = \sum_{n=0}^{\infty} \frac{f^{(n)}(z_0)}{n!}(z-z_0)^n
\end{equation}
is called the Taylor series for f around $z_0$.
\end{definition}
\begin{theorem}
If f is analytic inside and on the simple closed positively oriented contour $\Gamma$ and if $z_0$ is any point inside $\Gamma$, then
\begin{equation}
f^{(n)}(z_0) = \frac{n!}{2\pi i} \int_{\Gamma} \frac{f(\zeta)}{(\zeta - z_0)^{n+1}}d\zeta \hspace{1cm} (n=1,2,3, \cdots )
\end{equation}
\end{theorem}
\hrulefill
\end{document}
答案3
(La)TeX 的一个主要功能是它能够自动为您编号章节、定理、列表项等。这包括方程式!使用
\begin{equation}
\label{somename}
e=mc^2
\end{equation}
创建一个按顺序带有下一个数字的方程式,您可以使用 引用它\eqref{somename}
。就像其他自动编号的东西一样,您可以在这个方程式之前插入一个新的编号方程式,所有数字都会正确更新。您可以使用 环境创建未编号的方程式equation*
(或者,输入更少的文字\[ ... \]
)。其他类似方程式的环境也有一个*
不编号的版本。
(此外,我强烈建议对同一系列中的所有定义、定理等进行编号。当看到引理 3 和定义 5 无法提示您是否应该向前看还是向后看时,在长文档中寻找定理 4 真的很烦人。)