# Issue with Chapters Being Included in List of Figures

I was editing a table of contents earlier this week and, thanks to this forum, was able to get most of the formatting down. This post is still about the table of contents, but now it is in regards to a rather weird occurrence. After sending in my revised thesis, the reviewer noted that there should be double spacing throughout the entire table of contents. Also, the table of contents should follow the acknowledgments, then the list of tables, list of figures, and then the chapters. I am also using the UNT style file which I have slightly modified. In the MWE below, I was able to do most of this:

\documentclass[12pt, titlepage, openany]{amsbook}

\makeatletter
\renewcommand\tocchapter[3]{%
}
\makeatother

\makeatletter
\def\@tocline#1#2#3#4#5#6#7{\relax
\ifnum #1>\c@tocdepth % then omit
\else
\begingroup \hyphenpenalty\@M
\@ifempty{#4}{%
\@tempdima\csname r@tocindent\number#1\endcsname\relax
}{%
\@tempdima#4\relax
}%
\rightskip\@pnumwidth plus4em \parfillskip-\@pnumwidth
#5\leavevmode\hskip-\@tempdima #6\nobreak\relax
\ifnum#1<0\hfill\else\dotfill\fi\hbox to\@pnumwidth{\@tocpagenum{#7}}\par
\nobreak
\endgroup
\fi}
\makeatother

\makeatletter
\DeclareRobustCommand{\l@specialchapter}{%
\let\@tocpagenum\@gobble
\@tocline{-1}{8pt plus 1pt}{0pt}{}{}}
\makeatother

\usepackage{amsmath, setspace, fancyhdr, times, graphicx}
\usepackage{lipsum}

\begin{document}

\doublespacing

\tableofcontents

\begin{doublespace}
\listoftables
\end{doublespace}
\begin{doublespace}
\listoffigures
\end{doublespace}

\makeatletter
\let\protect\l@chapter\l@specialchapter}
\makeatother

\mainmatter

\begin{doublespace}
\chapter{..} \lipsum[1-20] %This is the chapter that gets placed in LoF
\chapter{..} \lipsum[1-20]
\chapter{..} \lipsum[1-20]
\chapter{..} \lipsum[1-20]
\chapter{..} \lipsum[1-20]
\end{doublespace}

\end{document}


Although I feel that I am almost done, there is a new issue of the first chapter being included in the List of Figures which is not good. I have tried to move around the location of the list of tables/figures, but then the word CHAPTER gets moved as well which is not acceptable. Also the doublespacing commands do not seem to be working on the table of contents.

Is there a way to fix this? Any help is deeply, and most sincerely, appreciated. Many thanks in advance.

UPDATE

So I have been trying really hard to correct this misplaced chapter issue and here is what I have noticed: If I use the \include{...} command to call the .tex files that I have written, then it seems that only the first one will be included in the list of figures, for some unknown reason (I use \include{chapter1}, ... , \include{chapter5}). I was trying to reverse engineer the problem starting from the MWE above which led me to notice this. I also tried to create an empty chapter, but to no avail. At this point, it seems like LaTeX is going haywire on me. If anyone has an idea or can come up with a solution, please let me know as this will help me finish this thesis that I am working on. Also, I would be glad to send a copy of these files so that one may further investigate/see what is going on. Thank you for your time.

• Is "Background Information" in chapter1.tex? Does it use \chapter*? You should really consider providing the community with something that doesn't require additional sources not available in your question. For example, instead of \include{chapter1}, use \chapter{..} \lipsum[1-20] (say). – Werner Jun 2 '16 at 18:32
• Yes, "Background Information" is in chapter1.tex, and it does not use the asterisk * after the command. I just edited the post according to your suggestion. – Jamil Villarreal Jun 2 '16 at 18:44
• ...no... not just a verbatim copy-and-paste of what I suggested. Instead, read up on how to create a minimal working example (MWE). We want to copy-and-paste-and-compile your entire code block without seeing an error, but also see exactly what you're seeing in the output. \lipsum[1-20] causes an error as you haven't included the lipsum package. – Werner Jun 2 '16 at 18:45
• ...please click the MWE link and read the resulting posts on TeX - LaTeX Meta. – Werner Jun 2 '16 at 18:45
• Ok. I apologize for carelessly having copy-and-paste that suggestion. I have included a working MWE that compiles without any errors. In that MWE, however, the table of contents does not include the first chapter in the list of figures. – Jamil Villarreal Jun 2 '16 at 19:16

A quick workaround would be to delete the following lines

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\makeatletter
\let\protect\l@chapter\l@specialchapter}
\makeatother

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


in your main tex file JamilVThesis.tex and add them as first lines in your file chapter1.tex:

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\makeatletter
\let\protect\l@chapter\l@specialchapter}

Now the text Chapter can be added to the TOC at the place where it belongs, in front of your chapters ...