# Tweaking of Section style in amsbook class

I wanted to have less spacing before and after the section title in the amsbook class. Therefore, I changed the definition of the macro \@startsection as indicated in the documentation. Unfortunately, now my section titles are not centered anymore but flushleft, and I also lost the property of not being on the last line of a page. What happened and how can I recover these two properties, still changing the \vskip before and after ?

PS: I do not want to use any package for that.

Here is my MWE

\documentclass[oneside]{amsbook}
\makeatletter
\renewcommand\section{\@startsection{section{1}\z@{.3\linespacing\@plus\linespacing}{.0\linespacing}{\centering\normalfont\bfseries}}
\makeatother
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\begin{document}
\section{StackExchange}
\end{document}


The fifth argument to \@startsection should be positive:

\documentclass[oneside]{amsbook}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}

\usepackage{lipsum}

\makeatletter
\renewcommand\section{%
\@startsection{section}{1}
\z@
{.3\linespacing\@plus\linespacing}
{1sp}
{\normalfont\bfseries\centering}%
}
\makeatother

\begin{document}

\section{StackExchange}
\lipsum[1]

\end{document}


The length 1sp is the least possible positive length (much less than the wavelength of visible light).

• clear as visible light ! – brunoh Jun 22 '15 at 22:46
• @brunoh This has historic reasons. In order to save memory and parameters, the arguments to \@startsection are overloaded. If the fifth argument is not positive, the section title is typeset “in line”. Similarly, a negative value of the fourth argument inhibits the indentation of the next paragraph. – egreg Jun 22 '15 at 22:49
• +1 brighter than visible light ! thanks for the explanation. – brunoh Jun 22 '15 at 22:51