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 have a very simple LaTeX problem with the following LaTeX fragment:

The function computes:
  e \leftarrow (((x||a) + (y||b)) \oplus y,\\
  r \leftarrow x + y

The result should then be in two lines, however, using the code above write me the whole equation in one line. Anyone an idea how I could force here a linebreak so that it looks something like:

The function computes:
e <--- bla bla
r <--- x + y
share|improve this question

migrated from stackoverflow.com Jun 29 '11 at 11:28

This question came from our site for professional and enthusiast programmers.

the \[ ... \] method of setting a display can handle only one line.

the amsmath package provides a number of environments that set multiple lines in various arrangements. see the manual for details. since you apparently want a display with no number, you need to use a starred environment; @huitseeker has already suggested

  e \leftarrow bla bla \\
  r \leftarrow x + y

and that's a good answer, but he first suggested eqnarray, which is generally bad for mathematical documents. see this article by lars madsen for the reasons.

although no alignment is explicitly requested, it's implicit in the example shown that it is actually wanted. without specifying an alignment point (with &) the lines will be aligned on the right, so if one is noticeably longer than the other, the result will not be attractive. alignment of relations is the usual practice, so inserting & before \leftarrow in both lines is probably the best approach.

if alignment is really not wanted, and both lines should be centered, the gather environment is more appropriate.

share|improve this answer

You can use eqnarray, as suggested in another answer

But the align environment provided by amsmath seems to be a much better alternative:

  e \leftarrow bla bla \\
  r \leftarrow x + y
share|improve this answer
Since the OP orignally wanted to use displayed math, which doesn't have equation numbers, he'd probably be better off using \begin{align*}. And since he wasn't asking about alignment, there's no need for the ampersands. – Quinn Culver Jun 29 '11 at 11:44
you're right. Edited in consequence. – huitseeker Jun 29 '11 at 11:48
If you are not using alignment, it is better to use gather or lgather from mathtools – Aditya Jun 29 '11 at 19:54

Your Answer


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