I declare sections without numbering by typing section *, but a number is displayed according to the level, as shown in the figure. I want sections declared with section * to have no number here is the current code.

{}{0em}{\colorbox{RoyalBlue!90}{\parbox{\dimexpr\linewidth-2\fboxsep}{\thesection\enspace #1}}}

{}{0em}{\colorbox{RoyalBlue!30}{\parbox{\dimexpr\linewidth-2\fboxsep}{\thesubsection\enspace #1}}}

\titleformat{\subsubsection}{\sffamily\large\bfseries\color{RoyalBlue}}{\thesubsubsection\enspace #1}{1em}{}[{\color{black}\titlerule[1.5pt]}]
  {\gdef\chapterlabel{\thechapter\ }}{0pt}
  {\begin{tikzpicture}[remember picture,overlay]
    \node[yshift=-3cm] at (current page.north west)
      {\begin{tikzpicture}[remember picture, overlay]
        \draw[fill=black] (0,0) rectangle
              rounded corners=20pt,inner sep=11pt,
\chapter{Chapitre 1}
\section*{section without numerotation }
\section{section 1}
\section{section 2}
\section{section without numerotation''}

And this what i get when generate a pdf file .

enter image description here

Thank you for your help !

  • In some way off topic. But I think that you have a misconception about \section{...} and \section*{...}. The latter isn't simply a section without numbering. It's more correct to say that it is a section that doesn't increment the counter of sections. Of course, usually you display a \section*{...} but if what you really want is to don't display numbering you should follow other ways. – gvgramazio Jun 8 '18 at 12:27

Add this to your code:

\titleformat{name=\section, numberless}[block]{\sffamily\Large\bfseries\color{white}}%
|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.