Page LayoutHyperlinks in ToC for added Chapters

Information and discussion about page layout specific issues (e.g. header and footer lines, page formats, page numbers).
Post Reply
magical marshmallow
Posts: 30
Joined: Mon Jan 21, 2013 11:37 am

Hyperlinks in ToC for added Chapters

Post by magical marshmallow »

Hey there,

I'm writing a document and I would like to have a clickable link in the ToC to my abstract and acknowledgments pages. Currently I have a contents line will all these, but when you click it, it just goes to the top of the contents page. Has anyone done this or can anyone offer an idea?

My current code looks as follows:

Code: Select all

\usepackage[colorlinks]{hyperref}
\hypersetup{colorlinks,citecolor=blue, linkcolor=black}
\begin{document}
\chapter*{Acknowledgements}
\thispagestyle{fancy}
\chaptermark{Acknowledgements}
\pagenumbering{gobble}
\addcontentsline{toc}{chapter}{Acknowledgements}
I wish to acknowledge blah blah
As an aside, is there a way to make a reverse hyperlink from a references section back to the point at which it occurs in the document?

Cheers
Last edited by Stefan Kottwitz on Fri Mar 15, 2013 7:07 pm, edited 1 time in total.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

kaiserkarl13
Posts: 707
Joined: Tue Mar 25, 2008 5:02 pm

Hyperlinks in ToC for added Chapters

Post by kaiserkarl13 »

The backref and/or pagebackref options to hyperref will put back-references in the bibliography for you, to my understanding. The following seems to do what you wanted to do, at least as far as I can tell:

Code: Select all

\documentclass{report}
\usepackage{fancyhdr}
\usepackage[colorlinks,citecolor=blue,linkcolor=black,pagebackref]{hyperref}
\begin{document}
\tableofcontents
\chapter*{Acknowledgements}
\thispagestyle{fancy}
\chaptermark{Acknowledgements}
\addcontentsline{toc}{chapter}{Acknowledgements}
I wish to acknowledge blah blah~\cite{someone}.

Blah blah blah.

\bibliographystyle{plain}
\bibliography{mybibfile}
\end{document}
By the way, I highly suggest posting a working example in the future. It takes us that much longer to help you when we have to add the document class, end document, bibliograpy, etc. See the oft-used Infominimal working example link for more info.
Post Reply