# Line break and text arent working

I am new to LaTeX and I am having trouble with \text and line breaks.

My code is as such

$$\text{if} y^{(t)} \neq h(x; \theta, \theta_{0}) \text{then} \\ \theta^{(k+1)} = \theta^{k}+ y^{(t)}*x^{(t)}\\ \theta_{0} = \theta_{0}^{(k+1)} + y^{(t)}$$


When I try to compile in TexWorks I get an error, then when I take out the \text parts it compiles but without the line breaks.

If any one could explain these two occurences it would be greatly appreciated,

Thanks.

-
 should not be used in latex, for single line equations use $ $ or multiline use amsmath package and one of its environments such as align – David Carlisle Jun 30 at 19:18 ## 1 Answer You need amsmath package. gather is only an example of splitting. Choosing the proper one depends on the desired effect, in particular, the starred version omits equation numbering. \documentclass{article} \usepackage{amsmath} \begin{document} %
\begin{gather}
\text{if } y^{(t)} \neq h(x; \theta, \theta_{0}) \text{ then} \\
\theta^{(k+1)} = \theta^{k}+ y^{(t)}*x^{(t)}\\
\theta_{0} = \theta_{0}^{(k+1)}  + y^{(t)}
\end{gather}
%
\end{document}


-
Thanks, this fixed the problem!! –  Aaron B Jun 30 at 21:08