0

I have a problem that all the subsections numbers in my report. How can I solve this problem please? I search for a solution and I try it but it also not working. this is my code:

\documentclass[12pt]{report}
\renewcommand\thesection{\color{myblue}\thechapter.\arabic{section}}
\renewcommand\thesubsection{\color{myorange}\thechapter.\arabic{section}}
\setcounter{tocdepth}{3}
\setcounter{secnumdepth}{3}
\begin{document}
\subsection{\bf\color{myorange}Overview}
\subsection{\bf\color{myorange}{Declarative Development:}}
\subsection{\bf\color{myorange}{Programmatic Development:}}

these 3 subsections shows :

1.1 Overview
1.1 Declarative Development
1.1 Programmatic Development

Anyone can help me to solve this issue?

  • 1
    Welcome to TeX SX! What is the problem? You didn't explain it. – Bernard Jul 7 at 9:21
  • my problem is that the subsection nembering is not working. It's showing the same number for all the subsections – sally yamak Jul 7 at 9:34
  • 1
    Could you please add a minimal working example (MWE) that allows others to reproduce the issue you have? Using \documentclass{report} \setcounter{tocdepth}{3} \setcounter{secnumdepth}{3} \begin{document} \tableofcontents \chapter{Chapter} \section{Section} \subsection{Subsection} \subsection{Subsection} \end{document} I get the correct result. – leandriis Jul 7 at 9:34
  • Please tell us which document class you employ. And please tell us if your document contains instructions (possibly in the preamble) that modify the properties of \thesubsection. – Mico Jul 7 at 9:41
  • I edit my post can you check it please – sally yamak Jul 7 at 10:03
0

If I understand well your problem, it is very simple with titlesec (as you don't define myblue and my orange in your post, I had to define them myself):

\documentclass[12pt]{report}
\usepackage[svgnames]{xcolor}
\colorlet{myorange}{DarkOrange}
\colorlet{myblue}{CadetBlue}
\usepackage{titlesec}
\titleformat*{\section}{\color{myblue}\bfseries}
\titleformat*{\subsection}{\color{myorange}\bfseries}

\begin{document}
\setcounter{chapter}{1}
\setcounter{section}{4}

\section{First section}
\subsection{Overview}
\subsection{Declarative Development:}
\subsection{Programmatic Development:}

\end{document} 

enter image description here

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.