# How do you make numbered equations in latex?

I would like to put in a code that automatically assigns a number to the equations in my documents preferably aligned on the right hand side.

\documentclass[a4paper,11pt]{article}
%\documentclass[a4paper,11pt]{scrartcl}
\usepackage{amsmath}
\usepackage[utf8]{inputenc}

\begin{document}

$$\ddot{\underline{\mathbf{r}}} = \frac{d{^2}\underline{\mathbf{r}}}{dt^2}= 0$$.
\end{document}

• has this question really not been asked before?
– Vivi
Oct 8, 2012 at 1:31

You can use display math environment such as equation:

# Notes:

• The d in dt should be upright as d is an operator, not a variable. Have defined a macro for that and corrected it below.

## Code:

\documentclass{article}

\newcommand{\dd}[1]{\mathrm{d}#1}

\begin{document}

$$\ddot{\underline{\mathbf{r}}} = \frac{\dd{}{^2}\underline{\mathbf{r}}}{\dd{t}^2} = 0$$
\end{document}

• I think we don't need the trailing s in Voss's. Oct 8, 2012 at 2:02
• @ガベージコレクタ: Have corrected that. Oct 8, 2012 at 3:15
• “See Why is $...$ prefereable to $$”; yeah, especially Harrold's and Hendrik's comments to the accepted answer. Oct 8, 2012 at 3:18 • @morbusg: Thanks for pointing those comments out. Perhaps those should be added as an answer so that thy are not missed. But, then David Carlisle's answer about $$ not easily being re-definable might be a better reason. Oct 8, 2012 at 3:22
• @kissmyarmpit nothing wrong with a trailing s there. perfectly acceptable according to conventional grammar. Oct 23, 2015 at 20:58

You can also use the align environment:

\documentclass[a4paper,11pt]{article}
%\documentclass[a4paper,11pt]{scrartcl}
\usepackage{amsmath}
\usepackage[utf8]{inputenc}

\begin{document}
%Equations with numbering
\begin{align}
\ddot{\underline{\mathbf{r}}} &= \frac{d{^2}\underline{\mathbf{r}}}{dt^2}\\
&= 0
\end{align}

%Equations with no numbering in specific line by using \nonumber
\begin{align}
\ddot{\underline{\mathbf{r}}} &= \frac{d{^2}\underline{\mathbf{r}}}{dt^2}\nonumber\\
&= 0
\end{align}

%Equations without numbering
\begin{align*}
\ddot{\underline{\mathbf{r}}} &= \frac{d{^2}\underline{\mathbf{r}}}{dt^2}\\
&= 0
\end{align*}
\end{document}


• That is not working for me.EDIT sorry I didn't notice those \\ after the equation. Oct 8, 2012 at 0:23
• @Magpie Is everything working fine now? Oct 8, 2012 at 0:29
• Yes, I was just having a sloppy moment. Thanks for your help. I selected the other answer because it does what I want more precisely but I appreciate your solution too. Oct 8, 2012 at 0:35
• How can I reference those lines then? Sep 29, 2020 at 3:07
• @MinhNghĩa label with the command \label{ } then reference with \ref{ } Sep 29, 2020 at 3:30