4

I am getting a large space after a section when math immediately follows. How can I make this space the same as if text followed?

\documentclass{article}

\usepackage{amsmath}

\begin{document}
\section*{Test With Text}
This is normal text.
\section*{Test With Math}
\begin{align*}
  a &= bc\\
  d &= ef
\end{align*}
\end{document}
1
  • @HarishKumar Thanks! :) I typically agree that that's a bad idea (why I haven't run into the issue until now). This is a special case. Commented Nov 3, 2015 at 5:41

1 Answer 1

5

Don't use a display equation right after the section heading.

Every multi-line display equation environment of the amsmath package, including align*, carries \abovedisplayskip above it and \belowdisplayskip below it. What you see in your case is the former, i.e., \abovedisplayskip. While it is not a good idea to have a display equation right after a heading, you may make this zero locally inside a group.

\documentclass{article}

\usepackage{amsmath}

\begin{document}
\section*{Test With Text}
This is normal text.
\section*{Test With Math}
\bgroup                                  %% open the group
\setlength{\abovedisplayskip}{0pt}       %% effective inside the group    
\begin{align*}
  a &= bc\\
  d &= ef
\end{align*}
\egroup                                  %% end the group

This is some text here just to fill the space.
\begin{align*}
  a &= bc\\
  d &= ef
\end{align*}
\end{document}

enter image description here

2
  • Thanks for the update. I've deleted my earlier comments, and have taken the liberty of editing the first sentence of your answer. Feel free to edit it some more!
    – Mico
    Commented Nov 3, 2015 at 8:17
  • @Mico: Thanks for the edit. I have to search for the book now :)
    – user11232
    Commented Nov 3, 2015 at 8:25

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .