Page Layouthyperref | Problem with Hyperlinks in PDF

Information and discussion about page layout specific issues (e.g. header and footer lines, page formats, page numbers).
Post Reply
Jojoba86
Posts: 6
Joined: Fri Dec 09, 2011 7:52 pm

hyperref | Problem with Hyperlinks in PDF

Post by Jojoba86 »

Hi,

I'm using PDFLaTeX and the hyperref package. My problem is that I've added something to the contents line manually, which shows up fine, but the hyperlink in the contents does not go to it, instead it just points to the contents page. The environment with the contents line looks like this:

Code: Select all

\newenvironment{role}
{\addcontentsline{toc}{chapter}{Role of the Author} \pagestyle{empty}
\begin{alwayssingle}
\begin{center}
\vspace*{1.5cm}
{\Large \bfseries Role of the Author}
\end{center}
\vspace{0.5cm}
\begin{quote}}
{\end{quote}\end{alwayssingle}}
I'm calling this, via \begin{role} blah blah \end{role} after the contents line.

Anyone know what I may be doing wrong, or if there is a way around this?
Last edited by Jojoba86 on Fri Dec 09, 2011 9:21 pm, edited 1 time in total.

Recommended reading 2024:

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

Learn LaTeX easily with newest books:

The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis

The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more

LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis

User avatar
Stefan Kottwitz
Site Admin
Posts: 10348
Joined: Mon Mar 10, 2008 9:44 pm

hyperref | Problem with Hyperlinks in PDF

Post by Stefan Kottwitz »

Hi,

try

Code: Select all

\phantomsection
before \addcontentsline.

Stefan
LaTeX.org admin
Jojoba86
Posts: 6
Joined: Fri Dec 09, 2011 7:52 pm

Re: hyperref | Problem with Hyperlinks in PDF

Post by Jojoba86 »

Thank you so much Stefan, that did the job perfectly!
Post Reply