tags:

views:

183

answers:

2

When I include an equation in LaTeX that is enumerated, i.e.

{\begin{equation}
$$
$$ ... \end{equation}
}

The line above the equation (blank space between the text preceeding it and the equation) is huge. How do I make it smaller?

+2  A: 

As you wrote it I understand your example like that:

{\begin{equation}
 $$
 $$
 \tan x=\frac{\sin x}{\cos x}
\end{equation}
}

At first, you don't need the outer brackets.

What that code says to LaTeX is begin equation, end it, begin it again, typeset definition of tangens and end the equation.

If you want some gap before equation try:

...some code...
\vspace{1ex}
\begin{equation}
 ...equation...
\end{equation}

or define new environment in preamble. Something like this:

\newenvironment{myequation}{
 \vspace{1ex}
 \begin{equation}
}{
 \end{equation}
}

and in code use myequation instead of equation.

Crowley
+1 Surprisingly, to me at least, "What that code says to LaTeX is begin equation, end it, begin it again" seems to be true: the space between the two $$s is typeset in textmode. Shouldn't Latex complain that $$ is being terminated by a `\end{equation}?
Charles Stewart
As written here:http://stackoverflow.com/questions/2897126/putting-s-in-the-middle-of-an-equation-environment-why-doesnt-latex-complai/2897238#2897238Code `\begin{equation}$$ $$\alpha\end{equation}` will be processed correctly but code `\begin{equation}\alpha$$` won't be processed.
Crowley
+2  A: 

Your code it's a little bit messy. If you want to write math in your LaTeX code there are mainly three ways:

Inline math: include your math code between two $ (like $\pi=3,141$); your equation or symbols will be displayed on the current line.

Displayed, unnumbered math: include your math code between \[ and \] in the following way:

some text
\[
\pi=3.141
\]
some text

The equation will be displayed, but without a number for referencing it.

Displayed, numbered math: use the equation environment:

some text
\begin{equation}
\pi=3.141
\end{equation}
some text

The equation will be displayed and numbered.

If you have troubles with space before and after your equations, be sure of leaving no blank lines before or after the environment (as shown in the examples). Last remark: use of $$ for displayed math is deprecated.

Alessandro C.