When I use the amsart
class with a lot of in-text figures, I find that the section headings do not stand out quite as much as I would like. Thus, I have taken to adding the following to my preamble, which adds a extra vertical space before each section heading:
\let \oldsection \section
\renewcommand{\section}{\vspace{8pt plus 3pt}\oldsection}
This works well for me, except when I have a section heading right after the document title; in this case, I find would prefer that no extra space be added.
How can I eliminate this extra space "automatically"–i.e., without explicitly adjusting spacing in the body of the document?
Examples:
Here are three examples side-by-side:
You may want to zoom in.
The example on the left is the result of the code below:
\documentclass{amsart}
\let \oldsection \section
\renewcommand{\section}{\vspace{8pt plus 3pt}\oldsection}
\usepackage{lipsum}
\title{Random title}
\author{Fred P.~Author}
\date{\today}
\begin{document}
\maketitle
\section{The first section}
\lipsum[2]
\section{The next section}
\lipsum[4]
\end{document}
Notice the extra space after "Fred P. Author" compared to the result I would like (the image on the right, in the side-by-side picture):
\documentclass{amsart}
\usepackage{lipsum}
\title{Random title}
\author{Fred P.~Author}
\date{\today}
\begin{document}
\maketitle
\section{The first section}
\lipsum[2]
\vspace{8pt plus 3pt}
\section{The next section}
\lipsum[4]
\end{document}
Finally, the image in the middle was given simply to illustrate that the titlesec
package does not seem to solve the problem–at least, not in any naively obvious way. The code I used for it was the following (which I do not claim is exactly equivalent, but which still demonstrates the same extra space after the document title/author):
\documentclass{amsart}
\usepackage{titlesec}
\titleformat{\section}[hang]
{\scshape\filcenter}
{\thesection.}
{1ex}
{}
\titlespacing{\section}
{0pt}{18pt}{6pt}
\usepackage{lipsum}
\title{Random title}
\author{Fred P.~Author}
\date{\today}
\begin{document}
\maketitle
\section{The first section}
\lipsum[2]
\section{The next section}
\lipsum[4]
\end{document}
Best Answer
I wouldn't redefine
\section
like that, but use the standard method. If you're sure that your document starts with a section title, useThe
\maketitle
command adds 34pt space minus the value of\baselineskip
. Adjust the multiples of\linespacing
used in the definition of\amsartsection
(which is the definition of\section
that will be actually used in the document).