I would like to align the parenthesis in following two equations using \hphantom

\documentclass[varwidth]{standalone}
\begin{document}
\noindent
$d\cdot i\hphantom{j}\qquad\hphantom{-}\;(\ldots)$\\
$d\cdot j\hphantom{i}\qquad-(\ldots)$
\end{document}


I know I could use the align environment. But I was wondering if it is possible to fix this easily by understanding which whitespace is missing.

• \hphantom doesn't take into account spaces around sign -. For test compare $d\cdot i\hphantom{j}\qquad\hphantom{-}(\ldots)$\\ $d\cdot j\hphantom{i}\qquad{-}(\ldots)$ with your MWE. With otherword, to - in \hphantom you should add those spaces (~\,\;) – Zarko Jan 22 '16 at 9:23
• \hphantom{{}-{}} and no \; – egreg Jan 22 '16 at 9:23

Use \mathbin{}

\documentclass[varwidth]{standalone}
\begin{document}
\noindent
$d\cdot i\hphantom{j}\qquad\mathbin{\hphantom{-}}(\ldots)$\\
$d\cdot j\hphantom{i}\qquad-(\ldots)$
\end{document}


https://www.sharelatex.com/learn/Spacing_in_math_mode

For relational operators, such as < , > and =, LaTeX establishes \thickmuskip space. But for binary operators such as +, - and x, the \medmuskip space is set. The difference is almost unnoticeable.

You can force the spacing used in binary or relational operators, so you can define your own.

\begin{align*}
34x^2a \mathbin{\#} 13bc \\
34x^2a \mathrel{\#} 13bc
\end{align*}


The previous example sets a particular spacing before and after # by using \mathrel (relational) and \mathbin (binary) commands.