# Why is there a huge gap on top of my TOC?

I tried to delete all the geometry and delete the usepackage{geometry} and all the margins and everything but end up the TOC is still away from my top a lot. I want it to have 50mm away from the top. i've printed it out and measured it. It's 85mm..

Even my list of figures, tables, listings are all 85mm...

\documentclass[12pt, a4paper, oneside]{report}
\usepackage[T1]{fontenc}
\usepackage{mathptmx} %times font
\usepackage[latin1]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage{enumerate}
\usepackage{hyperref}
\usepackage{setspace}
\usepackage[english]{babel} %roman & arabic label page
\usepackage[top=50mm, bottom=50mm, left=45mm, right=45mm]{geometry}
%\usepackage{tocbibind} %for hyperref
\usepackage{indentfirst}
\usepackage{apacite} %cite apa
\usepackage{array} %for table width
\usepackage{listings} %codes
\usepackage{caption} % code caption
\usepackage{color} % code caption
\usepackage{xcolor} %code caption
\usepackage{titlesec} % set section/subsection fontstyle & fontsize

\titleformat{\section}
{\normalfont\fontsize{14}{14}\bfseries\itshape}{\thesection}{1em}{}

\titleformat{\subsection}
{\normalfont\fontsize{12}{12}\bfseries\itshape}{\thesubsection}{1em}{}

\DeclareCaptionFont{white}{\color{white}}
\DeclareCaptionFormat{listing}{\colorbox{gray}{\parbox{\textwidth}{#1#2#3}}}

\hypersetup{
linktoc=all,     %set to all if you want both sections and subsections     linked
linkcolor = black,  %choose some color if you want links to stand out
urlcolor=blue, % for \url
citecolor=black,
}

\pagenumbering{Roman}

\begin{document}
\input{CoverPage}
\thispagestyle{empty}
\cleardoublepage

\input{TitlePage}
\thispagestyle{empty}
\cleardoublepage

\phantomsection
\setcounter{page}{1}
\cleardoublepage

\phantomsection
\input{DeclarationPage}
\cleardoublepage

\phantomsection
\input{AcknowledgementPage}
\cleardoublepage

\phantomsection
\input{ManagementSummaryPage}
\cleardoublepage

\phantomsection
\tableofcontents
\cleardoublepage

\phantomsection
\listoffigures
\cleardoublepage

\phantomsection
\listoftables
\cleardoublepage

\phantomsection
\renewcommand\lstlistlistingname{List of Algorithms}
\lstlistoflistings
\cleardoublepage

% % (1) =========================================

\pagenumbering{arabic}
\phantomsection
\setcounter{chapter}{1}
\input{Chapter1}
\cleardoublepage

\phantomsection
\addcontentsline{toc}{chapter}{Chapter 2 : Background Study }
\setcounter{chapter}{2}
\input{Chapter2}
\cleardoublepage

\phantomsection
\addcontentsline{toc}{chapter}{Chapter 3 : Requirements \& Design}
\setcounter{chapter}{3}
\input{Chapter3}
\cleardoublepage

\phantomsection
\setcounter{chapter}{4}
\input{Chapter4}
\cleardoublepage

\phantomsection
\setcounter{chapter}{5}
\input{Chapter5}
\cleardoublepage

\phantomsection
\setcounter{chapter}{6}
\input{References}
\cleardoublepage

\phantomsection
\setcounter{chapter}{7}
\input{Appendix}
\cleardoublepage

\end{document}

• Presumably that is the design for chapter headings in your class. since you have given no indication of the input, impossible to say anything. – David Carlisle Sep 15 '15 at 10:21
• As always, please post a MWE showing this problem. This is just the design of either \chapter* or \section* of your document – daleif Sep 15 '15 at 10:22
• No minimal working example, no answer. – yo' Sep 15 '15 at 10:23
• Well, your edit is nice, but this is not a full example, starting at \documentclass and ending at \end{document}. Please, try to help us help you. Thanks. – yo' Sep 15 '15 at 10:30
• I'm pretty sure that if you try with \chapter*{Introduction} the result will be the same. If the question is “how to push the title of an unnumbered chapter up to the text block border?” then it may receive an answer, provided you tell what document class you're using. – egreg Sep 15 '15 at 10:30

What you want is: to modify the spacing around chapter titles. This is done for instance by using the package titlesec:

\usepackage{titlesec}
\titleformat{\chapter}[display]{\normalfont\huge\bfseries}%
{\chaptertitlename\ \thechapter}{20pt}{\Huge}
\titlespacing*\chapter{0pt}{10pt}{40pt}


You can fiddle with the values 10pt and 40pt to fine-tune the spacing to your liking.

Needed to say, there is more comments I have on your code:

• I don't understand **why you set the chapter counter each time, and why you use \phantomsection and \addcontentsline manually. That seems to be a big abuse of the system, things should be surely done another way.

• Note that if you want chapters to start on odd page, you can't use [oneside] and you have to add [openright] in the report class. The book class set [twoside,openright] as default.

• Instead of manually adding ToC, LoT etc. in the table of contents, you better use the package {tocbibind}.

• hyperref should be loaded after most other packages. color is not needed if you load xcolor.

• It's better not to use explicit \fontsize{}{} command but rely on the standard commands; 12pt is \normalsize for your setup, and 14pt is \large. If you decide to use \fontsize, the 2nd number should be larger by ~20%, so \fontsize{12}{14} and \fontsize{14.4}{17} would have been better, for instance.

In the end, your code could look like this:

\documentclass[12pt, a4paper]{book}
\usepackage[T1]{fontenc}
\usepackage{mathptmx} %times font
\usepackage[latin1]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage{enumerate}
\usepackage{setspace}
\usepackage[english]{babel} %roman & arabic label page
\usepackage[top=50mm, bottom=50mm, left=45mm, right=45mm]{geometry}
\usepackage{tocbibind} %for hyperref
\usepackage{indentfirst}
\usepackage{apacite} %cite apa
\usepackage{array} %for table width
\usepackage{listings} %codes
\usepackage{caption} % code caption
\usepackage{xcolor} % code caption

\usepackage{blindtext} % to provide some dummy text

\usepackage{titlesec}

\titleformat{\chapter}[display]{\normalfont\huge\bfseries}%
{\chaptertitlename\ \thechapter}{20pt}{\Huge}
\titlespacing*\chapter{0pt}{10pt}{40pt}

\titleformat{\section}
{\normalfont\large\bfseries\itshape}{\thesection}{1em}{}

\titleformat{\subsection}
{\normalfont\normalsize\bfseries\itshape}{\thesubsection}{1em}{}

\DeclareCaptionFont{white}{\color{white}}
\DeclareCaptionFormat{listing}{\colorbox{gray}{\parbox{\textwidth}{#1#2#3}}}

\usepackage{hyperref}

\hypersetup{
linktoc=all,     %set to all if you want both sections and subsections     linked
linkcolor = black,  %choose some color if you want links to stand out
urlcolor=blue, % for \url
citecolor=black,
}

\begin{document}

% FRONTMATTER

\pagenumbering{Roman}

\tableofcontents

\listoffigures

\listoftables

\renewcommand\lstlistlistingname{List of Algorithms}
\lstlistoflistings

% MAINMATTER

\cleardoublepage
\pagenumbering{arabic}

\chapter{First Chapter}
\Blindtext

\chapter{Second Chapter}
\Blindtext

\end{document}

• the 0pt 10pt and 40pt is what ah? as in 0pt is the beginning isit? 10 and 40 is?? o.o – Michimcchicken Sep 15 '15 at 11:01
• and the {\chaptertitlename\ \thechapter}{20pt}{\Huge} can i use default and delete this line? o.o – Michimcchicken Sep 15 '15 at 11:02
• @Michimcchicken This should make the default. If you don't use \titleformat{\chapter} at all, then \titlespacing*{\chapter} cannot do anything. – yo' Sep 15 '15 at 11:04
• For the meaning of the dimensions in \titlespacing, read the titlesec documentation – yo' Sep 15 '15 at 11:06
• @Michimcchicken You're welcome :) – yo' Sep 15 '15 at 11:12