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.

I am trying to compile a document with equations but whenever I use \begin{eqnarray}..\end{eqnarray} or \begin{align}...\end{align} or anything like this I get the error msg !Missing $ inserted.<inserted text>$. However if I type those equations without using \begin{eqnarray}...\end{eqnarray} or similar things I do not get any error msg and my document runs perfectly.

Even this simple thing does't work....Please help...

\documentclass[a4paper,12pt]{article}
\usepackage{amsmath}
\usepackage{amssymb}

\begin{document}

\begin{align}
$=$

\end{align}
\end{document}
share|improve this question
7  
align is automatically in math-mode. No need to enter it manually. Remove the $. –  Qrrbrbirlbel Aug 14 '13 at 18:03
2  
It is rather the dollar symbols that you should delete; the align environment already switches to math mode; the $ are for inline math-mode. –  Corentin Aug 14 '13 at 18:04
8  
Also, empty lines within align aren't allowed, I believe. –  Torbjørn T. Aug 14 '13 at 18:04
    
even after deleting the symbol its showing the same error... –  Misha Aug 14 '13 at 18:05
    
its working now...thanx a lot.. –  Misha Aug 14 '13 at 18:06

1 Answer 1

up vote 8 down vote accepted

Many of amsmath environments are already in math mode.

This applies to the environments

  • equation,
  • align,
  • gather,
  • flalgin,
  • alignat and
  • multline

as well as their starred (unnumbered) versions.

The environment split is to be used inside amsmath environments and can be used to split one equation on more than one line (this important for the equation number).

The environments

  • aligned,
  • gathered and
  • alignedat

are similar to the version without -ed but are to be used in math mode.

As pointed out in the comments by Torbjørn T. empty lines aren’t allowed in math mode, they trigger the same error message.


amsmath’s environments (those who actually enter math mode) center their contents horizontally. The align family aligns its content internally at every odd &. See the example below how they work. You can use the fleqn option so that amsmath align the whole content of its environment at the left border (with a certain margin).

Code

\documentclass{article}
\usepackage{amsmath}
\usepackage{showframe}
\begin{document}
\begin{equation}
c^2 = a^2 + b^2
\end{equation}

\begin{gather}
            c^2 = a^2 + b^2 \\
a^2 + 2ab + b^2 = (a + b)^2
\end{gather}

\begin{align}
\text{right-aligned} & \neq \text{left-aligned} \nonumber\\
                 c^2 & = a^2 + b^2 \\
     a^2 + 2ab + b^2 & = (a + b)^2
\end{align}

\begin{align}
            c^2 & = a^2 + b^2 \\
\begin{split}
a^2 + 2ab + b^2 & = (a + b)^2 \\
                & = (a + b)(a + b) \\
                & = aa + ab + ba + bb \\
                & = a^2 + 2ab + b^2
\end{split}
\end{align}
\end{document}

Output

enter image description here

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.