I am using document class report. I have some pages like abstract, acknowledgements, dedication which appear before table of contents
As I saw in the following page
Insert list of figures in the table of contents
I need to add
\addcontentsline {toc}{chapter}{Abstract}
to my code.
I have the following code
\pagenumbering{roman}
\setcounter{page}{2}
\include{Abstract}
\addcontentsline {toc}{chapter}{Abstract}
\include{Dedication}
\addcontentsline {toc}{chapter}{Dedication}
\include{Acknowledgements}
\addcontentsline {toc}{chapter}{Acknowledgements}
%\addcontentsline{toc}{chapter}{\tableofcontents}
\tableofcontents
\listoffigures
\addcontentsline{toc}{chapter}{\listfigurename}
\include{Abbreviations}
\addcontentsline {toc}{chapter}{Abbreviations}
\pagenumbering{arabic}
\setcounter{page}{1}
\include{Introduction}
.....
Note that I tried adding \addcontentsline before and after the include, with the same results.
I also use the following:
\usepackage{hyperref}
\hypersetup{
colorlinks,
citecolor=black,
filecolor=black,
linkcolor=black,
urlcolor=black}
I have three problems:
1- The above code adds the pages abstract, acknowledgements, dedication to the table of contents, but when I click, they don't take me to the right page.
2- I am not able to add table of contents to table of contents.
3- For some reason, Abbreviations (which has two pages) is listed after the chapter 1 in table of contents. When I click it, it only takes me to page 2 of abbreviation.
Also is there a way to hide the chapter name from being displayed in the dedication page?
Your help is most appreciated.
Best Answer
You need to insert a
\phantomsection
instruction immediately after\chapter*{Abstract}
,chapter*{Dedication}
,\chapter*{Acknowledgments}
, etc. This should happen, obviously, inside the filesAbstract.tex
,Dedication.tex
,Acknowledgments.tex
, etc.I suggest you load the
tocbibind
package with the optionnotindex
:This setup also provides for insertion of entries for the list of figures, the list of tables, and the bibliography in the table of contents. I.e., you will no longer need to provide the instruction
\addcontentsline{toc}{chapter}{\listfigurename}
.Of course, if your document does contain an (unnumbered) index and if you wish to show this (unnumbered) entity, you can omit the option
notindex
.This is happening because the instruction
\addcontentsline {toc}{chapter}{Abbreviations}
occurs too late, viz., after both pages of abbreviations have been generated by LaTeX. I suggest you move\addcontentsline {toc}{chapter}{Abbreviations}
into fileAbbreviations.tex
and execute it right after\chapter*{Abbreviations}
.You should probably also insert the instruction
\clearpage
(or\cleardoublepage
) immediately before\pagenumbering{arabic}
.