Formatting equations in LaTeX
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?
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.
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
.
精彩评论