Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Although I searched the Web and indeed found an answer here, I still seem unable to address my issue of aligning two rows in my step-by-step process for solving a very basic equation. Just in case it matters, I am using MathJax, which is a JavaScript library that renders LaTeX in various forms of output (in my case, as MathML and HTML/CSS).

My code:

    \hphantom{-} 9 + x &=& 12   \\
    -9 \hphantom{+ x} &=& -9    \\
    \hline                      \\
    \implies x &=& 3

My goal is to get the "9" to align in the first two rows, however, the \hphantom macro in the first row isn't adjusting the 9 + x = 12 at all. I came up with the code using the help of people who answered a similar alignment question elsewhere here.

I noted that when I reversed the first two rows in my code, \hphantom did indeed align the 9 correctly.

I would appreciate anyone helping me determine if there is an issue with my LaTeX. If not, I can investigate the HTML/CSS layout issues.

share|improve this question
Yes, it matters because MathJaX is not really TeX, it only uses TeX for markup. Though, you can try \hphantom{{} + x}. And do not use eqnarray: eqnarray vs align –  Qrrbrbirlbel Mar 3 '13 at 6:29
Thank you, @Qrrbrbirlbel, your suggestion addressed the problem perfectly. I'll better keep in mind that MathJax may have discrepancies down the line, as well. EDIT: also, I wasn't aware of the issues of eqnarray, thank you for the reference! –  Curtis Mar 3 '13 at 7:25
Summarize your findings (and the comments) into an answer, and later accept it to close the issue. –  vonbrand Mar 3 '13 at 17:46

1 Answer 1

up vote 1 down vote accepted

Thanks to @Qrrbrbirlbel, I was able to address the problem by using: \hphantom{{} + x}. So, if you're a MathJax user, this does address the issue.

Although I have yet to turn up on the Web further information as to why this alteration fixes things, it's nevertheless useful to keep in mind.

share|improve this answer
The spacing rules are in the TeXbook. + is class \mathbin when between to ordinary (\mathord) symbols such as x, 9 or {}, otherwise it is an ordinary symbol. No spacing is placed between mathord's, whereas Ord-Bin-Ord gets extra spacing around the binary operator. The reason that a unitary + should be placed right up by the symbol it affects, whereas a binary one should be spaced off from its symbols. –  Andrew Swann Mar 11 '13 at 8:04

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.