Using \setcounter{tocdepth}{0}
displays just the chapter's title in the table of contents. In the last chapter, there's a subsection. I want to use \setcounter{tocdepth}{0}
! Therefore no subsection should be displayed in the table of content. However, using the option 0, a problem shows up. The subsections are not displayed in the table of contents, but there's a gap between the last chapter and the references in the end. It seems like the option 0 just doesn't print the subsection in the contents, leaving some space between the last chapter and the references chapter. I added a picture, as well as the used template (not the complete, it's too long). If I use \setcounter{tocdepth}{1}
there is no gap, and everything looks fine! But I do not want to have the sections in the table of content
Here is a test code, but without the thesis.cls
it won't compile.
\documentclass[10pt,twoside,openright]{thesis}
\usepackage{graphicx} % if you want to include graphics files
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{amsfonts}
\usepackage[english]{babel}
\usepackage[utf8]{inputenc}
\begin{document}
%\titlepage % Print titlepage
\newpage % blank page
%\copyrightpage % optional
\tableofcontents % required
%\listoftables % required if there are tables
%\listoffigures % required if there are figures
\chapter{test1}
some text
\chapter{test2}
more text
\section{test3}
ds
\chapter{test4}
\end{document}
Some lines from the thesis.cls
file.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% SECTION HEADINGS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand\chaptersize{\large}
\newcommand\sectionsize{\large}
\newcommand\subsectionsize{\normalsize}
\newcommand\subsubsectionsize{\normalsize}
\newcounter{firstchapter}
\setcounter{firstchapter}{0}
\setcounter{secnumdepth}{3} % Number subsubsections in the chapters
\setcounter{tocdepth}{0} % Put subsubsections in the table of contents
% Print "CHAPTER" if chap option is specified:
\ifchap
\renewcommand\@chapapp{\chaptername}
\else
\renewcommand\@chapapp{}
\fi
\def\specialhead#1{% GENERAL HEADING WITHOUT A NUMBER (for abstract, etc.)
\ifx\phantomsection\undefined
\else
\clearpage\phantomsection
\fi
\addcontentsline{toc}{chapter}{#1}
\chapter*{\centering #1 \@mkboth{#1}{#1}}}
\def\@chapter[#1]#2{\ifnum\c@firstchapter=0 % start of rpi added stuff
\if@twoside\cleardoublepage\suppressfloats[t]\fi
\pagenumbering{arabic}
\setcounter{firstchapter}{1}
\fi
\renewcommand{\thepage}{\arabic{page}}
\thispagestyle{plain}
\pagestyle{myheadings} % end of rpi added stuff
\ifnum \c@secnumdepth >\m@ne
\refstepcounter{chapter}%
\typeout{\@chapapp\space\thechapter.}%
\addcontentsline{toc}{chapter}%
{\protect\numberline{\thechapter.}#1}%
\else
\addcontentsline{toc}{chapter}{#1}%
\fi
\chaptermark{#1}%
% \addtocontents{lof}{\protect\addvspace{10\p@}}%
% \addtocontents{lot}{\protect\addvspace{10\p@}}%
\if@twocolumn
\@topnewpage[\@makechapterhead{#2}]%
\else
\@makechapterhead{#2}%
\@afterheading
\fi}
\def\@makechapterhead#1{%
\vspace*{0\p@}%
{\parindent \z@ \raggedright \centering \normalfont \chaptersize
\ifnum \c@secnumdepth >\m@ne
\ifchap
\bfseries \@chapapp{} \thechapter % print "Chapter" and number
\vskip -3pt %\par\nobreak (original)
\else
\bfseries \thechapter.
\fi
\fi
\interlinepenalty\@M
\bfseries #1\par\nobreak
\vskip 15\p@
}}
\def\@makeschapterhead#1{% heading for chapter* command (no numbering)
\vspace*{0\p@}%
{\parindent \z@ \raggedright \centering
\normalfont \chaptersize
\interlinepenalty\@M
\bfseries #1\par\nobreak
\vskip 15\p@
}}
\renewcommand\section{\@startsection {section}{1}{\z@}%
{3.5ex \@plus 1ex \@minus .2ex}%
{.5ex \@plus .3ex}%{1.4ex \@plus.2ex}%
{\normalfont\sectionsize\bfseries}}
\renewcommand\subsection{\@startsection{subsection}{2}{\z@}%
{3.25ex\@plus 1ex \@minus .2ex}%
{.3ex \@plus .2ex}%{1.2ex \@plus .2ex}%
{\normalfont\subsectionsize\bfseries}}
\renewcommand\subsubsection{\@startsection{subsubsection}{3}{\z@}%
{3.25ex\@plus 1ex \@minus .2ex}%
{.2ex \@plus .1ex}%{1ex \@plus .2ex}%
{\normalfont\subsubsectionsize\bfseries}}
% \paragraph and \subparagraph headings unchanged from report.cls.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% TABLE of CONTENTS, LIST OF TABLES, LIST OF FIGURES
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\renewcommand\tableofcontents{%
\if@twocolumn
\@restonecoltrue\onecolumn
\else
\@restonecolfalse
\fi
\chapter*{\contentsname
\@mkboth{%
\MakeUppercase\contentsname}{\MakeUppercase\contentsname}}%
\vskip -1em \begin{singlespace} % singlespacing
\@starttoc{toc}%
\if@restonecol\twocolumn\fi
\end{singlespace}
}
\renewcommand*\l@chapter{\pagebreak[3]\vskip 10pt plus 1pt minus 1pt
\@dottedtocline{0}{0em}{1.4em}}
\renewcommand*\l@section{\vskip 6pt plus 1pt minus 1pt
\@dottedtocline{1}{1.5em}{2.3em}}
\renewcommand*\l@subsection{\ifnum\c@tocdepth>1\vskip 4pt minus 1pt \fi
\@dottedtocline{2}{3.8em}{3.2em}}
\renewcommand*\l@subsubsection{\ifnum\c@tocdepth>2 \vskip 3pt minus 1pt \fi
\@dottedtocline{3}{7.0em}{4.1em}}
% The following removed because it's not consistent with entries from longtable
%% modify the definition below (taken from latex.ltx) to include
%% "Table" and "Figure" in entries for lot and lof:
%\long\def\@caption#1[#2]#3{%\baselineskip 14.5 pt
% \addcontentsline{\csname ext@#1\endcsname}{#1}%
% {\protect\numberline{\csname fnum@#1\endcsname}{\ignorespaces #2}}%
% \begingroup
% \@parboxrestore
% \normalsize
% \@makecaption{\csname fnum@#1\endcsname}{\ignorespaces #3}\par
% \endgroup}
\renewcommand\listoffigures{%
\if@twocolumn
\@restonecoltrue\onecolumn
\else
\@restonecolfalse
\fi
\ifx\phantomsection\undefined
\else
\clearpage\phantomsection
\fi
\addcontentsline{toc}{chapter}{\listfigurename} % add lof to toc
\chapter*{\centering\listfigurename % center it
\@mkboth{\MakeUppercase\listfigurename}%
{\MakeUppercase\listfigurename}}%
\vskip -1em \begin{singlespace} % singlespacing
\@starttoc{lof}%
\if@restonecol\twocolumn\fi
\end{singlespace}
}
\renewcommand\listoftables{%
\if@twocolumn
\@restonecoltrue\onecolumn
\else
\@restonecolfalse
\fi
\ifx\phantomsection\undefined
\else
\clearpage\phantomsection
\fi
\addcontentsline{toc}{chapter}{\listtablename} % add lot to toc
\chapter*{\centering\listtablename % center it
\@mkboth{\MakeUppercase\listtablename}%
{\MakeUppercase\listtablename}}%
\vskip -1em \begin{singlespace} % singlespacing
\@starttoc{lot}%
\if@restonecol\twocolumn\fi
\end{singlespace}
}
%remove following at same time as remove code to put "Figure" in LOF
%\renewcommand*\l@figure{\vskip 10pt plus 1pt minus 1pt
% \@dottedtocline{1}{0em}{5.8em}}
\renewcommand*\l@figure{\vskip 10pt plus 1pt minus 1pt
\@dottedtocline{1}{0em}{2.8em}}
\let\l@table\l@figure
\let\rpicaption\caption
\let\lrpicaption\caption
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% BIBLIOGRAPHY
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% RPI def: for use in making an unnumbered bibliography with hanging indents
\def\bibentry{\vskip10pt\par\noindent\hangindent=40pt\frenchspacing}
% report definition modified for no automatic heading and use ragged right
\newcommand{\bibalign}{\raggedright}
\renewenvironment{thebibliography}[1]
{\bibalign\frenchspacing
\list{\@biblabel{\@arabic\c@enumiv}}%
{\settowidth\labelwidth{\@biblabel{#1}}%
\leftmargin\labelwidth
\advance\leftmargin\labelsep
\@openbib@code
\usecounter{enumiv}%
\let\p@enumiv\@empty
\renewcommand\theenumiv{\@arabic\c@enumiv}}%
\sloppy\clubpenalty4000\widowpenalty4000%
\sfcode`\.=\@m}
{\def\@noitemerr
{\@latex@warning{Empty `thebibliography' environment}}%
\endlist}