1

When I build and view my equation it is always aligned right

\begin{equation} 
$$\textit{N}(\textit{t}) = $\frac{P_o}{\lambda+\rho\varepsilon/\Lambda}$[1-e$^{-t(\lambda+\rho\varepsilon/\Lambda}$)]$$ 
\end{equation}

but if I build and view using align*

\begin{equation}
\begin{align*} 
$$\textit{N}(\textit{t}) = $\frac{P_o}{\lambda+\rho\varepsilon/\Lambda}$[1-e$^{-t(\lambda+\rho\varepsilon/\Lambda}$)]$$
\end{align*} 
\end{equation}

the equation is centre aligned, but the format changes and the numerator no longer sits above the denominator and moves to the left.

Any ideas what is going wrong?

3
  • Why use all those $'s inside the equations? – Masroor May 27 '14 at 10:53
  • \begin{equation} puts you in display maths mode, and the $$ takes you out of maths mode again. remove all the $ signs from your examples, and report if they (still) don't work. – wasteofspace May 27 '14 at 10:53
  • Just out of interest, you might want to take a look at the answers to one of my previous questions, because there is a lot of information about controlling the indentation of equations on there tex.stackexchange.com/questions/179922/… – FionaSmith May 27 '14 at 14:20
2

You are incorrectly nesting structures, and the log file will contain error messages telling you this is happening.

equation already puts the contents in math mode, so $ and $$ are not needed nor allowed in its contents.

Sample output

\documentclass{article}

\usepackage{amsmath}

\begin{document}

Text.
\begin{equation}
  N(t) =
  \frac{P_o}{\lambda+\rho\varepsilon/\Lambda}
  [1-e^{-t(\lambda+\rho\varepsilon/\Lambda})] 
\end{equation}

\end{document}

Similarly align is a top level command producing a displayed equation, but now with alignment points between lines (marked by &). If you need an align structure inside equation you should use aligned instead. See the documentation of amsmath for further information and examples.

Addendum Your original code has \textit{N}(\textit{t}) which as egreg points is almost certainly not what you intended. In math mode letters are automatically in an italic font (actually \mathit) and just writing N(t) as above will give you better spacing.

2
  • \textit is surely wrong, in this case. And probably P_o should be P_{0}. – egreg May 27 '14 at 11:27
  • @egreg Agreed - I had overlooked that. Code and sample output updated. However I have left the P_o as is, only the posted can know what is intended. – Andrew Swann May 27 '14 at 13:06

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.