Correct alignment of multiple-line inequality
To get the proper alignment using the \phantom
method, you need to write \phantom{{}\leq{}}
rather than just \phantom{\leq}
. Providing the empty "math atoms", {}
, around \leq
informs TeX that it should treat \leq
as an object of type mathrel
("relational operator") rather than of type mathord
("ordinary math item").
You can also get the desired alignment without a \phantom
. Just (i) place the alignment symbol (&
) immediately before the \text{...}
instructions on all three lines and (ii) insert {}
between \leq
and &\text{...}
on lines 2 and 3.
\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{align*}
&\phantom{{}\leq{}} \text{this is the lower bound} \\
& \leq \text{this is the thing to be bounded} \\
& \leq \text{this is the upper bound}
\end{align*}
\begin{align*}
&\text{this is the lower bound} \\
\leq{} &\text{this is the thing to be bounded} \\
\leq{} &\text{this is the upper bound}
\end{align*}
\end{document}
You can also use \mathrel{\phantom{\leq}}
. Or simply insert the required whitespace by hand.
\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{align*}
& \mathrel{\phantom{\leq}} \text{this is the lower bound} \\
& \leq \text{this is the thing to be bounded} \\
& \leq \text{this is the upper bound}
\end{align*}
\begin{align*}
& \phantom{\leq} \; \; \text{this is the lower bound} \\
& \leq \text{this is the thing to be bounded} \\
& \leq \text{this is the upper bound}
\end{align*}
\end{document}
I wanted to add that surrounding, say, an equal sign with empty braces (i.e. \phantom{{}={}}
) to get the right alignment does not work if the equal sign is followed by an operator. What does work, however, is using \mathrel{\phantom{=}}
.
\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{align*}
&\phantom{{}={}} \sin(x) \\
&= \sin(x)
\end{align*}
\begin{align*}
&\mathrel{\phantom{=}} \sin(x) \\
&= \sin(x)
\end{align*}
\end{document}