# Align sign with numerator

I have an equation for which I would like the sign to be aligned with the numerator without being a part of it. As a rough example,

$- \frac{\sqrt{3q\times r^2}}{y \times z}$


produces

but I would prefer

Rationale: While, in the example above, the default layout is actually better, in my actual document the relevant fraction is coming after a new line and the minus sign is easy to miss. Moving it up to the level of the numerator would make it more conspicuous.

• \frac{-\sqrt{3q\times r^2}}{y \times z} is more mathematically true. – JouleV Feb 18 at 10:39
• @JouleV Absolutely! Unfortunately, my example above is meant to be indicative of my problem without containing too much unecessary clutter, and (while a good representation of the question I'm asking) is maybe not a good representation of my actual maths. – owjburnham Feb 18 at 10:42
• @JouleV more mathematically true? What does that mean? – JPi Feb 18 at 13:12
• @JPi I meant that it is true and the OP's is false. But as the OP wants to have the wrong one, I said "more mathematically true". – JouleV Feb 18 at 13:22
• @JouleV I agree with you in the example I gave. For what it’s worth, my imagined use case was (very roughly) a/b - x/y. In that case, I’d imagine that a/b -x/y (with the sign as part of the numerator) might risk looking like a/b times -x/y. I don’t know whether, in that case, you would agree? – owjburnham Feb 18 at 13:33

Anyway, the customer's always right. ;-)

Load mathtools and do

\hphantom{-}\frac{\mathmakebox[0pt][r]{-}\sqrt{3q\times r^2}}{y\times z}


There is a shorthand for \mathmakebox[0pt][r]{...}, namely \mathllap{...}.

• thanks for help me to know about the tag \mathmakebox... – MadyYuvi Feb 18 at 11:03
• Following JouleV's comment ( tex.stackexchange.com/questions/475470/… ), I also began to disagree with my own rationale (in the particular case in which I was asking the question). But I figured that the question was worth letting stand for future benefit ;-) Thanks for the solution. – owjburnham Feb 18 at 11:04
• simpler code: \mathllap{-} instead of \mathmakebox – daleif Feb 18 at 14:30
• @barbarabeeton the only thing I'm replacing in egregs code is \mathmakebox[0pt]{r}{-} the rest is the same including the hphantom. – daleif Feb 18 at 16:23