I am using tufte-book document class. I would like to add a part at the end of the document which is neither a chapter nor a section. How can I do for making this part visible in the tableofcontents?
Asked
Active
Viewed 1.1e+01k times
1 Answers
117
Remarks
You may use the \addcontentsline command. The syntax is defined as follows
\addcontentsline{TABLE}{LEVEL}{TITLE}
TABLEstands for the type of list, where you want to add the item, possible are:toc: Table of contentslof: List of figureslot: List of tables
LEVELwill be the level at which the line will appear in the list. Possible are:- For
toc:chapter,section,subsection - For
lof:figure - For
lot:table
- For
TITLEis your heading.
For example
\addcontentsline{toc}{chapter}{Appendix}
will add Appendix to your table of contents, but will NOT typeset the heading within the document. You need to use \chapter*{Appendix} for this.
Implementation
\documentclass{tufte-book}
\setcounter{secnumdepth}{3}
\setcounter{tocdepth}{3}
\begin{document}
\tableofcontents
\chapter{Introduction}
\section{Historical Overview}
\chapter{Implementation}
\section{The CUDA Model}
\section{A Lattice Boltzmann Solver}
\chapter*{Appendix}
\addcontentsline{toc}{chapter}{Appendix}
\section*{The Mathematical Background}
\addcontentsline{toc}{section}{The Mathematical Background}
\subsection*{Proofs}
\addcontentsline{toc}{subsection}{Proofs}
\end{document}
Output
Henri Menke
- 109,596

\chapter*{...}\addcontentsline{toc}{chapter}{...}by\chapter{...}to restore the default behaviour. – Henri Menke Jan 27 '14 at 18:23\phantomsectionmight be needed if the hyperref doesn't work properly... – Future Liang Sep 10 '23 at 20:29