TransWikia.com

How to add references in table of content (ToC) while using documentclass{report} and chapter{}?

TeX - LaTeX Asked by Christoffer on January 4, 2021

In order to have chapters and include them in the table of contents i use:

documentclass[a4paper,12pt]{report}
usepackage{titletoc}

and create my ToC by:

tableofcontents
addtocontents{toc}{protectsetcounter{tocdepth}{2}}

I have tried to include the option
[nottoc,numbib],
but this does unfortunately not work while using usepackage{titletoc}, but works fine while using usepackage{tocbibind}, and I cannot use usepackage{tocbibind} when I have chapters, because they want appear in the ToC then. I create my references as:

bibliographystyle{unsrt}
renewcommand{bibname}{References}
bibliography{tex/bib.bib}  

I hope you can help, and thank in advance, and here is some working code!

documentclass[a4paper,12pt]{report}
usepackage{titletoc}

begin{document}
    title{Title}
    newpage
    
    tableofcontents
    addtocontents{toc}{protectsetcounter{tocdepth}{2}} % Hides subsubsection from the table of contents
    
    newpage
    
    chapter{Chapter 1}
    section{Section 1.1}
    This is a reference cite{art:kammer_EFI}.
    
    chapter{Chapter 2}
    section{Section 2.1}
    
    bibliographystyle{unsrt}
    renewcommand{bibname}{References}
    bibliography{tex/bib.bib}
end{document}

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP