1
\documentclass{amsart}

\begin{document}

\title{Title 1}
\maketitle

\section{Section 1}
\subsection{Sub-section 1}
Text 1

\section{Section 2}
\subsection{Sub-section 2}
Text 2

\section*{Unnumbered section}
\subsection{Numbered sub-section}
Text 3

\section{Section 4}
\subsection{Sub-section 4}
Text 4

\section*{Unnumbered section}
\subsection{Numbered sub-section}
Text 5

\section{Section 6}
\subsection{Sub-section 6}
Text 6

\end{document}

You see how with the unnumbered sections, the sub-sections of the unnumbered sections are not correct since it continues from the previous section's sub-section, which is unwanted behavior. For example, for the "Text 3" sub-section, it should be sub-section 3.1, not 2.2. Also the next section is numbered as section 3 when it should be section 4, and so forth.

  • Why do you expect that unnumbered section etc. should restart the subsection etc. numbers? That's not the case in a normal setup. A manual solution for each \section* would be \stepcounter{section} -- a unnumbered structure command does not increase its counter -- this is the design of LaTeX -- Mixing the styles seems wrong! – user31729 Aug 27 '16 at 16:43
  • you can try with {\def\thesection{} \section{Unnumbered section}} – touhami Aug 27 '16 at 16:53
1

The following patch (thanks to etoolbox) updates one of the sectional internals - \@sect - to always step the counter in question, regardless of whether you use \section* or \section:

enter image description here

\documentclass{amsart}

\usepackage{etoolbox}
\makeatletter
% \patchcmd{<cmd>}{<search>}{<replace>}{<success>}{<failure>}
\patchcmd{\@sect}{\@svsec\@empty}{\@svsec\@empty\stepcounter{#1}}{}{}
\makeatother

\begin{document}

\title{Title 1}
\maketitle

\section{Section 1}
\subsection{Sub-section 1}
Text 1

\section{Section 2}
\subsection{Sub-section 2}
Text 2

\section*{Unnumbered section}
\subsection{Numbered sub-section}
Text 3

\section{Section 4}
\subsection{Sub-section 4}
Text 4

\section*{Unnumbered section}
\subsection{Numbered sub-section}
Text 5

\section{Section 6}
\subsection{Sub-section 6}
Text 6

\end{document}
| improve this answer | |

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.