TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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 occurrences it would be greatly appreciated,


share|improve this question
$$ 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 '14 at 19:18

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.



\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)}

enter image description here

share|improve this answer
Thanks, this fixed the problem!! – Aaron B Jun 30 '14 at 21:08

Your Answer


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.