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]{%
\indentlabel{\@ifnotempty{#2}{\ignorespaces#2.\quad}}#3%
}
\makeatother
\makeatletter
\def\@tocline#1#2#3#4#5#6#7{\relax
\ifnum #1>\c@tocdepth % then omit
\else
\par \addpenalty\@secpenalty\addvspace{#2}%
\begingroup \hyphenpenalty\@M
\@ifempty{#4}{%
\@tempdima\csname r@tocindent\number#1\endcsname\relax
}{%
\@tempdima#4\relax
}%
\parindent\z@ \leftskip#3\relax \advance\leftskip\@tempdima\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}
\addcontentsline{toc}{chapter}{TABLE OF CONTENTS}%\dotfill}
\doublespacing
\tableofcontents
\begin{doublespace}
\listoftables
\end{doublespace}
\begin{doublespace}
\listoffigures
\end{doublespace}
\makeatletter
\addtocontents{toc}{\begingroup
\let\protect\l@chapter\l@specialchapter}
\addcontentsline{toc}{chapter}{CHAPTER}
\addtocontents{toc}{\endgroup}
\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}
I apologize for including so much, but here is what the table of contents looks like:
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.
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).\lipsum[1-20]
causes an error as you haven't included thelipsum
package.