I'd like to modify the \section
command and I'd like to sometimes use \section*
, but this doesn't work with amsmath package.
The code below works fine without it, but I often need it:
\documentclass[a4paper,french,12pt]{article}
\usepackage{lipsum}
\usepackage{amsmath}
\makeatletter
\renewcommand{\subsection}{%
\@startsection{subsection}{2}{\z@}%
{-3.25ex\@plus -1ex \@minus -.2ex}%
{1.5ex \@plus .2ex}%
{\normalfont\large\bfseries}%
}
\makeatother
\begin{document}
\section{Section 1}
\subsection*{Introduction}
\lipsum[2]
\section{subsection 1}
\lipsum[2]
\end{document}
with amsmath,when I use \subsection*{my subsec title}
, it prints the subsec number and then a star where the "my subsec title" should be. And this title doesn't show up.
Thanks for any clue to sort it out
Best Answer
The code posted is missing a couple of
%
but in most uses that won't affect the output (unless you loadamsmath
which changes the behaviour of white space around\@ifnextchar
).By default it does define the
*
form to give unnumbered subsections.As always if you have code that isn't working, post a complete document as here, that shows the problem.
If you add
Then you will see instead
Showing the issue is as mentioned originally your missing
%
the version in the question doesn't work, but the following redefinition works as intended.