3

I have the following code sample:

\begin{align}
    \pi^{(1)}_{i j} \enspace & = \enspace -\frac{1}{4}\eta^{\lambda \sigma} \left( \eta^{\mu \alpha}\eta^{\nu \beta} + \eta^{\mu \beta}\eta^{\nu \alpha}  \right) \biggl\{ \frac{1}{2}\delta_{\lambda 0}( \delta_{\mu i}\delta_{\nu j} + \delta_{\mu j}\delta_{\nu i}  )   \biggr\} \partial_{\sigma} h_{\alpha \beta}
    \nonumber
    \\
    -\frac{1}{4}\eta^{\lambda \sigma} \left( \eta^{\mu \alpha}\eta^{\nu \beta} + \eta^{\mu \beta}\eta^{\nu \alpha}  \right) \biggl\{ \frac{1}{2}\delta_{\sigma 0}( \delta_{\alpha i}\delta_{\beta j} + \delta_{\alpha j}\delta_{\beta i} )  \biggr\} \partial_{\lambda} h_{\mu \nu}
    \mspace{-458mu}
    \nonumber
    \\
    & = \enspace -\frac{1}{4}\partial^{\lambda} h^{\mu \nu}\delta_{\lambda 0}( \delta_{\mu i}\delta_{\nu j} + \delta_{\mu j}\delta_{\nu i} ) -\frac{1}{4}\partial^{\sigma} h^{\alpha \beta}\delta_{\sigma 0}( \delta_{\alpha i}\delta_{\beta j} + \delta_{\alpha j}\delta_{\beta i} )
    \nonumber
    \\
    & = \enspace -\frac{1}{2}\partial^0 h^{i j} - \frac{1}{2}\partial^0 h^{i j}
    \nonumber
    \\
    & = \enspace \dot{h}_{i j}
\end{align}

which gives the output:

output of the given code

As you see, I have a problem in aligning the lines properly which I tried to handle by using \mspace{}. My first question is: What is the correct or proper way of doing this in these kind of lengthy equations?

I also have another problem. When I use separate \align environments repeatedly, at some moment I reach to the end of the page and the last \align environment automatically starts from a new page. In such a case all vertical spaces of the previous page changes and they ruin the proper format of the text. So, my second question is: How to properly arrange line breaks or spacing in repeated \align environments consisting lengthy equations?

1

You should use split inside equation for this:

\documentclass{article}
\usepackage{amsmath}

\begin{document}

\begin{equation}
\begin{split}
\pi^{(1)}_{i j}
={}&  -\frac{1}{4}\eta^{\lambda \sigma} ( \eta^{\mu \alpha}\eta^{\nu \beta} + \eta^{\mu \beta}\eta^{\nu \alpha}  ) \biggl\{ \frac{1}{2}\delta_{\lambda 0}( \delta_{\mu i}\delta_{\nu j} + \delta_{\mu j}\delta_{\nu i}  )   \biggr\} \partial_{\sigma} h_{\alpha \beta}
\\
   & -\frac{1}{4}\eta^{\lambda \sigma} ( \eta^{\mu \alpha}\eta^{\nu \beta} + \eta^{\mu \beta}\eta^{\nu \alpha}  ) \biggl\{ \frac{1}{2}\delta_{\sigma 0}( \delta_{\alpha i}\delta_{\beta j} + \delta_{\alpha j}\delta_{\beta i} )  \biggr\} \partial_{\lambda} h_{\mu \nu}
\\
={}& -\frac{1}{4}\partial^{\lambda} h^{\mu \nu}\delta_{\lambda 0}( \delta_{\mu i}\delta_{\nu j} + \delta_{\mu j}\delta_{\nu i} ) -\frac{1}{4}\partial^{\sigma} h^{\alpha \beta}\delta_{\sigma 0}( \delta_{\alpha i}\delta_{\beta j} + \delta_{\alpha j}\delta_{\beta i} )
\\
={}& -\frac{1}{2}\partial^0 h^{i j} - \frac{1}{2}\partial^0 h^{i j}
\\
={}& \dot{h}_{i j}
\end{split}
\end{equation}

\end{document}

The trick is to put = on the left side, following it with {} for ensuring correct spacing.

Avoid useless \left and \right. Also, no \enspace should be used around =.

enter image description here

The number should go in the middle, in my opinion. However, the tbtags option to amsmath will put it at the bottom of a split.

  • Your answer is very useful, thanks @egreg. I liked the idea of using \split and putting number into the middle and I will use them as the solution to my problem. But, the answer @Harish Kumar gave also works in my case. Since he additionally answers my second question I will accept his answer which I believe (and I hope) is ethically correct. – sahin May 2 '15 at 13:16
  • @sahin The additional question is a false problem: you should never have consecutive display environments. Use just one and add \displaybreak before the \\ after which you'd like a break. Use \allowdisplaybreaks only when typing in the document, then decide by eye what are the best break points. – egreg May 2 '15 at 13:19
  • In my case, I used the \allowdisplaybreaks locally just before the \align environment that breaks the page and it worked. What are the possible bad consequences of using it like that? In any case, I again liked your suggestion. For a proper look, it could be better to use a single \align as you said. Thanks again. – sahin May 2 '15 at 13:25
  • Yeap! Now both of your solutions work for me and my document looks much better. I will change my decision on accepting answers. Thanks. – sahin May 2 '15 at 13:31
  • @egreg -- the minus signs that directly follow equal signs should really be unary minuses. they show here as binaries. granted, that would throw off the alignment of the initial fractions ... – barbara beeton May 2 '15 at 15:29
1

You can add few {} and \phatoms to align.

\documentclass{article}
\usepackage{amsmath}
\allowdisplaybreaks
\begin{document}
  \begin{align}
    \pi^{(1)}_{i j} & = {}-\frac{1}{4}\eta^{\lambda \sigma} \left( \eta^{\mu \alpha}\eta^{\nu \beta} + \eta^{\mu \beta}\eta^{\nu \alpha}  \right) \biggl\{ \frac{1}{2}\delta_{\lambda 0}( \delta_{\mu i}\delta_{\nu j} + \delta_{\mu j}\delta_{\nu i}  )   \biggr\} \partial_{\sigma} h_{\alpha \beta}
    \nonumber
    \\
    &\phantom{{}={}}{}-\frac{1}{4}\eta^{\lambda \sigma} \left( \eta^{\mu \alpha}\eta^{\nu \beta} + \eta^{\mu \beta}\eta^{\nu \alpha}  \right) \biggl\{ \frac{1}{2}\delta_{\sigma 0}( \delta_{\alpha i}\delta_{\beta j} + \delta_{\alpha j}\delta_{\beta i} )  \biggr\} \partial_{\lambda} h_{\mu \nu}
    \nonumber
    \\
    & = {}-\frac{1}{4}\partial^{\lambda} h^{\mu \nu}\delta_{\lambda 0}( \delta_{\mu i}\delta_{\nu j} + \delta_{\mu j}\delta_{\nu i} ) -\frac{1}{4}\partial^{\sigma} h^{\alpha \beta}\delta_{\sigma 0}( \delta_{\alpha i}\delta_{\beta j} + \delta_{\alpha j}\delta_{\beta i} )
    \nonumber
    \\
    & ={} -\frac{1}{2}\partial^0 h^{i j} - \frac{1}{2}\partial^0 h^{i j}
    \nonumber
    \\
    & ={}\dot{h}_{i j}
\end{align}
\end{document}

For your page breaking problem, use \allowdisplaybreaks.

enter image description here

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.