0

I'm using the format of a journal for submitting a paper. However, I have a problem with the numbering of subsections. In fact, in my output, the first section ends with subsection 1.3 and Section 2 starts with subsection 2.4, instead of the correct numbering 2.1. Similarly, definitions, theorems and propositions have a wrong numbering. In fact, section 2 ends with definition 2.3 and section 3 starts with definition 3.4.

Here is the part of code that I believe is involved in the wrong numbering of the subsections.

\newcommand*\chaptermark[1]{} 

\setcounter{secnumdepth}{2}

\newcounter {part}

\newcounter {chapter}

\newcounter {section}

\newcounter {subsection}[section]

\newcounter {subsubsection}[subsection]

\newcounter {paragraph}[subsubsection]

\newcounter {subparagraph}[paragraph]

\renewcommand \thepart {\@Roman\c@part}

\renewcommand \thechapter {\@arabic\c@chapter}

\renewcommand \thesection {\@arabic\c@section}

\renewcommand\thesubsection   {\thesection.\@arabic\c@subsection}

\renewcommand\thesubsubsection{\thesubsection .\@arabic\c@subsubsection}

\renewcommand\theparagraph    {\thesubsubsection.\@arabic\c@paragraph}

\renewcommand\thesubparagraph {\theparagraph.\@arabic\c@subparagraph}

\newcommand\section{\@startsection {section}{1}{\z@}%

                                   {-3.5ex \@plus -1ex \@minus -.2ex}%

                                   {2.3ex \@plus.2ex}%

                                   {\normalfont\Large\bfseries}}


\def\section{\@startsection{section}{1}%

  \z@{.7\linespacing\@plus\linespacing}{.5\linespacing}%

  {\normalfont\bfseries\centering}}

\renewcommand\section[1]{\addtocounter{section}{1}

\medskip

\begin{center}

{\bf\thesection.\ \MakeUppercase{#1}}

\end{center}



\medskip

}


\newcommand\subsection{\@startsection{subsection}{2}{\z@}%

                                     {-3.25ex\@plus -1ex \@minus -.2ex}%

                                     {1.5ex \@plus .2ex}%

                                     {\normalfont\large\bfseries}}

I also tried to find the setcounter relative to definition and theorem environments, but in the given template there is nothing similar. How can I solve this problem?

2
  • Please provide a Minimal Working Example MWE showing the problem
    – Denis
    Commented Mar 10, 2022 at 12:25
  • It is described at the beginning of my question Commented Mar 10, 2022 at 12:28

1 Answer 1

1

You define \section multiple times for no apparent reason.


\newcounter {subsection}[section]

declares subsection counter that will reset whenever section is stepped.



\newcommand\section{\@startsection {section}{1}{\z@}%
                                   {-3.5ex \@plus -1ex \@minus -.2ex}%
                                   {2.3ex \@plus.2ex}%
                                   {\normalfont\Large\bfseries}}

is a fairly standard \section definition, that you declare but don't use



\def\section{\@startsection{section}{1}%
  \z@{.7\linespacing\@plus\linespacing}{.5\linespacing}%
  {\normalfont\bfseries\centering}}

is a fairly standard \section definition, over-writing the previous one, but you declare but don't use this either.



\renewcommand\section[1]{\addtocounter{section}{1}
\medskip
\begin{center}
{\bf\thesection.\ \MakeUppercase{#1}}
\end{center}
\medskip
}

This is a third \section definition over-writing the previous two that does not use any of the latex section heading machinery. It does not prevent page breaks after the heading, it does not control indentation of the next paragraph, it does not make any entry in the table of contents or add to the page running head, it does not use \refstepcounter so you can not \label the section, and it does not reset the subsection counter.


The simplest fix would be to delete the third definition and either the first or second definition depending on the layout you need.

4
  • The absolutely minimal fix would be to change \addtocounter{section}{1} to \refstepcounter{section}% but really this definition is not usable in real documents, you should use one of the \@startsection based definitions. Commented Mar 10, 2022 at 14:25
  • Thank you David for your help, without the need of WME. I left only the first definition of Section and I solved the problems. Commented Mar 10, 2022 at 16:57
  • 1
    @TheWanderer 999 times out of 1000 a MWE would be needed for this kind of question, you were just lucky here that the definition here was so completely broken that I was able to spot the issue without running any code, but that is not usually the case. Commented Mar 10, 2022 at 17:01
  • Dear David, thank you again. I've only a question. In my output it is all ok, up to a little thing. The title of section is 1 Introduction I need to write 1. Introduction How can I insert the dot after the number of the section? This is done in the third definition of the section, but not in the first one Commented Mar 10, 2022 at 17:28

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .