# How to add a sequential number on the right hand of a mathematical formula?

I often use $$...$$ to write mathematical formulae. I would like to know how to add a sequential number on the right hand of the formulae. I want them to be right adjusted at the right edge of the page. Also, it would be great if the numbers could be automatically generated.

Could anyone help? Thank you very much!

## 2 Answers

Don't use . If you use \begin{equation} and \end{equation} then you'll have numbers automatically generated. If you want several lines in a row with numbers, you can use the align environment like so: \begin{align} \cos^2 \theta + \sin^2 \theta &= 1 \\ \sin\left(\theta + \frac{\pi}{2}\right) &= \cos \theta \end{align}  This requires the amsmath package. You may recognise this code from my answer to your other question. Here is some sample code that shows these basics: \documentclass{article} \usepackage{amsmath} \begin{document} Here is some text. \begin{equation} e^{i\pi}+1=0 \tag{Euler}\label{eq:euler} \end{equation} Some more text. \begin{align} \cos^2 \theta + \sin^2 \theta &= 1 \\ \sin\left(\theta + \frac{\pi}{2}\right) &= \cos \theta \label{eq:trig} \end{align} I can refer to the line I have labelled like so: \ref{eq:trig}. Or if I'd rather have the number enclosed in parentheses: \eqref{eq:trig}. Also, if I refer to an equation I have tagged'' then I get the text of the tag: \eqref{eq:euler}. \end{document}  Required reading: • A tip from me to SoftTimur: Unless you intentionally make displayed equations begin in a new paragraph (that I regard it as a bad practice), make sure there is no a blank line between text and displayed equations. – xport Aug 3 '11 at 14:44 see http://mirror.ctan.org/info/math/voss/mathmode/Mathmode.pdf, there you'll find a lot of examples and also why using the TeX style ... isn't a good choice.

• Aha. I was looking for that mathmode pdf. Do you mind If I add it to my list of "required reading" in my answer? – Seamus Aug 3 '11 at 14:27