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:
\documentclass[a4paper,11pt]{article}
\usepackage{hyperref}
\usepackage{titlesec}
\usepackage{xcolor}
\definecolor{coi_gray}{RGB}{136,155,169}
\titleformat*{\section}{\normalsize\bfseries\color{coi_gray}}
\usepackage{lipsum}
\setcounter{secnumdepth}{0} % <---- https://tex.stackexchange.com/a/30225/48642
\begin{document}
\tableofcontents % prints Table of Contents
\newpage
\section{Introduction}
\lipsum[2-14]
\section{First long text}
\lipsum[8-20]
\section{Second long text}
\lipsum[8-20]
\end{document}
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.
hyperref
should be loaded as the last package (very few exceptions – most notablecleveref
). Present version oftitlesec
is 2.13, dated from 2019/10/16.hyperref
after thetitlesec
solves the issue. Thx. I want the unnumbered section in ToC and in the text.