60

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}
1
  • has this question really not been asked before?
    – Vivi
    Oct 8, 2012 at 1:31

2 Answers 2

48

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}
5
  • 3
    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
  • 1
    “See Why is \[...\] prefereable to $$”; yeah, especially Harrold's and Hendrik's comments to the accepted answer.
    – morbusg
    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
  • 1
    @kissmyarmpit nothing wrong with a trailing s there. perfectly acceptable according to conventional grammar.
    – dbliss
    Oct 23, 2015 at 20:58
21

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

5
  • That is not working for me.EDIT sorry I didn't notice those \\ after the equation.
    – Magpie
    Oct 8, 2012 at 0:23
  • 1
    @Magpie Is everything working fine now?
    – azetina
    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.
    – Magpie
    Oct 8, 2012 at 0:35
  • 1
    How can I reference those lines then? Sep 29, 2020 at 3:07
  • 2
    @MinhNghĩa label with the command \label{ } then reference with \ref{ }
    – azetina
    Sep 29, 2020 at 3:30

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.