# [Tex/LaTex] How to align (1) and (2)

vertical alignment

The following code

\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


produces

How can I align the (1) and (2), and also get (2) to be on the same line as (n=1,2,3,…)?

I highly suggest to use a different approach:

\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}


Please read the comments in the code and What are the differences between , \[, align, equation and displaymath?. Other useful staff is written in https://ctan.org/pkg/short-math-guide, https://ctan.org/pkg/lshort-english, and What are good learning resources for a LaTeX beginner?.