# \phantom not giving correct space?

The code

\begin{alignat*}{2}
d\bigl(x^{(j)}_j, x^{(i)}_i\bigr)
& \le d\bigl(x^{(j)}_j, x^{(i)}_j\bigr) + d\bigl(x^{(i)}_j, x^{(i)}_i\bigr)\\
& < d\bigl(x^{(j)}_j, x^{(j)}_k\bigr) + d\bigl(x^{(j)}_k, x^{(i)}_k\bigr) + d\bigl(x^{(i)}_k, x^{(i)}_j\bigr) & \text{$k$ arbitrary}\\
& \phantom{d\bigl(x^{(j)}_j, x^{(j)}_k\bigr) + d\bigl(x^{(j)}_k, x^{(i)}_k\bigr)} {}+ 1/i & \text{let $j\ge i$}\\
& < 1/j + d\bigl(x^{(j)}_k, x^{(i)}_k\bigr) + 1/j +1/i & \text{let $k\ge j$}\\
& \le 2/i + \hat d\bigl( \overline{x^{(j)}}, \overline{x^{(i)}} \bigr) + 1/i & \text{taking $k\to \infty$}\\
& < 2/j + 2/i & \text{since $j\ge i$}
\end{alignat*}


produces:

What is the cause of this miscalculated width of the box that \phantom creates? And how to get + 1/i placed directly below the + that appears in the above line?

You forgot to put {}< at the beginning of the \phantom.

\documentclass{article}
\usepackage{amsmath}

\begin{document}

\begin{alignat*}{2}
d\bigl(x^{(j)}_j, x^{(i)}_i\bigr)
& \le d\bigl(x^{(j)}_j, x^{(i)}_j\bigr) + d\bigl(x^{(i)}_j, x^{(i)}_i\bigr)\\
& < d\bigl(x^{(j)}_j, x^{(j)}_k\bigr)
+ d\bigl(x^{(j)}_k, x^{(i)}_k\bigr)
+ d\bigl(x^{(i)}_k, x^{(i)}_j\bigr) & \text{$k$ arbitrary}\\
& \phantom{{}< d\bigl(x^{(j)}_j, x^{(j)}_k\bigr)
+ d\bigl(x^{(j)}_k, x^{(i)}_k\bigr)}
+ 1/i & \text{let $j\ge i$}\\
& < 1/j + d\bigl(x^{(j)}_k, x^{(i)}_k\bigr) + 1/j +1/i & \text{let $k\ge j$}\\
& \le 2/i + \hat d\bigl( \overline{x^{(j)}}, \overline{x^{(i)}} \bigr)
+ 1/i & \text{taking $k\to \infty$}\\
& < 2/j + 2/i & \text{since $j\ge i$}
\end{alignat*}

\end{document}


A better version with no \big delimiter and a couple of thin spaces next to the overlined symbols:

\documentclass{article}
\usepackage{amsmath}

\begin{document}

\begin{alignat*}{2}
d(x^{(j)}_j, x^{(i)}_i)
& \le d(x^{(j)}_j, x^{(i)}_j) + d(x^{(i)}_j, x^{(i)}_i)\\
& < d(x^{(j)}_j, x^{(j)}_k)
+ d(x^{(j)}_k, x^{(i)}_k)
+ d(x^{(i)}_k, x^{(i)}_j) & \text{$k$ arbitrary}\\
& \phantom{{}< d(x^{(j)}_j, x^{(j)}_k)
+ d(x^{(j)}_k, x^{(i)}_k)}
+ 1/i & \text{let $j\ge i$}\\
& < 1/j + d(x^{(j)}_k, x^{(i)}_k) + 1/j +1/i & \text{let $k\ge j$}\\
& \le 2/i + \hat d(\, \overline{x^{(j)}}, \overline{x^{(i)}}\, )
+ 1/i & \text{taking $k\to \infty$}\\
& < 2/j + 2/i & \text{since $j\ge i$}
\end{alignat*}

\end{document}


• Really dig the suggestion to have thin spaces around the overlined things. Wish I could upvote it one more time just for this!
– Atom
Feb 24 at 15:37