# Align: one line centered and the next right-justified

Consider the following code:

\documentclass{amsart}
\usepackage{amsthm, amssymb, amsfonts}

\begin{align*}
F_{X^2}(x) = P(X^2 \leq x) = P(X \leq \sqrt{x}) = F_{X}(\sqrt{x}) =
\sqrt{x}
\\
F_{Y^2}(y) = P(Y^2 \leq y) = P(-\sqrt{y} \leq Y \leq \sqrt{y}) =
F_{Y(\sqrt{y}) - F_{Y}(-\sqrt{y}) =
\\
\frac{\sqrt{y}- (-1)}{2} - \frac{- \sqrt{y}-(-1)}{2} = \sqrt{y}
\end{align*}

\end{document}


Note I am making two statements, the first of which takes one line, and the second of which takes up two lines. As written, all three lines are right-justified. It would seem that it would make more sense to the reader if the first line were centered, and the third line were right-justified, so that it is clear that it is a continuation of line two. Does anyone have a tip for how to achieve this? Should I make the first line its own block, in other words, use  for the first line, and align for the second line?

Any other suggestions as to how to make my meaning visually clear are welcome.

I propose two possibilities (I guessed the definition of \p)

\documentclass[reqno, 11pt]{amsart}
\usepackage{mathtools}
\DeclareMathOperator\p{P}

\begin{document}
First attempt:
\begin{align*}
F_{X^2}(x) &= \p(X^2 \leq x) = \p(X \leq \sqrt{x}) = F_{X}(\sqrt{x}) = \sqrt{x}
\\
F_{Y^2}(y) &=
\!\begin{multlined}[t]
\p(Y^2 \leq y) = \p(-\sqrt{y} \leq Y \leq \sqrt{y}) =
F_{Y}(\sqrt{y}) - F_{Y}(-\sqrt{y}) = \\
\frac{\sqrt{y}- (-1)}{2} - \frac{- \sqrt{y}-(-1)}{2} = \sqrt{y}
\end{multlined}
\end{align*}

Second attempt:
\begin{align*}
F_{X^2}(x) &= \p(X^2 \leq x) = \p(X \leq \sqrt{x}) = F_{X}(\sqrt{x}) = \sqrt{x} \\[2ex]
F_{Y^2}(y) &= \p(Y^2 \leq y) = \p(-\sqrt{y} \leq Y \leq \sqrt{y}) \\
&= F_{Y}(\sqrt{y}) - F_{Y}(-\sqrt{y}) =
\frac{\sqrt{y}- (-1)}{2} - \frac{- \sqrt{y}-(-1)}{2} = \sqrt{y}
\end{align*}

\end{document}


I would prefer the second one, actually, that makes the development clearer, in my opinion.

• Thanks, that looks great. Is the \\[2ex] command part of a broader family of commands? – Eric Auld Sep 26 '13 at 0:50
• @EricAuld -- specifying a dimension in brackets following a double backslash is the "conventional" latex method for indicating that the amount of space indicated is to be added between the line just ended and the next line. if an amsmath environment is in effect, do not leave a space before the opening bracket -- there were so many questions about errors when a bracketed math expression was input at the beginning of the new line that a trap was put in to allow a space (or eol) to decouple the usual option checking for a "skip" instruction. – barbara beeton Sep 26 '13 at 15:34

Here's an example that, as an alternative, stacks the rows with different alignments, rather than using the align environment. The space between the rows is controlled, as well.

\documentclass{amsart}
\usepackage{amsthm, amssymb, amsfonts}
\usepackage{stackengine}
\stackMath
\begin{document}
\def\stackalignment{l}\stackanchor[3ex]{%
F_{X^2}(x) = P(X^2 \leq x) = P(X \leq \sqrt{x}) = F_{X}(\sqrt{x}) =
\sqrt{x}
}{%
\def\stackalignment{r}\stackunder[1.5ex]{%
F_{Y^2}(y) = P(Y^2 \leq y) = P(-\sqrt{y} \leq Y \leq \sqrt{y}) =%
F_Y(\sqrt{y}) - F_{Y}(-\sqrt{y}) %
}{\displaystyle%
= \frac{\sqrt{y}- (-1)}{2} - \frac{- \sqrt{y}-(-1)}{2} = \sqrt{y}%
}%
}
\end{document}