# Table of contents ignores chapters declared after a certain line

Issue: Table of Contents does not list chapters declared after a specific line unless I delete three images.

I have a paper which features six chapters. The last two are not listed in the table of contents, unless I delete the declaration of three images, in which case they are included. I use exactly the same code to produce some images higher up in the paper without issue. TexPad recognizes the chapters declared later. How might I fix or work around this issue? Thanks!

\tableofcontents % Prints the main table of contents

\chapter{this will be displayed in the TOC}

\begin{figure}
\centering
\includegraphics[scale=0.5]{Figures/ts_analysis_logrets.png}
\decoRule
\caption{Log-returns of DAX index}
\label{fig:logrets}
\includegraphics[scale=0.5]{Figures/ts_analysis_logrets_squared.png}
\decoRule
\caption{DAX log returns squared}
\label{fig:logretssquared1}
\end{figure}

\begin{figure}
\centering
\includegraphics[scale=0.5]{Figures/ts_analysis_arch_residuals.png}
\decoRule
\caption{Residuals of ARCH model fitted to DAX log returns}
\label{fig:archresid1}
\end{figure}

\chapter{this will NOT be displayed in the TOC}


\documentclass[
11pt, % The default document font size, options: 10pt, 11pt, 12pt
oneside, % Two side (alternating margins) for binding by default, uncomment to switch to one side
%chapterinoneline,% Have the chapter title next to the number in one single line
english, % ngerman for German
singlespacing, % Single line spacing, alternatives: onehalfspacing or doublespacing
%draft, % Uncomment to enable draft mode (no pictures, no links, overfull hboxes indicated)
%nolistspacing, % If the document is onehalfspacing or doublespacing, uncomment this to set spacing in lists to single
%liststotoc, % Uncomment to add the list of figures/tables/etc to the table of contents
parskip, % Uncomment to add space between paragraphs
%nohyperref, % Uncomment to not load the hyperref package
headsepline, % Uncomment to get a line under the header
]{MastersDoctoralThesis} % The class file specifying the document structure

\usepackage[utf8]{inputenc} % Required for inputting international characters
\usepackage[T1]{fontenc} % Output font encoding for international characters

\usepackage{palatino} % Use the Palatino font by default
\usepackage{amsmath}

\usepackage[backend=bibtex,style=authoryear,natbib=true]{biblatex} % Use the bibtex backend with the authoryear citation style (which resembles APA)

%\usepackage{url}
%\usepackage{breakurl}
\usepackage{listings}
\usepackage{color}
\usepackage{setspace}
\usepackage{tabulary}
\usepackage[]{mcode}
\addbibresource{hng1} % The filename of the bibliography
\usepackage{lscape}
\usepackage[autostyle=true]{csquotes} % Required to generate language-dependent quotes in the bibliography
\usepackage[framed,numbered,autolinebreaks,useliterate]{mcode}

\usepackage{float} %placement
%----------------------------------------------------------------------------------------
%   MARGIN SETTINGS
%----------------------------------------------------------------------------------------

\geometry{
paper=letterpaper, % Change to letterpaper for US letter a4paper
inner=2.5cm, % Inner margin
outer=3.8cm, % Outer margin
bindingoffset=2cm, % Binding offset
top=1.5cm, % Top margin
bottom=1.5cm, % Bottom margin
%showframe,% show how the type block is set on the page
}


(...)

%----------------------------------------------------------------------------------------
%   LIST OF CONTENTS/FIGURES/TABLES PAGES
%----------------------------------------------------------------------------------------

\listoffigures % Prints the list of figures

\listoftables % Prints the list of tables

• Please post a minimal example of code we can copy-paste and compile to reproduce the problem. Screenshots are really not useful here. – cfr May 21 '17 at 23:40
• But you still haven't shown us \decoRule or the \documentclass. – Teepeemm May 22 '17 at 0:31
• Apologies! Added the documentclass, please let me know if there is anything else I should provide. Thanks for your help! – SW7 May 22 '17 at 0:37
• In addition, we need something we can compile. You've just given us fragments, so we can't reproduce the problem you are having. Off-topic: you are loading hyperref too early. It needs to be loaded late. Last or almost last. – cfr May 22 '17 at 2:02
• Nothing you've shown us explains why some entries don't show up in the ToC. – cfr May 22 '17 at 2:04

The filenames of your figures contain underscores (_). Underscores and a couple of other signs (\$, \, & and some more) are reserved in LaTeX.
So there will be an error message as soon as the compiler hits the filename Figures/ts_analysis_logrets_squared.png.