6

I am trying to include the bibliography in the toc. I tried \addcontentsline{toc}{chapter}{Contents}{Bibliography}

but it does not work. I get

enter image description here

I need to make it left like abstract and bolded. below is my code. Please give me a minimal effort suggestion because i am new to latex.

\documentclass[pdftex,12pt,a4paper]{report}
\usepackage{titlesec}
\titleformat{\chapter}{\bfseries\huge}{\thechapter.}{20pt}{\huge}

\usepackage[top=3cm, bottom=3cm, left=3.5cm, right=3cm]{geometry}

% graphics images
\usepackage[pdftex]{graphicx}
\usepackage[toc,page]{appendix}
\usepackage{slashbox}

% 1.5 line spacing
\usepackage{setspace}
\usepackage{tabu}
\usepackage{tabularx}
\onehalfspacing

% maths symbols
\usepackage{amsmath}
%\usepackage[math-style = upright]{unicode-math}

% table package
\usepackage{multirow}

% citation style
\usepackage[colorlinks=true,linkcolor=blue]{hyperref}%
\makeatletter
\let\Hy@linktoc\Hy@linktoc@none
\makeatother

\usepackage[square,sort,comma,numbers]{natbib}
\usepackage{amsfonts}

%\renewcommand{\chaptername}{}

\usepackage{tikz,colortbl}
\usetikzlibrary{calc}
\usepackage{zref-savepos}

\usepackage[bf,small,tableposition=top]{caption}
\usepackage{subfig}
\usepackage{float}
\usepackage{url}
\usepackage{pdfpages}

\begin{document}

% cover
%\input{cover_report.tex}
\includepdf[pages=1]{CoverPage}

% abstract
\setcounter{page}{1}
\pagenumbering{roman}
\input{abstract.tex}

% acknowledgement
\input{acknowledgements.tex}

% table of content
\tableofcontents
\addcontentsline{toc}{chapter}{Contents}{Bibliography}

% list of tables
%\listoftables
%\addcontentsline{toc}{chapter}{List of Tables}

% list of figures
%\listoffigures
%\addcontentsline{toc}{chapter}{List of Figures}

% intro chapter
\cleardoublepage
\pagenumbering{arabic}
\input{intro.tex}
\input{literature.tex}
\input{dataset.tex}
%\input{propose.tex}
\input{module_design.tex}
\input{training.tex}
\input{results.tex}
\input{conclusion.tex}

% references
%\bibliographystyle{plainnat}
\bibliographystyle{unsrtnat}
\bibliography{fyp}

% appendix
%\input{appendix.tex}
\end{document}
4

1 Answer 1

9
\documentclass{report}
\usepackage{hyperref}

\makeatletter
\let\Hy@linktoc\Hy@linktoc@none
\makeatother

\begin{document}

\tableofcontents

\chapter{Test}

\phantomsection 
\addcontentsline{toc}{chapter}{Bibliography} 
\bibliographystyle{unsrtnat} 
\bibliography{fyp}

\end{document}

enter image description here

2
  • 1
    I don't have enough reputation to comment the answer of @samcarter, but I see in the output that the chapter Test and Bibliography are in the same page, which doesn't look very nice. This line helped me: \usepackage[nottoc,notlot,notlof]{tocbibind}
    – Titianne
    Sep 19, 2017 at 15:03
  • This also did the trick for getting the index to print in the ToC
    – cwa
    Sep 24, 2022 at 2:42

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .