title: How to make chapter*, section* and subsection* appear in the table of contents
body: <p>I need to produce a PDF document in which I need some &quot;chapters&quot; (along with its sections and subsections) to be non-numbered but still included in the ToC.</p>
  <p>This is for my master thesis. I'm using the book document class, because I don't like memoir defaults.</p>
  <p>If I use <code>\chapter*</code>, 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 <code>\chapter*</code>.</p>
  <p>The overall structure of the thesis is:</p>
  <pre><code>\maketitle %% A custom one
  \frontmatter
  \tableofcontents
  \listoftables
  \listoffigures
  
  \chapter*{Abstract}
  \chapter*{Introduction} %% This &quot;chapter&quot; presents the whole thesis
  
  \mainmatter
  
  %% Here the real chapters are written
  
  \appendix
  %% Appendixes here
  
  %% bibliography
  </code></pre>
  <p>How can I make <code>\chapter*</code>, <code>\section*</code>, and <code>\subsection*</code> to appear in the ToC and to modify the headers?</p>
  <p>I think I may be using some packages that interfere with the way headers and footers are generated. The answer of <a href="https://stackoverflow.com/users/483341/smilingthax">smilingthax</a> gets the first part of the question responded: I have now my \chapter*s on the TOC.</p>
  <p>This is my full preamble:</p>
  <pre><code>\usepackage[sort&amp;compress,round,semicolon]{natbib}
  \usepackage{babel}
  \usepackage{setspace}
  %% inputenc so we can write in spanish
  \usepackage[utf8]{inputenc}
  
  \usepackage{fixltx2e} % LaTeX patches, \textsubscript
  \usepackage{cmap} % fix search and cut-and-paste in PDF
  \usepackage{ifthen}
  %% \usepackage{float} % float configuration
  %% \floatplacement{figure}{TH} % place figures here definitely
  
  %% fontenc so we can use TrueType fonts
  \usepackage[T1]{fontenc}
  \usepackage{lmodern}
  \usepackage{garamond}
  \usepackage{graphicx}
  \usepackage{titlesec}
  
  \usepackage[table]{xcolor}
  %% Custom colors
  \definecolor{blue}{rgb}{0.2,0.2,0.95}
  \definecolor{green}{rgb}{0.2,0.95,0.2}
  \definecolor{red}{rgb}{0.95,0.2,0.2}
  \definecolor{cyan}{rgb}{0,0,0.95}
  \definecolor{ligthred}{rgb}{1, 0, 0}
  \definecolor{black}{rgb}{0, 0, 0}
  
  \definecolor{shade}{HTML}{D4D7FE} %light blue shade
  
  % Margins
  \usepackage[left=0.9in,top=1in,right=0.7in,bottom=1in]{geometry}
  
  
  \usepackage[pdftex, colorlinks=true, citecolor=ligthred,
    urlcolor=blue]{hyperref}
  
  \widowpenalty9000
  \clubpenalty7000
  
  \usepackage{titlesec}
  \newcommand{\bigrule}{\titlerule[0.5mm]}
  
  \renewcommand{\rmdefault}{bch} 
  
  \titleformat{\chapter}[display]
  {\bfseries\Huge}
  {\garamond
  % DESCOMENTAR PARA SUBIR LOS CAPITULOS
  \vspace{-1.125in} \titlerule \filleft
  \Large\chaptertitlename\ \Large\thechapter}{0mm}
  {\filleft}[\vspace{0.5mm} \bigrule]
  
  \let\cite=\citep
  
  \usepackage{fancyhdr}
  \pagestyle{fancy}
  \fancyhf{}  %% Clears all headers
  
  % admonition (specially marked topic)
  \providecommand{\DUadmonition}[2][class-arg]{%
    % try \DUadmonition#1{#2}:
    \ifcsname DUadmonition#1\endcsname%
      \csname DUadmonition#1\endcsname{#2}%
    \else
      \begin{center}
        \fbox{\parbox{0.9\textwidth}{#2}}
      \end{center}
    \fi
  }
  
  % title for topics, admonitions and sidebar
  \providecommand*{\DUtitle}[2][class-arg]{%
    % call \DUtitle#1{#2} if it exists:
    \ifcsname DUtitle#1\endcsname%
      \csname DUtitle#1\endcsname{#2}%
    \else
      \smallskip\noindent\textbf{#2}\smallskip%
    \fi
  }
  
  % error admonition title
  \providecommand*{\DUtitleerror}[1]{\DUtitle{\color{red}#1}}
  
  % fieldlist environment
  \ifthenelse{\isundefined{\DUfieldlist}}{
    \newenvironment{DUfieldlist}%
      {\quote\description}
      {\enddescription\endquote}
  }{}
  
  % legend
  \ifthenelse{\isundefined{\DUlegend}}{
    \newenvironment{DUlegend}{\small}{}
  }{}
  
  %%% Fallback definitions for Docutils-specific commands
  % numeric or symbol footnotes with hyperlinks
  \providecommand*{\DUfootnotemark}[3]{%
    \hyperlink{#2}{\textsuperscript{#3}}\raisebox{1em}{\label{#1}}%
  }
  
  \providecommand{\DUfootnotetext}[4]{%
    \begingroup%
    \renewcommand{\thefootnote}{%
      \protect\hyperlink{#2}{#3}}%
    \protect\raisebox{1em}{\protect\label{#1}}%
    \footnotetext{#4}%
    \endgroup%
  }
  
  \usepackage{booktabs}
  \usepackage{multirow}
  \usepackage{longtable}
  \newlength{\DUtablewidth} % internal use in tables
  
  
  \usepackage{tikz}
  \usepackage{bbding}
  
  \usetikzlibrary{arrows,fit}
  \usepackage{amsmath,bm,times}
  \newcommand{\mx}[1]{\mathbf{\bm{#1}}} % Matrix command
  \newcommand{\vc}[1]{\mathbf{\bm{#1}}} % Vector command
  </code></pre>