I am attempting to align the integral signs precisely, whilst still retaining the correct spacing around the equals signs. Why doesn't the following code get it exactly right?

\begin{align}
& \hphantom{{}={}} \int \\
& = \int \\
& = F
\end{align} An alternative approach would be to set the spacing based on the fact that = is a relation. Therefore, use \mathrel{\phantom{=}} (\hphantom is not really needed): \documentclass{article}
\usepackage{amsmath}

\begin{document}

\begin{align}
a & \mathrel{\hphantom{=}} \int \\
b & = \int \\
c & = F
\end{align}

\end{document}

• Thanks, that seems like a good option. I thought that \hphantom{{}={}} should effectively be telling LaTeX the same information as \mathrel, but I guess not. – bdforbes May 28 '15 at 6:02

Let's start with an analysis of math atoms and spacings between them:

& = \int


The align environment adds an invisible empty subformula {} at the start of the column:

{} = \int


A subformula is acts as \mathord. The following line shows the math atoms with their type in the subscript position:

{}ord =rel \intop

There is a table in "The TeXbook" from Donald E. Knuth or in section "23.6.1 Classification of mu glue" in book "TeX by Topic" from Victor Eijkhout, which shows the spacing between math atoms. The spacing information is put in the superscript position between the math atoms:

{}ord thick =rel thick \intop thin \intop

The same analysis for

& \hphantom{{}={}} \int


yields:

{}ord none { {}ord thick =rel thick {}ord }ord thin \intop

The \hphantom{...} acts as subformula. As can be seen, there is an additional thin space (\thinmuskip) between \hphantom{...} and the following operator.

This space can be canceled by \!:

& \hphantom{{}={}} \! \int


Macro \! negates the thin space, it is defined in LaTeX as:

\def\!{\mskip-\thinmuskip}


An alternative is to remove the empty subformulas in \hphantom and convert the \hphantom to a rel atom as a visible = would have been:

& \mathrel{\hphantom{=}} \int


Analysis:

{}ord thick { =rel }rel thick \intop

Example file with increased \thinmuskip to show the spacing problem more clearly:

\documentclass[a5paper]{article}

\usepackage{amsmath}

\begin{document}

\thinmuskip=40mu

\begin{align}
\texttt{\detokenize{& = \int}}\colon
& = \int \\
\texttt{\detokenize{& \hphantom{{}={}} \int}}\colon
& \hphantom{{}={}} \int \\
\texttt{\detokenize{& \hphantom{{}={}} \! \int}}\colon
& \hphantom{{}={}} \! \int \\
\texttt{\detokenize{& \mathrel{\hphantom{=}} \int}}\colon
& \mathrel{\hphantom{=}} \int
\end{align}
\end{document} 