2

I have to write a calculation that takes two lines. I need to put number only at the last step. How do I do that? I used \nonumber at the end of the first line where I don't want to put equation number. But the number is being shown on the first line and not on the last line.

for example:

\begin{eqnarray}
\dot{\epsilon}&=& u_\mu u_\nu\Bigl(\dot{I}^{\mu\nu}_{(0)+}+\dot{I}^{\mu\nu}_{(0)-}\Bigr)\\
&=& u_\mu u_\nu\int\mathrm{dp}~p^\mu p^\nu\bigl(\dot{f}_{(0)}+\dot{\bar{f}}_{(0)})
\label{eq:1}
\end{eqnarray}
  • Can you please show an example of code? – egreg Apr 18 '18 at 9:04
  • i have added the code but, I don't know how to write like LaTex in here. So, I just copy pasted it. – Samapan Bhadury Apr 18 '18 at 9:08
  • 1
    That's the correct way; we don't use MathJax here because we're interested in TeX/LaTeX code. You paste the code, select it and click on the {} small icon on the top of the editing box. – egreg Apr 18 '18 at 9:12
  • for future purpose can tell me how did you do it? – Samapan Bhadury Apr 18 '18 at 9:13
  • Adding four spaces in front of each row activates the syntax highlighting. There is also a button in the toolbar that helps you adding these four spaces for a larger amount of selected lines. – Tiuri Apr 18 '18 at 9:16
4

Don't use eqnarray ! It yields bad spacing. Replace it with one of the amsmath environments. Here you can use an aligned environment, with option [b], nested in equation:

\documentclass[11pt]{article}

\usepackage{amsmath}

\begin{document}

\begin{equation}
\begin{aligned}[b]
\dot{\epsilon}&= u_\mu u_\nu\Bigl(\dot{I}^{\mu\nu}_{(0)+}+\dot{I}^{\mu\nu}_{(0)-}\Bigr)\\
&= u_\mu u_\nu\int\mathrm{dp}~p^\mu p^\nu\bigl(\dot{f}_{(0)}+\dot{\bar{f}}_{(0)})
\end{aligned}
\label{eq:1}
\end{equation}

\end{document}

enter image description here

2

\nonumber at the end of the first line works. But be careful: At the end of the first line means before the line-breaking \\ that ends the first line.

MWE:

\documentclass{article}
\begin{document}
\begin{eqnarray}
\dot{\epsilon}&=& u_\mu u_\nu\Bigl(\dot{I}^{\mu\nu}_{(0)+}+\dot{I}^{\mu\nu}_{(0)-}\Bigr) \nonumber\\
&=& u_\mu u_\nu\int\mathrm{dp}~p^\mu p^\nu\bigl(\dot{f}_{(0)}+\dot{\bar{f}}_{(0)})
\label{eq:1}
\end{eqnarray}
\end{document}

enter image description here

  • Okay thanks. I was using it wrong. I was putting the \nonumber after the '\\'. that is why it was not waotking. – Samapan Bhadury Apr 18 '18 at 9:15
2

You should never use eqnarray, the reasons are explained at eqnarray vs align and they should also be clear from a visual comparison. I also made some small changes, notably to the dimension of the parentheses and to the treatment of differentials.

\documentclass{article}
\usepackage[tbtags]{amsmath}

\newcommand\prediff[1]{\mathrm{d}#1\,}
\newcommand{\diff}{\mathop{}\!\mathrm{d}}

\begin{document}

This is not the best way to cope with the problem:
\begin{eqnarray}
\dot{\epsilon}&=& u_\mu u_\nu\Bigl(\dot{I}^{\mu\nu}_{(0)+}+\dot{I}^{\mu\nu}_{(0)-}\Bigr)\nonumber\\
&=& u_\mu u_\nu\int\mathrm{dp}~p^\mu p^\nu\bigl(\dot{f}_{(0)}+\dot{\bar{f}}_{(0)})
\label{not-the-best}
\end{eqnarray}
Perhaps you are better served with \texttt{split} (note
the option \texttt{tbtags}):
\begin{equation}\label{better}
\begin{split}
\dot{\epsilon}
&= u_\mu u_\nu\bigl(\dot{I}^{\mu\nu}_{(0)+}+\dot{I}^{\mu\nu}_{(0)-}\bigr)\\
&= u_\mu u_\nu\int\prediff p p^\mu p^\nu\bigl(\dot{f}_{(0)}+\dot{\bar{f}}_{(0)})
\end{split}
\end{equation}
With the differential at the end it would be
\begin{equation}\label{better-post}
\begin{split}
\dot{\epsilon}
&= u_\mu u_\nu\bigl(\dot{I}^{\mu\nu}_{(0)+}+\dot{I}^{\mu\nu}_{(0)-}\bigr)\\
&= u_\mu u_\nu\int p^\mu p^\nu\bigl(\dot{f}_{(0)}+\dot{\bar{f}}_{(0)})\diff p
\end{split}
\end{equation}

\end{document}

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.