3

I am using for now the following code to produce two equations, that should each be numbered and aligned. However, both equations are too long, so they should be on two lines.

\begin{equation}
\begin{split}
    \frac{\partial x_{t,i}}{\partial t} &= \alpha(x_{t,i-1}-2x_{t,i}+x_{t,i+1})-
    \beta(x_{t,i-2}-4x_{t,i-1}+6x_{t,i}-4x_{t,i+1}+x_{t,i+2})\\
    &+ f_{x}(x_{t,i},y_{t,i})\\
    &= -\beta x_{t,i-2}+(\alpha+4\beta)x_{i-1,t}+
    (-2\alpha-6\beta)+x_{i,t} + (\alpha+4\beta)x_{i+1,t})\\
    &-\beta x_{t,i+2} + f_{x}(x_{t,i},y_{t,i})
\end{split}
\end{equation}

The result is this: enter image description here

But I want both equation to get a number, and that the second line of each equation is more to the middle instead of under the =-sign as I did. I tried the multline, but that does not allow me to align, inserting \ gives me equation numbers for each line (so four in total), so if someone has an idea, that would be great!

1

You could use the align environment with \nonumber, which suppresses labeling for specified rows:

\begin{align}
\frac{\partial x_{t,i}}{\partial t} &=&& \alpha(x_{t,i-1}-2x_{t,i}+x_{t,i+1})-
\beta(x_{t,i-2}-4x_{t,i-1}+6x_{t,i}-4x_{t,i+1}+x_{t,i+2}) \nonumber\\
&&&+ f_{x}(x_{t,i},y_{t,i})\\ 
&=&& -\beta x_{t,i-2}+(\alpha+4\beta)x_{i-1,t}+
(-2\alpha-6\beta)+x_{i,t} + (\alpha+4\beta)x_{i+1,t}) \nonumber\\
&&&-\beta x_{t,i+2} + f_{x}(x_{t,i},y_{t,i})
\end{align}

enter image description here

| improve this answer | |
5

Since this is a multiline display, because it has two numbered items, you need align and can nest split inside it.

I moved the “f_x” term at the beginning to get better breaks: the “alpha” and “beta” terms cannot be squeezed in one line, unless you have a very wide text block.

Note that I smashed the bottom of the fraction so not to push down the second part of the first equation.

\documentclass{article}
\usepackage{amsmath}

\begin{document}

\begin{align}
\begin{split}
\smash[b]{\frac{\partial x_{t,i}}{\partial t}}
  &= f_{x}(x_{t,i},y_{t,i}) + \alpha(x_{t,i-1}-2x_{t,i}+x_{t,i+1}) \\
  &\qquad - \beta(x_{t,i-2}-4x_{t,i-1}+6x_{t,i}-4x_{t,i+1}+x_{t,i+2})
\end{split}
\\[1ex]
\begin{split}
  &=f_{x}(x_{t,i},y_{t,i}) -\beta x_{t,i-2}+(\alpha+4\beta)x_{i-1,t} \\
  &\qquad+(-2\alpha-6\beta)+x_{i,t} + (\alpha+4\beta)x_{i+1,t})-\beta x_{t,i+2}
\end{split}
\end{align}

\end{document}

enter image description here

| improve this answer | |

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.