GeneralHyperref and titlepage clashing ?

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
User avatar
Cham
Posts: 937
Joined: Sat Apr 02, 2011 4:06 pm

Hyperref and titlepage clashing ?

Post by Cham »

I just spoted a problem with my document. There's a problem with my title page and the hyperref package, that I can reproduce with this simple code :

Code: Select all

\documentclass[12pt,oneside]{article}
\usepackage{hyperref}

\begin{document}

\begin{titlepage}
	\begin{center}
		Title
	\end{center}
\end{titlepage}

Blabla bla

\end{document}
What is happening here !?

The console gives me this warning :
TeX warning (ext4): destination with the same identifier (name{page.1}) has been already used, duplicate ignored
<to be read again>
\relax

Recommended reading 2024:

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

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

cgnieder
Site Moderator
Posts: 2000
Joined: Sat Apr 16, 2011 7:27 pm

Hyperref and titlepage clashing ?

Post by cgnieder »

This is because {titlepage} resets the page counter to 1. Sadly there doesn't seem to be a solution for the page counter unlike other counters… See part with setcounter — destination with the same identifier.
site moderator & package author
User avatar
Cham
Posts: 937
Joined: Sat Apr 02, 2011 4:06 pm

Hyperref and titlepage clashing ?

Post by Cham »

Well, my document is compiling fine, and the PDF output looks perfect. But there is no way in fixing this kind of errors ? Weird.
User avatar
cgnieder
Site Moderator
Posts: 2000
Joined: Sat Apr 16, 2011 7:27 pm

Hyperref and titlepage clashing ?

Post by cgnieder »

Cham wrote:Well, my document is compiling fine, and the PDF output looks perfect. But there is no way in fixing this kind of errors ? Weird.
  • its not an error just a warning and you can probably ignore it and just do nothing; if you decide to do so and still want to get rid of the warning then have a look at the silence package
  • there is a generic solution for these kinds of warnings but not for ones related to the page counter (like the answers in the linked question say)
  • you can disable the page anchors like the answers in the linked question say; then the warning will disappear
Regards
site moderator & package author
User avatar
Cham
Posts: 937
Joined: Sat Apr 02, 2011 4:06 pm

Hyperref and titlepage clashing ?

Post by Cham »

Ok, the hypperref option pageanchor=false appears to fix this. But what are the drawbacks of adding this option ?
User avatar
cgnieder
Site Moderator
Posts: 2000
Joined: Sat Apr 16, 2011 7:27 pm

Hyperref and titlepage clashing ?

Post by cgnieder »

hyperref manual wrote:Destinations names (also anchor, target or link names) are internal names that identify a position on a page in the document. They are used in link targets for inner document links or the bookmarks, for example.
hyperref manual wrote:\hyperpage is used by the index to get page links. Page anchor setting (pageanchor) must not be turned off.
hyperref manual wrote:pageanchor boolean true Determines whether every page is given an implicit anchor at the top left corner. If this is turned off, \printindex will not contain valid hyperlinks.
It appears if you don't have an index there are no drawbacks at all.
site moderator & package author
User avatar
Cham
Posts: 937
Joined: Sat Apr 02, 2011 4:06 pm

Hyperref and titlepage clashing ?

Post by Cham »

Ah ! It's clear. I have no index for this document, so it's fine.

Thanks !
Post Reply