# How to place equations aligned one on each line?

I've been looking and trying for the past hour and I can't figure it out. I'm pretty new to LateX and I'm trying to display my Differential equations working but it's turning into a big mess.

I'm basically trying to get each equation on a line and aligned in the center. Here is what I've tried, but in vain:

$$\frac{dx}{dt} = -r(x-x_{e})\\ \frac{dx}{9} = -rdt\\ \int\frac{dx}{x-x_{e}} = \int -rdt\\ ln|x-x_{e}| = -rt + ln |C|$$


Any help is greatly appreciated.

• Welcome, you are using the wrong environment. Try align and put ampersands (&) right before the equal signs. May 15, 2016 at 14:03
• Equation is for one-line equations. May 15, 2016 at 14:04
• If you don't care about alignment, use the gather environment. May 15, 2016 at 14:04
• Strange ODE this is ;-)
– user31729
May 15, 2016 at 14:16
• @ChristianHupfer the random 9 was to test if I was doing something wrong with the brackets ;) It's always good to have a single value for tracing purposes :-) May 15, 2016 at 15:36

I would use the align environment from mathtools here. Please have a look at the other small adjustments i made.

\documentclass{article}
\usepackage{mathtools}
\usepackage{physics}
\begin{document}
\begin{align}
\dv{x}{t}                 &= -r(x-x_{e})\\
\frac{\dd x}{9}           &= -r\dd{t}\\
\int\frac{\dd x}{x-x_{e}} &= \int -r\dd{t}\\
\ln\abs{x-x_{e}}          &= -rt + \ln \abs{C}
\end{align}
\end{document}

• align is part of amsmath, not mathtools (though since mathtools includes amsmath anyways, it doesn't matter much). May 15, 2016 at 16:08
• @ArunDebray mathtools fixes many bugs from amsmath, so i silently skip over mentioning amsmath. May 15, 2016 at 16:16
• Instead of setting up a completely new information system for starters, they should fix the LaTeX-Wikibook. I wouldn't even mind a really big ShareLaTeX has fixed this page on every article their guy updates. May 15, 2016 at 16:18