TransWikia.com

Aligning Equation with cases

TeX - LaTeX Asked on November 9, 2021

What is required to make this equation look better? I have tried my skills but the 0 does not align well.

documentclass{article}
usepackage{amsmath}

 begin{document}

begin{align}
 R^* = begin{cases} 0 & dfrac{lnleft(frac{yuv}{{pi}lambda_{X}}+frac{y^2u}{{pi}}right)}{y 
 lambda_{T}}+dfrac{u}{lambda_{X}}leq 0 \ sqrt{dfrac{lnleft(frac{yuv}{{pi}lambda_{T}}+frac{y^2u}{{pi}}right)}{y lambda_{T}}+dfrac{u}{lambda_{T}}} & dfrac{lnleft(frac{yuv}{{pi}lambda_{X}}+frac{y^2u}{{pi}}right)}{y lambda_{X}}+dfrac{u}{lambda_{X}} > 0 end{cases}.
end{align}

end{document}

2 Answers

Maybe you can move the 0 a bit to the right, but the formula is awful to begin with, because the same complicated formula is typeset over and over again.

I suggest a much more economical version, under the assumption that all T's should be X's. Fix it, because the original doesn't seem correct.

documentclass{article}
usepackage{amsmath}

 begin{document}

begin{equation}
R^* =
begin{cases} 
  quad 0 & 
      dfrac{lnleft(frac{yuv}{{pi}lambda_{X}}+
      frac{y^2u}{{pi}}right)}{ylambda_{T}}+dfrac{u}{lambda_{X}}leq 0
\[4ex]
 sqrt{dfrac{lnleft(frac{yuv}{{pi}lambda_{T}}+frac{y^2u}{{pi}}right)}{y lambda_{T}}
 +dfrac{u}{lambda_{T}}} &
 dfrac{lnleft(frac{yuv}{{pi}lambda_{X}}+frac{y^2u}{{pi}}right)}{y lambda_{X}}
 +dfrac{u}{lambda_{X}} > 0
end{cases}.
end{equation}

begin{equation}
R^*=sqrt{maxleft{
  0,
    dfrac{1}{ylambda_{X}}lnleft(frac{yuv}{pilambda_{X}}+frac{y^2u}{pi}right)
    +dfrac{u}{lambda_{X}}
right}}
end{equation}

end{document}

enter image description here

Answered by egreg on November 9, 2021

I propose to use medium-sized fractions, defined in nccmath, and eqparbox to centre the 0 w.r.t. the below square root:

documentclass{article}
usepackage{nccmath, mathtools}
usepackage{eqparbox, booktabs}
newcommandeqmathbox[2][M]{eqmakebox[#1]{$displaystyle#2$}}

begin{document}

begin{align}
 R^* = begin{cases} eqmathbox{0} & text{if } mfrac{lnleft(frac{yuv}{{pi}lambda_{X}}+frac{y^2u}{{pi}}right)}{y
 lambda_{T}}+mfrac{u}{lambda_{X}}leq 0 ,\ addlinespace[2ex] eqmathbox{sqrt{mfrac{lnleft(frac{yuv}{{pi}lambda_{T}}+frac{y^2u}{{pi}}right)}{y lambda_{T}}+mfrac{u}{lambda_{T}}}} & text{if }mfrac{lnleft(frac{yuv}{{pi}lambda_{X}}+frac{y^2u}{{pi}}right)}{y lambda_{X}}+mfrac{u}{lambda_{X}} > 0 . end{cases}
end{align}

end{document} 

enter image description here

Answered by Bernard on November 9, 2021

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