Graphics, Figures & Tables ⇒ TOC with unnumbered subsections
TOC with unnumbered subsections
I am using LaTeX for the creation of what can be most closely called a technical manual. I am formatting my company's 450 pg + safety manual, using the report class. So far, it's been going well, and I'm getting everything in there.
The problem I am running into, or at least not understanding the documentation/suggestions out there, is that I want my TOC to look like this:
One: Company Rules
corporate health and safety policy .........................1
scope for health and safety ..................................2
responsibilities .................................................3
safety rules .....................................................4
safety rules, discipline, and commendation policy ... 5
non compliance policy and procedure ................6
Where each of those subsections are indented and also NOT numbered.
What I have used is:
\begin{document}
\maketitle
\tableofcontents
\setcounter{tocnumdepth}{3}
\chapter{Company Rules}
\newpage
\addcontentsline{toc}{section}{Corporate Health and Safety Policy}
\section*{Corporate Health \& Safety Policy}
and in the first subsection, I used:
\newpage
\addcontentsline{toc}{subsection}{Safety Rules, Discipline, \& Commendation Policy}
\subsection{Safety Rules, Discipline \& Commendation Policy}
and for some weird reason (well, i'm sure it's not a weird reason, but it feels like it), my table of contents appears like this:
Safety Rules
Safety Rules, Discipline ...etc
1.01 Safety Rules, Discipline .... etc
Why? What am I doing wrong?
recap:
TOC with up to 5 levels
No numbers in the sections, or in the TOC for the sections, just indents
THANK YOU!
NEW: TikZ book now 40% off at Amazon.com for a short time.
And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p
TOC with unnumbered subsections
The starred version of \section suppresses the incrementation of its section counter, hence the 0 in the subsection afterwards.
And since you're using \addcontentsline and \subsection (unstarred) both, you get 2 entries in the TOC.
It would be easier, if you just limit secnumdepth, the level for numbering, in combination with the unstarred sectioning commands:
Code: Select all
\documentclass{report}\setcounter{tocdepth}{3}% part, ..., subsubsection into toc\setcounter{secnumdepth}{0}% section and below not numbered\begin{document}%\maketitle\tableofcontents\chapter{Company Rules}\newpage\section{Corporate Health \& Safety Policy}and in the first subsection, I used:\newpage\subsection{Safety Rules, Discipline \& Commendation Policy}\end{document}
Rainer
TOC with unnumbered subsections

One question -- I understand everything you've explained, but need to know what the next level tag would be...
subsection would just get me the same level, what is the next subsection called?
thanks,
TOC with unnumbered subsections

(look at my comment after \setcounter{tocdepth}{3})
To recap, the standard classes define these sectioning commands with their, hmm, level values:
\part
-1 (0 for article class)\chapter
0 (not for article class)\section
1\subsection
2\subsubsection
3\paragraph
4\subparagraph
5
secnumdepth
or smaller.For an entry in the TOC, this level value must be
tocdepth
or smaller.(The article class does not define a
\chapter
command)KR
Rainer
TOC with unnumbered subsections
This is exactly the way I needed to see it tho.
Thanks,
-
- Posts: 1
- Joined: Thu Jun 13, 2024 8:26 am