77
\begin{equation*}\label{eq:pareto mle2}
A_0 = \frac{1}{(\alpha+t_x)^{r+s+x}}{}_2F_1\left(r+s+x,x+1;r+s+x+1;\frac{\alpha-\beta}{\alpha + t_x} \right ) "\\\" <br>
 - \frac{1}{(\alpha+T)^{r+s+x}}{}_2F_1\left(r+s+x,x+1;r+s+x+1;\frac{\alpha-\beta}{\alpha + T} \right ),
\end{equation*}


This is my code why \\ does not go to new line? How should I make it?

38

The amsmath package -- which you appear to be loading already as your example code uses an environment called equation* -- provides quite a few environments to typeset equations that need to be split across two or more lines. The align* environment may be particularly suitable to the case at hand; note the use of & to state the alignment points.

enter image description here

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{align*}\label{eq:pareto mle2}
A_0 &=   \frac{1}{(\alpha+t_x)^{r+s+x}}{}_2 F_1\left( r+s+x,x+1;r+s+x+1;\frac{\alpha-\beta}{\alpha + t_x} \right)\\
&\quad - \frac{1}{(\alpha+T)^{r+s+x}}{}_2 F_1\left( r+s+x,x+1;r+s+x+1;\frac{\alpha-\beta}{\alpha + T} \right),
\end{align*}
\end{document}

Addendum: Note the close similarity of the outputs produced by the single align* environment in this answer and by the nested pair of equation*/multlined environments in @HarishKumar's answer.

| improve this answer | |
  • 1
    Good answer, thanks! Small detail: couldn't you get rid of the \quad by moving the& to immediately after the equal sign? – Janus Varmarken Nov 2 '18 at 20:33
  • 2
    @JanusVarmarken - Thanks. The reason I used \quad to indent the second row was to follow a common typographic equation: to indicate visually that the second row is a continuation of the equation that began on the first row, the - symbol is deliberately not set immediately below the = symbol in the first row. – Mico Nov 2 '18 at 21:11
  • 1
    oh, I think you misunderstood me - I completely agree that it should show up in that way. I'm just saying that you could avoid having to use \quad by moving the & of the first row so that you get A_0 =&. That way you still get the same output, but without having to include \quad in the second row. – Janus Varmarken Nov 2 '18 at 21:45
  • 2
    @JanusVarmarken -- Look closely at the spacing around the = symbol if you write =& instead of &=: The spacing becomes highly asymmetric -- rather nonstandard! That's why the user guide of the amsmath package recommends writing &=. :-) – Mico Nov 2 '18 at 21:48
  • ooh, I see - didn't notice that :). Thanks again! – Janus Varmarken Nov 3 '18 at 2:17
40

Both equation and equation* do not allow multi lined expressions. Use aligned from amsmath, inside equation* to break in to many lines. If alignment is not needed, you can use gathered (instead of aligned) as suggested by Mico.

\documentclass{article}
\usepackage{amsmath}
\begin{document}
  \begin{equation*}\label{eq:pareto mle2}
  \begin{aligned}
A_0 = \frac{1}{(\alpha+t_x)^{r+s+x}}{}_2F_1\left(r+s+x,x+1;r+s+x+1;\frac{\alpha-\beta}{\alpha + t_x} \right ) \\
 - \frac{1}{(\alpha+T)^{r+s+x}}{}_2F_1\left(r+s+x,x+1;r+s+x+1;\frac{\alpha-\beta}{\alpha + T} \right ),
 \end{aligned}
\end{equation*}
\end{document}

Or use multlined from mathtools:

\documentclass{article}
\usepackage{mathtools}
\begin{document}
  \begin{equation*}\label{eq:pareto mle2}
  \begin{multlined}
A_0 = \frac{1}{(\alpha+t_x)^{r+s+x}}{}_2F_1\left(r+s+x,x+1;r+s+x+1;\frac{\alpha-\beta}{\alpha + t_x} \right ) \\
 - \frac{1}{(\alpha+T)^{r+s+x}}{}_2F_1\left(r+s+x,x+1;r+s+x+1;\frac{\alpha-\beta}{\alpha + T} \right ),
 \end{multlined}
\end{equation*}
\end{document}

enter image description here

| improve this answer | |
  • 3
    Also split might be fruitful here, particularly with numbered equations. Of course, multlined is not needed, as multline* suffices. – egreg Aug 1 '14 at 9:34
10

There is an easy way to make \\ works in equation (change line):

\begin{equation}
  a = b
\end{equation}

Change it to

\begin{equation}
  \begin{array}{l}
    a = \\ 
    b
  \end{array}
\end{equation}
| improve this answer | |
  • 1
    A side-effect -- possibly unpleasant -- of this approach is that the contents of the array environment will be processed in text-style math mode instead of in display-style math mode. – Mico Feb 21 '19 at 7:16
5

To obtain multi-lined expressions with equation number written beside, use the following code;

\documentclass{article}
\usepackage{mathtools}
\usepackage{amsmath}
\begin{document}
\begin{equation}
\label{eq:1}
\begin{aligned}
A_0 = \frac{1}{(\alpha+t_x)^{r+s+x}}{}_2F_1\left(r+s+x,x+1;r+s+x+1;\frac{\alpha-\beta}{\alpha + t_x} \right ) \\
 - \frac{1}{(\alpha+T)^{r+s+x}}{}_2F_1\left(r+s+x,x+1;r+s+x+1;\frac{\alpha-\beta}{\alpha + T} \right ),
\end{aligned}
\end{equation}
\end{document}

enter image description here

| improve this answer | |
  • If you want to add the number at the last line of the equation, load the amsmath package with the option tbtags: \usepackage[tbtags]{amsmath} – Roland Deschain Jul 23 '19 at 11:49
  • 1
    mathtools package inserts the amsmath package, so no need to call the package separately.... – MadyYuvi Oct 9 '19 at 5:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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