[pdftex] Hyperref, pageanchor, and titlepage
Patrick Riley
pfr+pdftex at cs.cmu.edu
Tue Jul 16 12:46:19 CEST 2002
This is a minor problem I have encountered using hyperref with
pdftex. I have a workable solution, but it seems a little ugly to me,
and if there's a better way to do it, I'd love to hear about it.
I have a document for which I want to use page anchors so that the
table of contents is hyperlinked. The document also have a title page,
using the titlepage environment from the article class. If I have this
file:
\documentclass[notitlepage]{article}
\usepackage[debug,pageanchor=true]{hyperref}
\begin{document}
\begin{titlepage}
Title page
\end{titlepage}
Some text
\end{document}
I get this output:
Running `PDFLaTeX' on `test' with ``pdflatex '\nonstopmode\input{test.tex}'''
This is pdfTeX, Version 3.14159-1.00b-pretest-20020211 (Web2C 7.3.7x)
{/usr0/pfr/lib/texmf/pdftex/config/pdftex.cfg}
LaTeX2e <1999/12/01> patch level 1
Babel <v3.6Z> and hyphenation patterns for american, french, german, ngerman, n
ohyphenation, loaded.
(./test.tex (/usr/local/lib/texmf/tex/latex/base/article.cls
Document Class: article 1999/09/10 v1.4a Standard LaTeX document class
(/usr/local/lib/texmf/tex/latex/base/size10.clo))
(/usr0/pfr/tex/hyperref/hyperref.sty (/usr0/pfr/tex/graphics/keyval.sty)
(/usr0/pfr/tex/hyperref/pd1enc.def) (/usr0/pfr/tex/hyperref/hyperref.cfg)
Implicit mode ON; LaTeX internals redefined
(/usr0/pfr/tex/url.sty))
*hyperref using default driver hpdftex*
(/usr0/pfr/tex/hyperref/hpdftex.def
(/usr/local/lib/texmf/tex/latex/psnfss/pifont.sty
(/usr/local/lib/texmf/tex/latex/psnfss/upzd.fd)
(/usr/local/lib/texmf/tex/latex/psnfss/upsy.fd))) (./test.aux)
(/usr0/pfr/tex/hyperref/nameref.sty) (./test.out) (./test.out)
pdftex: define anchor at line 3: Doc-Start
pdftex: define anchor at line 6: page.1
[1{/usr0/pfr/lib/texmf/dvips/config/pdftex.map
Warning: pdflatex (file /usr0/pfr/lib/texmf/dvips/config/pdftex.map): invalid e
ntry for `hlcbot8rn': too big value of ExtendFont (850)
Warning: pdflatex (file /usr0/pfr/lib/texmf/dvips/config/pdftex.map): invalid e
ntry for `hlcbt8rn': too big value of ExtendFont (850)
Warning: pdflatex (file /usr0/pfr/lib/texmf/dvips/config/pdftex.map): invalid e
ntry for `hlcrot8rn': too big value of ExtendFont (850)
Warning: pdflatex (file /usr0/pfr/lib/texmf/dvips/config/pdftex.map): invalid e
ntry for `hlcrt8rn': too big value of ExtendFont (850)
Warning: pdflatex (file /usr0/pfr/lib/texmf/dvips/config/pdftex.map): invalid e
ntry for `hlsbot8rn': too big value of ExtendFont (850)
Warning: pdflatex (file /usr0/pfr/lib/texmf/dvips/config/pdftex.map): invalid e
ntry for `hlsbt8rn': too big value of ExtendFont (850)
Warning: pdflatex (file /usr0/pfr/lib/texmf/dvips/config/pdftex.map): invalid e
ntry for `hlsrot8rn': too big value of ExtendFont (850)
Warning: pdflatex (file /usr0/pfr/lib/texmf/dvips/config/pdftex.map): invalid e
ntry for `hlsrt8rn': too big value of ExtendFont (850)
}{/usr0/pfr/lib/texmf/dvips/config/jo5.map}{/usr0/pfr/lib/texmf/dvips/config/ma
1.map}{/usr0/pfr/lib/texmf/dvips/config/mic.map}{/usr0/pfr/lib/texmf/pdftex/con
fig/ttfonts.map}]
pdftex: define anchor at line 8: page.1
! pdfTeX warning (ext4): destination with the same identifier (name{page.1}) ha
s been already used, duplicate ignored
<to be read again>
\penalty
l.8 \end{document}
[1] (./test.aux) )</usr/local/lib/texmf/fonts/type1/bluesky/
cm/cmr10.pfb>
Output written on test.pdf (2 pages, 7552 bytes).
Transcript written on test.log.
PDFLaTeX finished at Tue Jul 16 11:38:31
What's going on is that the titlepage environment sets the page number
to 0 so the first real page comes out as 1. But it's too late at this
point because we already have the page.1 link. I tried all kinds of
combinations of setting the page counter before and after the
begin{document}, with \AtBeginDocument, etc and nothing
worked.
Finally, doing this makes it all work, but it's a little weird.
\documentclass[notitlepage]{article}
\usepackage[debug,pageanchor=false]{hyperref}
\begin{document}
\begin{titlepage}
Title page
\end{titlepage}
\hypersetup{pageanchor=true}
Some text
\end{document}
--
Pat Riley
Third Year Ph.D. Student
Computer Science Department, Carnegie Mellon University
http://www.cs.cmu.edu/~pfr
More information about the pdftex
mailing list