[Tex/LaTex] Extra Space Before align* and Not Display Equation

alignmath-modespacing

There is an extra space between the section and the align* parts of the page. This does not occur if the equation is simply enclosed in \[...\].

\documentclass{article}

\usepackage[fleqn]{amsmath}

\setlength{\mathindent}{0cm}

\begin{document}
\section{Test}
\[
  a^2 + b^2 = c^2
\]
\section{Test}
\begin{align*}
  a^2 + b^2 &= c^2
\end{align*}
\end{document}

Which yields:
pdf

I could just raise up the align* environment using a negative \vspace, but I was wondering if there is a more proper way.

EDIT:

Having defined:

\newcommand{\A}[1]{{\setlength{\abovedisplayskip}{0pt}\begin{align*}#1%
  \end{align*}}}

I replaced the necessary \begin{align*}...\end{align*} with \A{...} and now I am getting this (this is my actual document):
larger bottom space

What could be causing this larger bottom space?

Best Answer

align and align* use a vertical skip amount of about 10pt above the environment. This can be set to 0pt, but this should be done within a group, i.e. use

{%
\abovedisplayskip=0pt%
 \begin{align*}
  ...
 \end{align*}
}%

Please note, that there's \belowdisplayskip as well, having the analogous meaning for the space below the environment. Reducing just one of the skip register values may lead to a non-eye-appealing look of the output.

Setting both to 0pt is not recommended.

\documentclass{article}

\usepackage[fleqn]{amsmath}

\setlength{\mathindent}{0cm}

\begin{document}
\section{Test}
\[
  a^2 + b^2 = c^2
\]
\section{Test}
\begin{align*}
  a^2 + b^2 &= c^2
\end{align*}
Some other text

\section{Another Test}
{%
  \abovedisplayskip=0pt
\begin{align*}
  a^2 + b^2 &= c^2
\end{align*}
}%
Some other text


\section{Another Test}
\begin{align*}
  a^2 + b^2 &= c^2
\end{align*}
Some other text


\end{document}
Related Question