1

I am trying to add a non number chapter in the table of contents. Below are the packages already in use for the complete document.

\documentclass[12pt,twoside,a4paper]{report}
\usepackage[Sonny]{fncychap}
\usepackage{graphicx}
\graphicspath{{Images/}}
\usepackage{caption}
\usepackage{subcaption}
\usepackage[a4paper,width=150mm,top=25mm,bottom=25mm,bindingoffset=6mm]{geometry}
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhead{}
\fancyhead[RO,LE]{xxxxxxx}
\usepackage{amsmath}
\usepackage{hyperref}
\usepackage[export]{adjustbox}
\usepackage{amssymb}
\usepackage{latexsym}
\usepackage{amsthm}
\usepackage{afterpage}
\usepackage{float}
\usepackage[nottoc]{tocbibind}

**% Trying to add bibliography to TOC
\chapter*{Bibliography}
\input{Chapters/Bibliography}
\cleardoublepage
\addcontentsline{toc}{chapter}{Bibliography}**

For the above statement it does not add the chapter, when I use clearpage instead the page number is wrong in TOC. It states the last page of bibliography as the page number in TOC.

Kindly suggest me what I could do.

  • 2
    Use \cleardoublepage \chapter*{Bibliography} \addcontentsline{toc}{chapter}{Bibliography} \input{Chapters/Bibliography} – user11232 Sep 5 '14 at 1:33
1

Well, this is troubling. You really need to make a minimum working example, or we can't help you nearly as easily. When you don't provide a minimum working example, you're essentially asking the community to shoulder a burden to help you, rather than doing your best to answer it yourself first. That makes it much less likely that someone will help you, since it entails so much extra work.

Here, for example, your text doesn't even compile; there's no \begin{document}, and you have an \inputed file which we don't have any access to. You've also got a huge number of packages here, any one of which could be the culprit; you should remove them, one at a time, until you've got the minimum packages included in which you still encounter the problem.

Your problem here looks to be pretty simple, though, although it's hard to tell given the example we have an the information that we don't have; it looks like you're adding the contents line too late. That is, you're issuing \addcontentsline after you've already included all the information for your chapter, so LaTeX gets its page number after the chapter information has been inserted and paginated. If you add it before that, right after you issue your \chapter command, you should be all right. Try this:

\chapter*{Bibliography}
\addcontentsline{toc}{chapter}{Bibliography}
\input{Chapters/Bibliography}
\cleardoublepage

That resolved the problem on my install, with \cleardoublepage. Using \clearpage instead didn't seem to make any difference. Of course, I didn't have the inputted file, so it's hard to say if that will make a difference. That's another place where a minimum working example would have helped everyone.

Hope that helps.

  • Sorry for the trouble. However the solution you provided works. Thanks. – Siddharth Modi Sep 5 '14 at 2:22
  • I'm glad. None of that was meant hatefully, you understand; it will help you get help as well as help others help you. – dgoodmaniii Sep 5 '14 at 2:51
  • 2
    \cleardoublepage\phantomsection\addcontentsline{toc}{chapter}{Bibliography}\chapter*{Bibliography} is better, because it sets the anchor just before the chapter title and not after it. – egreg Sep 5 '14 at 9:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.