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?

  • Use again \section*{Overview} instead of \section{Overview}. Simplest solution. Sectioning commands with "star" disable theyre numbering. – Tomáš Kruliš Jan 5 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. – Tomáš Kruliš Jan 5 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. – David Carlisle Jan 5 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 – sally yamak Jan 5 at 12:41
  • you have not provided a test document or even a fragment showing any use of \subsection – David Carlisle Jan 5 at 13:00
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}}
|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.