[Tex/LaTex] Problem with fraction and align environment – “&” symbol

alignhorizontal alignment

I am new in LaTeX, thus I need your help.

I want to align the \leq symbol under the + symbol. The problem is that the + symbol is contained inside a fraction, therefore, the \begin{aligned}--\end{aligned} environment, does not allow me to insert the & symbol inside this certain fraction.

How can I achieve this without having any problems?

An example:

$\displaystyle \begin{aligned}
\sqrt{\frac{2x}{y **&+** z}}+\sqrt{\frac{2y}{z+x}}+\sqrt{\frac{2z}{x+y}}\\
&\leq 3.
\end{aligned}$

P.S I have searched the site but I haven't found anything similar with my problem. (maybe I am not searching, right?)

Best Answer

I would recommend a different approach and that is to use an \hphantom to insert the appropriate amount of horizontal space:

enter image description here

Notes:

  • I used \hphantom instead of \phantom as I did not want the vertical size of \sqrt{{\frac{2x}{y **}}} to affect the second row.
  • Alignment points located inside other terms such as \sqrt and frac are not usually this easy to do, and David's solution was quite clever in moving it outside and inserting a negative \hspace. I personally would never have thought of that as I tend to think of alignment form the left moving towards the right.

Code:

\documentclass{article}
\usepackage{amsmath}

\begin{document}

$\displaystyle \begin{aligned}
&\sqrt{\frac{2x}{y **+** z}}+\sqrt{\frac{2y}{z+x}}+\sqrt{\frac{2z}{x+y}}\\
&\hphantom{\sqrt{{\frac{2x}{y **}}}}\leq 3.
\end{aligned}$

\end{document}
Related Question