align* の前に余分なスペースがあり、数式が表示されない

align* の前に余分なスペースがあり、数式が表示されない

sectionページのと部分の間には余分なスペースがありますalign*。数式を で囲むだけでは、このようなスペースは発生しません\[...\]

\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}

その結果は次のようになります: pdf

align*負の値を使用して環境を上げることもできます\vspaceが、もっと適切な方法があるのではないかと考えていました。

編集:

以下を定義します。

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

\begin{align*}...\end{align*}必要なものを に置き換えたら\A{...}、次のようになりました (これが実際のドキュメントです)。 下部のスペースが広い

この下部のスペースが大きくなっている原因は何でしょうか?

答え1

align環境より上約align*の垂直スキップ量を使用します。これは に設定できますが、これはグループ内で行う必要があります。つまり、 10pt0pt

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

環境の下のスペースにも同様の意味があることにご注意ください\belowdisplayskip。スキップ レジスタ値の 1 つだけを減らすと、出力の見た目が見苦しくなる可能性があります。

両方を に設定すること0ptはお勧めしません。

\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}

関連情報