0

I'm using the following format for the sectioning:

\renewcommand\thesubsection{\thechapter.\arabic{section}.\arabic{subsection}}

Before starting the chapter 1, I start with an introduction that I use in it the sectioning, and I faced the following problem:

enter image description here

And here is my code snippet for this section:

\newpage
\pagestyle{plain}
\addcontentsline{toc}{section}{Introduction}
\section*{\centering\Huge\bf\color{myblue}{Introduction}}\par
\vspace{1cm}
\section{Overview}

Can anyone help me please to get rid of this 0 from the sectioning only in the introduction part?

9
  • Use again \section*{Overview} instead of \section{Overview}. Simplest solution. Sectioning commands with "star" disable theyre numbering. Commented Jan 5, 2020 at 11:42
  • And also, it is better (even for simple cases) not to post code snippets, but to post stand-alone compilable MWE (with documentclass, package loadings, etc ...) that can be just copy-pasted for testing. Commented Jan 5, 2020 at 11:44
  • you could use \renewcommand\thesubsection{\ifnum\value{chapter}>0 \thechapter.\arabic{section}.\fi\arabic{subsection}} but the reader may find it confusing, better to use \section* and not number, I think. Commented Jan 5, 2020 at 11:51
  • @DavidCarlisle thank you i tried your command for the section and it works for me but i still have a problem for the subsection : \renewcommand\thesection{\ifnum\value{chapter}>0 \thechapter.\fi\arabic{section}} \renewcommand\thesubsection{\ifnum\value{chapter}>0 \thechapter.\arabic{section}.\fi\arabic{subsection}} where the subsection is only numbered without being precede with the section number Commented Jan 5, 2020 at 12:41
  • you have not provided a test document or even a fragment showing any use of \subsection Commented Jan 5, 2020 at 13:00

1 Answer 1

1

I think it's clearer to use unnumbered sections in the front matter, but if you want to do this then:

\renewcommand\thesection{\ifnum\value{chapter}>0 \thechapter.\fi\arabic{section}}
% this one shouldn't be needed as it's the default
%\renewcommand\thesubsection}{\thesection.\arabic{subsection}}

You must log in to answer this question.

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