# Align at multiple points in math environment

Consider the following equation: which I produced with the following code:

\begin{equation}
\begin{gathered}
\mathbb{P}\left\{\vect{x}_i \in \mathscr{N}(H_{\vect{\uplambda}})\right\} \geq \frac{2^{n - r}}{2^n} = 2^{-r} \quad \forall i, \, 1 \leq i \leq \ceil*{\frac k n} \\
\begin{aligned}
\Longrightarrow \mathbb{P}\left\{\vect{x}_1, \ldots, \vect{x}_{\ceil*{\frac k n}} \in\ \mathscr{N}(H_{\vect{\uplambda}})\right\} &= \prod\nolimits_{i = 1}^{\ceil*{\frac k n}} \mathbb{P}\left\{\vect{x}_i \in \mathscr{N}(H_{\vect{\uplambda}})\right\} \\ &\geq 2^{-\ceil*{\frac k n} r}
\end{aligned}
\end{gathered}\label{eq:prob}
\end{equation}


Now, as you can see, the \mathbb{P}'s are not aligned too well (and the misalignment would get even greater if line #2 was made bigger). So my question is, what would be the best way to align them?

Using aligned and similar environments, I'd need 1 alignment point in line #1 (the \mathbb{P}), two in line #2 (the first \mathbb{P} and the =), and one in line #3 (the \geq). I don't think it's possible to have a variable number of alignment points, so I'm lost.

Please ignore the custom commands (such as \vect, which is basically a wrapper for \bm and \mathrm). Thanks.

EDIT: Here's a full snippet that can be used to reproduce the equation:

\documentclass[a4paper]{article}

\usepackage{amsmath,amssymb,amsthm}
\usepackage{bm}
\usepackage{mathrsfs}
\usepackage{mathtools}
\usepackage{upgreek}

\newcommand{\vect}{\bm{\mathrm{#1}}}
\DeclarePairedDelimiter{\ceil}{\lceil}{\rceil}

\begin{document}

\begin{equation}
\begin{gathered}
\mathbb{P}\left\{\vect{x}_i \in \mathscr{N}(H_{\vect{\uplambda}})\right\} \geq \frac{2^{n - r}}{2^n} = 2^{-r} \quad \forall i, \, 1 \leq i \leq \ceil*{\frac k n} \\
\begin{aligned}
\Longrightarrow \mathbb{P}\left\{\vect{x}_1, \ldots, \vect{x}_{\ceil*{\frac k n}} \in\ \mathscr{N}(H_{\vect{\uplambda}})\right\} &= \prod\nolimits_{i = 1}^{\ceil*{\frac k n}} \mathbb{P}\left\{\vect{x}_i \in \mathscr{N}(H_{\vect{\uplambda}})\right\} \\ &\geq 2^{-\ceil*{\frac k n} r}
\end{aligned}
\end{gathered}\label{eq:prob}
\end{equation}

\end{document}


Use nested aligned. Keep in mind that for some reason aligned adds some space before it, which you have to remove manually by, e.g. \!. Also you don't have to load amsmath if you load mathtools.

\documentclass{article}
\usepackage{mathtools,amssymb}
\usepackage{bm}
\usepackage{mathrsfs}
\usepackage{upgreek}

\newcommand{\vect}{\bm{\mathrm{#1}}}
\DeclarePairedDelimiter{\ceil}{\lceil}{\rceil}
\begin{document}
\begin{equation}
\begin{aligned}
&\mathbb{P}\left\{\vect{x}_i \in \mathscr{N}(H_{\vect{\uplambda}})\right\} \geq \frac{2^{n - r}}{2^n} = 2^{-r} \quad \forall i, \, 1 \leq i \leq \ceil*{\frac k n} \\
\Longrightarrow \;&\!\begin{aligned}[t]
\mathbb{P}\left\{\vect{x}_1, \ldots, \vect{x}_{\ceil*{\frac k n}} \in\ \mathscr{N}(H_{\vect{\uplambda}})\right\} &= \prod\nolimits_{i = 1}^{\ceil*{\frac k n}} \mathbb{P}\left\{\vect{x}_i \in \mathscr{N}(H_{\vect{\uplambda}})\right\} \\ &\geq 2^{-\ceil*{\frac k n} r}
\end{aligned}
\end{aligned}\label{eq:prob}
\end{equation}
\end{document}  An alternative to nesting is to use a single alignment but hide the width of the first line.

\documentclass[a4paper]{article}

\usepackage{amsmath,amssymb,amsthm}
\usepackage{bm}
\usepackage{mathrsfs}
\usepackage{mathtools}
\usepackage{upgreek}

\newcommand{\vect}{\bm{\mathrm{#1}}}
\DeclarePairedDelimiter{\ceil}{\lceil}{\rceil}

\begin{document}

\begin{equation}
\begin{alignedat}{2}
&\mathbb{P}\left\{\vect{x}_i \in \mathscr{N}(H_{\vect{\uplambda}})\right\} \geq \frac{2^{n - r}}{2^n} = 2^{-r} \quad \forall i, \, 1 \leq i \leq \ceil*{\frac k n} \hspace{-\textwidth}\\
{}\Longrightarrow{}
&\mathbb{P}\left\{\vect{x}_1, \ldots, \vect{x}_{\ceil*{\frac k n}} \in\ \mathscr{N}(H_{\vect{\uplambda}})\right\} &&= \prod\nolimits_{i = 1}^{\ceil*{\frac k n}} \mathbb{P}\left\{\vect{x}_i \in \mathscr{N}(H_{\vect{\uplambda}})\right\} \\
&&&\geq 2^{-\ceil*{\frac k n} r}
\end{alignedat}
\label{eq:prob}
\end{equation}

\end{document}