# align* not aligning properly with \sqrt

Using this, everything is aligned properly:

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{align*}
16x^2&=144&\text{| }&\text{sqrt}\\
4x&=12&\text{| }&\div\space 4\\
x&=\{3,-3\}
\end{align*}
\end{document}


However, if I change \text{sqrt} to \sqrt in an attempt to try to use the square root symbol instead, the text which is on the next line of code is put on the same line, right next to the square root symbol.

-
you cannot write \sqrt, that is the macro. Use \text{\textbackslash sqrt}. Or do you want the symbol for the root, like √? –  Herbert Feb 28 at 14:04
@Herbert That renders as a literal \textbackslash sqrt. (Yes, I want the symbol. I updated my question to reflect that.) –  nyuszika7h Feb 28 at 14:05

The symbol for the square root is available as \surd:

\documentclass{article}

\usepackage{amsmath}
\begin{document}
\begin{alignat*}{2}
2x\times8x&=144  &&|\ \text{simplify}\\
16x^2&=144       &&|\ \surd\\
4x&=12           &&|\ {\div\; 4}\\
\end{alignat*}
\end{document}


You're missing the negative solution, however.

Here's a mathematically correct version of the original. The negative root is still missed.

\documentclass{article}

\usepackage{amsmath}
\begin{document}
\begin{alignat*}{2}
4x\times8x&=144  &&|\ \text{simplify}\\
32x^2&=144       &&|\ \surd\\
4\sqrt{2}\,x&=12 &&|\ {\div\; 4\sqrt{2}}\\
\end{alignat*}
\end{document}


-
Interesting. Is that any different from \sqrt{}? Also, thanks for the \quad trick. (Note: I've updated the question my a simpler (correct) equation, please update your answer to reflect that.) –  nyuszika7h Feb 28 at 14:39
@nyuszika7h It's wrong anyway –  egreg Feb 28 at 14:41
How so? I checked it with WA, if you mean -3 being another possible solution, I know that. I've updated my question to reflect that now. –  nyuszika7h Feb 28 at 14:42
As a side note, I thought \quad was for the division, but I overlooked it. –  nyuszika7h Feb 28 at 14:49
@nyuszika7h It's for setting the horizontal separation –  egreg Feb 28 at 14:50

run with xelatex or lualatex:

\documentclass{article}
\usepackage{amsmath}
\usepackage{unicode-math}
\begin{document}
\begin{align*}
4x\times8x&=144&\text{| }&\text{simplify}\\
32x^2&=144&\text{| }&\text{√}\\
32x&=12&\text{| }&\div\space 32\\
x&=\frac{12}{32}=\frac{3}{8}=\underline{\underline{0.375}}
\end{align*}

\end{document}


However, you forgot to take the root from 32! ;-)

-
I wouldn't have thought of using literal Unicode characters. That's one possible way to solve it, too. (Apparently, you can also use \sqrt{}). Thanks for the hint on the equation, I made that up quickly, so I forgot. Annoyingly enough, the square root of 32 is an irrational number. –  nyuszika7h Feb 28 at 14:17
I've updated the question my a simpler (correct) equation, please update your answer to reflect that. –  nyuszika7h Feb 28 at 14:39

\sqrt command requires an argument. Type \sqrt{} instead of \sqrt. Try also \sqrt{\phantom{16}} to have a more pretty root symbol.

-
Yeah, I already figured that out. Thanks for the \phantom tip though! –  nyuszika7h Feb 28 at 16:38