Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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.

share|improve this question
    
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
add comment

3 Answers 3

up vote 10 down vote accepted

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}\\
x&=\frac{12}{4}=\underline{\underline{3}}\quad
\end{alignat*}
\end{document}

You're missing the negative solution, however.

enter image description here

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}}\\
x&=\frac{12}{4\sqrt{2}}=\frac{3}{\sqrt{2}}\approx\underline{\underline{2.12132}}\quad
\end{alignat*}
\end{document}

enter image description here

share|improve this answer
    
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
add comment

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}

enter image description here

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

share|improve this answer
    
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
add comment

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

share|improve this answer
    
Yeah, I already figured that out. Thanks for the \phantom tip though! –  nyuszika7h Feb 28 at 16:38
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.