0

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
  • 1
    What are the $$ blocks for? Don't these make blank lines? Maybe put an example equation in your code. I'm confused.
    – Geoff
    Commented May 23, 2010 at 19:42
  • +1 surprising, to me at least. I've asked a follow-up question, stackoverflow.com/questions/2897126/… Commented May 24, 2010 at 13:00

2 Answers 2

4

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.

1
  • I don't know what the situation was in 2010, but these days unnumbered equations are best done with \begin{equation*} ... \end{equation} from amsmath rather than \[ ... \]. For more details, see tex.stackexchange.com/a/69854/77508 Commented Nov 10, 2023 at 17:08
3

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.

3
  • 1
    +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}? Commented May 24, 2010 at 12:47
  • 1
    As written here: stackoverflow.com/questions/2897126/… Code \begin{equation}$$ $$\alpha\end{equation} will be processed correctly but code \begin{equation}\alpha$$ won't be processed.
    – Crowley
    Commented May 24, 2010 at 16:39
  • How does one delete space after the equation after using a chemmath command inbetween the equation, without loosing the numbering of the equation command? Commented Sep 4, 2019 at 19:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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