Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Latex: how to break a line inside $$

I want to manually break a line inside $$:

$$something something <breakline> something else$$

I tried \\, \newline, and \linebreak but none work. Ideas?

like image 428
Guy Avatar asked Dec 23 '09 18:12

Guy


People also ask

How do you make a line break in LaTeX?

\\ (two backslashes) \newline. \hfill \break.

How does one break a line within a paragraph in LaTeX?

The \\ and \newline commands break the line at the point of insertion but do not stretch it. The \linebreak command breaks the line at the point of insertion and stretches the line to make it of the normal width.

What is the use of $$ in LaTeX?

LaTeX doesn't officially support $$ . The most noticeable failure if you use the syntax is that the fleqn option will no longer affect the display of the mathematics, it will remain centered rather than being set flush left.

How do you break an inline equation in LaTeX?

LaTeX does allow inline maths to break over lines by default, but there are a number of restrictions. Specifically, in your case, using \left... \right puts everything inside a non-breakable math group, so the first step is to replace them with either just plain \langle...


4 Answers

A couple of people have suggested eqnarray which will work, but a better approach is the align environment in the amsmath package.

\begin{align*} something \\ something else \end{align*} 

If you want the two parts aligned in some way, use an & as described in the amsmath documentation.

like image 160
Rob Hyndman Avatar answered Sep 21 '22 22:09

Rob Hyndman


Instead of using the TeX-style $$ commands, consider using the align* or gather* environments. Inside those, you can use the line break command \\.

(You will need to load the amsmath package to use those; but if you're doing any math at all, you should be loading that package regardless.)

like image 33
Seth Johnson Avatar answered Sep 22 '22 22:09

Seth Johnson


The way to get line breaks in display math, while using only standard LaTeX, is to use \begin{array}...\end{array} within the display math environment $$...$$. (Yes, I know that $$ is deprecated but I still like it.) There are many alternatives in different extensions, including AMSLaTeX's align and align* environments. My personal favorite is Didier Rémy's mathpartir package, which gives a display-math environment that is more like paragraph mode, plus a set of tools for typesetting logical inference rules and proof trees.

like image 22
Norman Ramsey Avatar answered Sep 23 '22 22:09

Norman Ramsey


11 years later...

An example of breaking text in multiple lines is having a cell with multiple lines in an array. Instead of using a new array row, you can break the text in lines within a cell. The advantage of doing this is interline space is not dependent on the whole row height (if some cell in the row has a large height, this won't influence the text interline space):

Latex array cell with multiple lines

To do this, just enclose the cell content within curly braces and use \\ as a linebreak.

Content of the highlighted cell:

{ T_f (u) \text { is the transformed function and }
  \\
  K (t,u) \text { is the kernel used. }}

Whole code:

$\begin {array} {lll}
\text {Transform: } T_f (u) 
    & = \int \limits_{t_1}^{t^2} K (t,u) f(t) dt \;\; \textrm {where:}
        & {
            T_f (u) \text { is the transformed function and }
            \\
            K (t,u) \text { is the kernel used. }
          }
          \\
\text {Inverse transform: } f(u) 
    & = \int \limits_{u_1}^{u^2} K^{-1} (t,u) T_f(u) du
\end {array}$
like image 26
mins Avatar answered Sep 21 '22 22:09

mins