66

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.

How can I go about this?

\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}
azetina
  • 28,884
Magpie
  • 2,294

2 Answers2

55

You can use display math environment such as equation:

enter image description here

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.

References:

Code:

\documentclass{article}

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

\begin{document}

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

Peter Grill
  • 223,288
  • 3
    I think we don't need the trailing s in Voss's. – kiss my armpit Oct 08 '12 at 02:02
  • @ガベージコレクタ: Have corrected that. – Peter Grill Oct 08 '12 at 03:15
  • 1
    “See Why is \[...\] prefereable to $$”; yeah, especially Harrold's and Hendrik's comments to the accepted answer. – morbusg Oct 08 '12 at 03: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. – Peter Grill Oct 08 '12 at 03:22
  • 2
    @kissmyarmpit nothing wrong with a trailing s there. perfectly acceptable according to conventional grammar. – abcd Oct 23 '15 at 20:58
22

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}

enter image description here

David Carlisle
  • 757,742
azetina
  • 28,884