I have used the following piece of code for colouring the text written in the section. The only problem which I am facing is that after adding this code my section is getting numbered which I don't want. Any suggestions?



\colorbox{blue!20}{\parbox{\dimexpr\textwidth-2\fboxsep}{\thesection\ #1}}}


   \section{This is the title}

  • It is easier to see the problem/solution if you provide a minimal working example which people can copy and compile directly, without having to guess what else might be contained in your document. However, does adding a * work? ie. \section*{This is the title} ?
    – Fintan
    Aug 22, 2020 at 11:38
  • Sorry for the bad editing, I will edit the question properly. Yes i have tried using \section*{This is the title} and it doesnot work. Aug 29, 2020 at 17:00

1 Answer 1


You're adding the section number with \thesection.


enter image description here

  • Thanks a lot for this answer, it worked ! Was stuck on this from a long time ago, really thanks for helping me out ! Aug 29, 2020 at 17:13

You must log in to answer this question.

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