Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.
$\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 ?

share|improve this question

3 Answers 3

up vote 7 down vote accepted

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.

output

\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.

share|improve this answer
    
This is exactly what I needed. –  Tazkera Haque Trina Aug 7 '14 at 4:59
    
@SvendTveskæg - thanks! –  Mico Dec 30 '14 at 13:02
    
@Mico I didn't really do much but I hope it is okay. :) –  Svend Tveskæg Dec 30 '14 at 13:12

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*}
share|improve this answer
    
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[2]{\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}

output1

or maybe

\documentclass{article}

\usepackage{mathtools}

\newcommand*\ABLD{\ArrowBetweenLines[\Downarrow]&&}
\newcommand*\diffOp{\mathop{}\!\mathit{d}}
\newcommand*\diff[2]{\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}

output2

or maybe

\documentclass{article}

\usepackage{mathtools}

\newcommand*\ABLD{\ArrowBetweenLines[\Downarrow]&&}
\newcommand*\diffOp{\mathop{}\!\mathit{d}}
\newcommand*\diff[2]{\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}

output

if you want smaller brackets and alignment of the last two =s.

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

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.