# How do I align these equations?

$\frac{dP}{dr}=\frac{-\Big(P+\rho (P)c^2 \Big)} {2} \frac {d\nu} {dr}\]$\\
\newline
$$\Rightarrow d\nu = \frac {-2dP} {P+\rho (P) c^2}$$\\
\bigskip \newline
$$\nu (r) = - \int_{0}^{P(r)} \frac {2dP}{P+\rho (P) c^2} + \nu (r_b)$$
\newline
\newline
\newline
$$e^{\nu(r)} &= e^{\nu(r_b) - \int_{0}^{P(r)} \frac {2dP}{P+\rho (P) c^2} }$$
\newline

$$e^ {\nu (r)}= e^{\nu(r_b)} exp \Big[-\int_{0}^{P(r)} \frac {2dP}{P+\rho (P) c^2} \Big]$$


I am New to Latex so my codes look trivial , can you please align these equations for me ?

## 3 Answers

By using the align* environment (provided by the amsmath package), one can group the five equations and align them horizontally. You didn't say how they should be aligned, so I've assumed they ought to be aligned on the respective = symbols. \documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{align*}
\frac{dP}{dr}&=\frac{-\bigl(P+\rho (P)c^2 \bigr)} {2}
\frac {d\nu} {dr}\\
\Rightarrow d\nu &= \frac {-2dP} {P+\rho (P) c^2} \\
\nu (r) &= - \int_{0}^{P(r)} \frac {2dP}{P+\rho (P) c^2} + \nu (r_b)\\
e^{\nu(r)} &= \exp\biggl[\nu(r_b) -  \int_{0}^{P(r)}
\frac {2dP}{P+\rho (P) c^2} \biggr]\\
e^ {\nu (r)}&= e^{\nu(r_b)} \exp \biggl[-\int_{0}^{P(r)}
\frac {2dP}{P+\rho (P) c^2} \biggr]
\end{align*}
\end{document}


The biggest change, obviously, is the use of the align* environment and the elimination of all \newline instructions. Some other changes: Use of \bigl( and \bigr) in the first line (you were using \Big( and \Big)); use of \biggl[ and \biggr] in the last two lines; and, use of \exp in the final two lines (note that the "exp" string is set in upright letters).

See also the posting What are the differences between , [, align, equation and displaymath? for a discussion of how these display-math environments differ.

Is this what you're looking for?

\begin{align*}
\frac{dP}{dr}=\frac{-\left(P+\rho (P)c^2 \right)}{2} \frac {d\nu}{dr}\Rightarrow d\nu &= \frac {-2dP} {P+\rho (P) c^2}\\
\nu (r) &= \nu (r_b)- \int_{0}^{P(r)} \frac {2dP}{P+\rho (P) c^2}  \\
e^{\nu(r)} &= e^{\nu(r_b) - \int_{0}^{P(r)} \frac {2dP}{P+\rho (P) c^2} }\\
e^ {\nu (r)}&= e^{\nu(r_b)} \exp \left(-\int_{0}^{P(r)} \frac {2dP}{P+\rho (P) c^2} \right)\end{align*}

• Thank you, it would have been better if the "implies" that equation starts from line 2, instead of from right of the first equation. can You do that ? – Tazkera Haque Trina Aug 7 '14 at 4:46

Here is how I would do it:

\documentclass{article}

\usepackage{mathtools}

\newcommand*\ABLD{\ArrowBetweenLines[\Downarrow]&&}
\newcommand*\diffOp{\mathop{}\!\mathit{d}}
\newcommand*\diff{\frac{\diffOp #1}{\diffOp #2}} % can be made more flexible but no need in this case

\begin{document}

\begin{alignat*}{2}
&& \diff{P}{r}
&= \frac{-(P + \rho(P)c^{2})}{2}\diff{\nu}{r}\\
\ABLD
\diffOp \nu
&= \frac{-2\diffOp P}{P + \rho(P)c^{2}}\\
\ABLD
\nu(r)
&= -\int_{0}^{P(r)} \frac{2\diffOp P}{P + \rho(P)c^{2}} + \nu(r_{b})\\
\ABLD
e^{\nu(r)}
&= \exp{\mkern -8mu}\left[\nu(r_{b}) - \int_{0}^{P(r)} \frac{2\diffOp P}{P + \rho(P)c^{2}}\right]\\
\ABLD
e^{\nu(r)}
&= e^{\nu(r_{b})} \exp{\mkern -8mu}\left[-\int_{0}^{P(r)} \frac{2\diffOp P}{P + \rho(P)c^{2}}\right]
\end{alignat*}

\end{document} or maybe

\documentclass{article}

\usepackage{mathtools}

\newcommand*\ABLD{\ArrowBetweenLines[\Downarrow]&&}
\newcommand*\diffOp{\mathop{}\!\mathit{d}}
\newcommand*\diff{\frac{\diffOp #1}{\diffOp #2}} % can be made more flexible but no need in this case

\begin{document}

\begin{alignat*}{2}
&& \diff{P}{r}
&= \frac{-(P + \rho(P)c^{2})}{2}\diff{\nu}{r}\\
\ABLD
\diffOp \nu
&= \frac{-2\diffOp P}{P + \rho(P)c^{2}}\\
\ABLD
\nu(r)
&= -\int_{0}^{P(r)} \frac{2\diffOp P}{P + \rho(P)c^{2}} + \nu(r_{b})\\
\ABLD
e^{\nu(r)}
&= \exp{\mkern -8mu}\left[\nu(r_{b}) - \int_{0}^{P(r)} \frac{2\diffOp P}{P + \rho(P)c^{2}}\right]{\mkern -6mu}
= e^{\nu(r_{b})} \exp{\mkern -8mu}\left[-\int_{0}^{P(r)} \frac{2\diffOp P}{P + \rho(P)c^{2}}\right]
\end{alignat*}

\end{document} or maybe

\documentclass{article}

\usepackage{mathtools}

\newcommand*\ABLD{\ArrowBetweenLines[\Downarrow]&&}
\newcommand*\diffOp{\mathop{}\!\mathit{d}}
\newcommand*\diff{\frac{\diffOp #1}{\diffOp #2}} % can be made more flexible but no need in this case

\begin{document}

\begin{alignat*}{2}
&& \diff{P}{r}
&= \frac{-(P + \rho(P)c^{2})}{2}\diff{\nu}{r}\\
\ABLD
\diffOp \nu
&= \frac{-2\diffOp P}{P + \rho(P)c^{2}}\\
\ABLD
\nu(r)
&= -\int_{0}^{P(r)} \frac{2\diffOp P}{P + \rho(P)c^{2}} + \nu(r_{b})\\
\ABLD
e^{\nu(r)}
&= \exp{\mkern -4mu}\biggl[\nu(r_{b}) - \int_{0}^{P(r)} \frac{2\diffOp P}{P + \rho(P)c^{2}}\biggr]{\mkern -4mu}\\
&&&= e^{\nu(r_{b})} \exp{\mkern -4mu}\biggl[-\int_{0}^{P(r)} \frac{2\diffOp P}{P + \rho(P)c^{2}}\biggr]
\end{alignat*}

\end{document} if you want smaller brackets and alignment of the last two =s.

P.S. I would probably choose the last version.