centering a part of an equation
1. Aligned with \rightarrow
You can align it with the \rightarrow
as such:
Notes:
- You can use
align*
so that you don't need to add\nonumber
to each line. - Usually you would not want to put the alignment at the beginning of the first term, so I have moved it to be before the
\rightarrow
.
2. Centered with \rightarrow
:
A better solution is to use \makebox
to get the vdots
centered within the space of the \rightarrow
:
Notes:
- This requires the use of the
calc
package. - This has the benefit that no manual guessing of spacing is required. Hence, this solution can easily be adapted to other cases.
3. Centered with \rightarrow
(with other enhancements)
I have provided another version which:
Incorporates Werner's recommendation of using Consistent typography by defining a
\nat
macro.Incorporates egreg's recommendation to eliminate the space prior to the comma.
This yields:
Code: aligned with \rightarrow
\documentclass[12pt,letter]{report}
\usepackage{amsmath}
\begin{document}
\begin{align}
X_{1} &\rightarrow\mathcal{N}\left(A\right) \nonumber \,,\\
X_{2} &\rightarrow\mathcal{N}\left(B\right) \nonumber \,,\\
&\vdots \nonumber
\\X_{A-1} &\rightarrow\mathcal{N}\left(C\right) \nonumber\,, \\
X_{A} &\rightarrow\mathcal{N}\left(D\right) \nonumber \,, \\
X &\rightarrow\mathcal{N}\left(E\right)\,.
\end{align}
\begin{align*}
X_{1} &\rightarrow\mathcal{N}\left(A\right) \,,\\
X_{2} &\rightarrow\mathcal{N}\left(B\right) \,,\\
&\vdots \nonumber
\\X_{A-1} &\rightarrow\mathcal{N}\left(C\right) \,, \\
X_{A} &\rightarrow\mathcal{N}\left(D\right) \,, \\
X &\rightarrow\mathcal{N}\left(E\right)\,.
\end{align*}
\end{document}
Code: centered with \rightarrow
\documentclass[12pt,letter]{report}
\usepackage{amsmath}
\usepackage{calc}
\begin{document}
\begin{align*}
X_{1} &\rightarrow\mathcal{N}\left(A\right) \,,\\
X_{2} &\rightarrow\mathcal{N}\left(B\right) \,,\\
&\makebox[\widthof{${}\rightarrow{}$}][c]{\vdots}
\\X_{A-1} &\rightarrow\mathcal{N}\left(C\right) \,, \\
X_{A} &\rightarrow\mathcal{N}\left(D\right) \,, \\
X &\rightarrow\mathcal{N}\left(E\right)\,.
\end{align*}
\end{document}
3. Code: centered with \rightarrow
(with other enhancements)
\documentclass[12pt,letter]{report}
\usepackage{amsmath}
\usepackage{calc}
\newcommand{\nat}[1]{\mathcal{N}(#1)}
\begin{document}
\begin{align*}
X_{1} &\rightarrow \nat{A}, \\
X_{2} &\rightarrow \nat{B}, \\
&\makebox[\widthof{${}\rightarrow{}$}][c]{\vdots} \\
X_{A-1} &\rightarrow \nat{C}, \\
X_{A} &\rightarrow \nat{D}, \\
X &\rightarrow \nat{E}.
\end{align*}
\end{document}
You can do it like this. Notice the additionally needed package mathtools
:
\documentclass{article}
\usepackage{mathtools}
\begin{document}
\begin{align}
X_{1} &\rightarrow\mathcal{N}\left(A\right) \nonumber \,,\\
X_{2} &\rightarrow\mathcal{N}\left(B\right) \nonumber \,,\\
&\,\mathclap{\phantom{\rightarrow}\vdots} \nonumber\\
X_{A-1} &\rightarrow\mathcal{N}\left(C\right) \nonumber\,, \\
X_{A} &\rightarrow\mathcal{N}\left(D\right) \nonumber \,, \\
X &\rightarrow\mathcal{N}\left(E\right)\,.
\end{align}
\end{document}
\end{document}
The construction \,\mathclap{\phantom{\rightarrow}\vdots}
is a trick to make \vdots
center with respect to the width of \rightarrow
. As well, I consider the alignment by the arrows to be more proper here. (As @egreg correctly points out, I should have used a larger space \;
here. However, this smaller one seems to work well because \rightarrow
is an assymetric symbol.)
Yet another variation on the above:
\documentclass[12pt,letter]{report}
\usepackage{amssymb,amsmath}
\begin{document}
\begin{align}
\begin{split}
X_{1} & \rightarrow\mathcal{N}\left(A\right) \,,\\
X_{2} & \rightarrow\mathcal{N}\left(B\right) \,,\\
& \mspace{10mu}\vdots \\
X_{A-1} & \rightarrow\mathcal{N}\left(C\right) \,, \\
X_{A} & \rightarrow\mathcal{N}\left(D\right) \,, \\
X & \rightarrow\mathcal{N}\left(E\right)\,.
\end{split}
\end{align}
\end{document}