How to make chapter*, section* and subsection* appear in the table of contents

I need to produce a PDF document in which I need some "chapters" (along with its sections and subsections) to be non-numbered but still included in the ToC.

This is for my master thesis. I'm using the book document class, because I don't like memoir defaults.

If I use \chapter*, then LaTeX remove the chapter from the ToC. But I'm required to have those as well in the ToC. Furthermore, the headings (fancy) are not changed with \chapter*.

The overall structure of the thesis is:

\maketitle %% A custom one

\chapter*{Introduction} %% This "chapter" presents the whole thesis


%% Here the real chapters are written

%% Appendixes here

%% bibliography

How can I make \chapter*, \section*, and \subsection* to appear in the ToC and to modify the headers?

Best regards, Manuel.

UPDATE: I think I may be using some packages that interfere with the way headers and footers are generated. The answer of smilingthax gets the first part of the question responded: I have now my \chapter*s on the TOC.

This is my full preamble:

%% inputenc so we can write in spanish

\usepackage{fixltx2e} % LaTeX patches, \textsubscript
\usepackage{cmap} % fix search and cut-and-paste in PDF
%% \usepackage{float} % float configuration
%% \floatplacement{figure}{TH} % place figures here definitely

%% fontenc so we can use TrueType fonts

%% Custom colors
\definecolor{ligthred}{rgb}{1, 0, 0}
\definecolor{black}{rgb}{0, 0, 0}

\definecolor{shade}{HTML}{D4D7FE} %light blue shade

% Margins

\usepackage[pdftex, colorlinks=true, citecolor=ligthred,




\vspace{-1.125in} \titlerule \filleft
\Large\chaptertitlename\ \Large\thechapter}{0mm}
{\filleft}[\vspace{0.5mm} \bigrule]


\fancyhf{}  %% Clears all headers

% admonition (specially marked topic)
  % try \DUadmonition#1{#2}:
  \ifcsname DUadmonition#1\endcsname%
	\csname DUadmonition#1\endcsname{#2}%

% title for topics, admonitions and sidebar
  % call \DUtitle#1{#2} if it exists:
  \ifcsname DUtitle#1\endcsname%
	\csname DUtitle#1\endcsname{#2}%

% error admonition title

% fieldlist environment

% legend

%%% Fallback definitions for Docutils-specific commands
% numeric or symbol footnotes with hyperlinks


\newlength{\DUtablewidth} % internal use in tables


\newcommand{\mx}[1]{\mathbf{\bm{#1}}} % Matrix command
\newcommand{\vc}[1]{\mathbf{\bm{#1}}} % Vector command


Variations on this question have been asked and answered several times on the TeX-specific sister site:

I'm going to copy over Werner's answer to the last of those, because it demonstrates a different technique from any of the existing answers to this question: redefine \section so that the only effect of \section* is to skip printing the section numbers. This will work even when sectioning commands are being issued from the guts of packages you don't control.

[...] Redefine \section to capture and condition on when the starred-version is used. Upon finding \section*, issue it just like you would \section, but remove the number-printing mechanism through an appropriate setting of the counter secnumdepth.

xparse provides an easy interface for (re)defining commands that may have a starred version, as well as an optional argument.


\RenewDocumentCommand{\section}{s o m}{%
    {\setcounter{@secnumdepth}{\value{secnumdepth}}% Store secnumdepth
     \setcounter{secnumdepth}{0}% Print only up to \chapter numbers
     \oldsection{#3}% \section*
     \setcounter{secnumdepth}{\value{@secnumdepth}}}% Restore secnumdepth
    {\IfValueTF{#2}% \section
       {\oldsection[#2]{#3}}% \section[.]{..}
       {\oldsection{#3}}}% \section{..}

(To do the same thing to \chapter, \subsection, etc., search-and-replace section appropriately, and adjust the temporary value used for secnumdepth.)

Posted on by zwol


worked for me as a solution if you used the un-asterisk version of \chapter{} etc for the book class. Hyperref works as well if you wanted a linkable ToC along with my solution. Make sure to compile it twice to get it to work on both the ToC and inline.

Unfortunately however, your preamble killed my TexStudio attempt to check to see if it worked for your exact code, but I have faith.

Used TeXstudio 2.6.2 (SVN 4110M) Using Qt Version 4.8.5, compiled with Qt 4.8.5 R On Windows 7 64-bit

Posted on by Anonymous

I have solved it using the following:


I have just added this line \addcontentsline{toc}{chapter}{Introduction} after the \chapter{Introduction}*. Then I have written my writings of this chapter. Now it appears in the table of contents perfectly.

Posted on by Masud Shrabon

I had the same problem and solved it with smilingthax' answer and comments. As it didn't work to use only \leftmark or \rightmark, here is a command that you can use to (i) make a chapter non-numbered (ii) add it to the TOC and (iii) have a correct page header.


The same works for sections (and subsections respectively):

Posted on by Anonymous

I don't think an specialized command exists for that. But you can use


to add it to the TOC. BTW, I didn't have problems with \chapter* and fancy, so I used:


Posted on by smilingthax