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}
  • @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. – carloabelli Nov 3 '15 at 5:41
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

  • 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 Nov 3 '15 at 8:17
  • @Mico: Thanks for the edit. I have to search for the book now :) – user11232 Nov 3 '15 at 8:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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