It subtly depends on the fact that amsmath
redefines \@ifnextchar
. In practical terms, you have a spurious space that the kernel version of that internal command removes, while the amsmath
version doesn't.
\makeatletter
\renewcommand{\section}{%
\@startsection
{section}{1}{0mm}
{\baselineskip}
{\baselineskip}
{\fontsize{14}{14}\centering\bfseries\MakeUppercase}%
}
\makeatother
Notice particularly the last %
that masks the end-of-line (equivalent to a space, here). The end-of-lines from the \@startsection
line until the last one need not to be masked, because \@startsection
will be looking for arguments and so ignore the spaces. Putting %
there does no harm, anyway.
By the way, redefining \thesection
is not the best method for adding a period after the section number in a heading:
\makeatletter
\renewcommand\@seccntformat[1]{\csname the#1\endcsname.\quad}
\makeatother
is better, because \ref
won't produce the number followed by a period when referring to a section number. So, here's the complete example:
\documentclass{article}
\usepackage{amsmath}
\makeatletter
\renewcommand\@seccntformat[1]{\csname the#1\endcsname.\quad}
\renewcommand{\section}{%
\@startsection
{section}{1}{0mm}
{\baselineskip}
{\baselineskip}
{\fontsize{14}{14}\centering\bfseries\MakeUppercase}%
}
\makeatother
\begin{document}
\tableofcontents
\section{A}
\end{document}