I need to make a layout in which the section headers are colored and appear in the ToC. So far no problem. The next requirement is to skip numbering. My attempt in luaLaTeX:


\setcounter{secnumdepth}{0} % <---- https://tex.stackexchange.com/a/30225/48642
\tableofcontents % prints Table of Contents

\section{First long text}
\section{Second long text}


I tried to follow the solutions but now I'm facing that the ToC link incorrectly - either to page 1 or some random page. The other solutions like \addcontentsline suffer the same problem and \renewcommand{\thesection}{} has odd spacing in the section.

Using titlesec from 2016-03-21.

  • 2
    couple of remarks: hyperref should be loaded as the last package (very few exceptions – most notable cleveref). Present version of titlesec is 2.13, dated from 2019/10/16.
    – Bernard
    Mar 11, 2020 at 15:21
  • What is not clear is whether you want sections to be unnumbered in text and in the table of contents, or only in table of contents?
    – Bernard
    Mar 11, 2020 at 15:26
  • ahaaa... loading the hyperref after the titlesec solves the issue. Thx. I want the unnumbered section in ToC and in the text.
    – LeO
    Mar 11, 2020 at 15:31
  • Nevertheless, you should update titlesec (and perhaps other packages, if you haven't done it for a long tme).
    – Bernard
    Mar 11, 2020 at 15:33
  • 1
    @Bernard one of you could formulate this into an answer, so that LeO can mark the question as answered.
    – Tim Hilt
    Mar 12, 2020 at 15:46


You must log in to answer this question.

Browse other questions tagged .