TransWikia.com

Alignment in cases environment with hphantom

TeX - LaTeX Asked on December 17, 2020

I am using the hphantom command to center the middle 0, but the middle 0 is still too far left.

Here is a picture of my problem:

enter image description here

Here is my MWE:

documentclass{article}
usepackage[utf8]{inputenc}
usepackage{amsmath}


begin{document}

begin{align}
    Delta G = 
    begin{cases}
            < 0 & quad A
            hphantom{<}  0 &  quad B
            > 0 & quad C  
    end{cases}
end{align}

end{document}

2 Answers

You can do (quick and dirty)

documentclass{article}
usepackage[utf8]{inputenc}
usepackage{amsmath}


begin{document}

begin{align}
    Delta G =
    begin{cases}
            < 0 & quad A
            hphantom{< mbox{}}  0 &  quad B
            > 0 & quad C 
    end{cases}
end{align}

end{document}

enter image description here

Correct answer by Denis on December 17, 2020

You need an empty relation symbol with the same width as > (or <):

documentclass{article}
usepackage{amsmath}

begin{document}

begin{equation}
Delta G =
  begin{cases}
  < 0 & A
  mathrel{phantom{<}} 0 & B
  > 0 & C
  end{cases}
end{equation}

end{document}

I wouldn't add quad. Avoid the trailing ; while it has no effect in this particular case, it would have in align or similar constructions, producing an empty line. Also avoid align for a single equation.

enter image description here

But why not using =0?

Answered by egreg on December 17, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP