Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

hyperref links to wrong page in the table of contents

1,372 views
Skip to first unread message

louisJ

unread,
May 14, 2009, 9:14:32 AM5/14/09
to
Hi,

I am written a report in latex, but the hyperlinks in the table of
contents link to wrong pages.
I work on windows XP, with Texniccenter 1 beta 7.50, miktex 2.7.
My packages are up to date.
Here is my main file.
Thank you.


\documentclass[a4paper,12pt]{report}
\textwidth 15.5 cm
\oddsidemargin 0.4 cm
\topmargin 0 cm
\textheight 23 cm
\input{unidef.tex}
\usepackage{latexsym}
\usepackage{graphicx}
\usepackage{rotating}
\usepackage{picins}
\usepackage
[colorlinks=true,linkcolor=black,citecolor=black,pagebackref,breaklinks=true,plainpages=false]
{hyperref}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[english]{babel}
\usepackage{amssymb} %math symbols
\usepackage{amsmath} %contient
\usepackage{amsthm} %pour theoremes, contient \newtheoremstyle
\usepackage{pifont} %symbols
\usepackage
{color}
\usepackage{empheq}
\usepackage[hang]{subfigure}
\usepackage{harvard} %pour les 7 bibliography styles: agsm, apsr, dcu,
jmr, jphysicsB, kluwer, nederlands. Avec ces styles, il faut mettre
% \protect\cite dans les captions.
\usepackage{breakcites}
\usepackage{pict2e}
\setcounter{secnumdepth}{3}
\setcounter{tocdepth}{2}
\DeclareGraphicsExtensions{.jpg,.pdf,.png} % Formats d'images
\usepackage{varioref} % Style equation references to have
parentheses around them
\labelformat{equation}{(#1)} % Style equation references to have
parentheses around them
\labelformat{align}{(#1)} % Style equation references to have
parentheses around them
\labelformat{eqnarray}{(#1)} % Style equation references to have
parentheses around them
\renewcommand{\u}{\underline}
\renewcommand{\u}{\underline}
\def\rhoti{\tilde{\rho}}
\setlength{\parindent}{10pt}
\def\pathfigTitle {title/figures/}
\def\pathfigBiblio {revueBiblio/figures/}
\def\pathfigDepmodel {modelDedepart/figures/}
\def\pathfigExtmodel {modelFractionMassique/figures/}
\def\pathfigValid {modelFractionMassiqueValidation/figures/}
\def\pathfigValidUn {modelFractionMassiqueValidation/figures/
shocktubeP10beta0.01gamma2=5.5P002=4.2e8/}
\def\pathfigValidDeux {modelFractionMassiqueValidation/figures/
shocktubeP10betavariable/}
\def\pathfigValidTrois {modelFractionMassiqueValidation/figures/
comparaisonMarie/}
\def\pathfigApplication{application/figures/}
\newtheoremstyle{prop}% name
{9pt}% Space above, empty = `usual value'
{18pt}% Space below
{\itshape\bfseries}% Body font (e.g. \itshape)
{}% Indent amount (empty = no indent, \parindent = para
indent)
{\bfseries}% Thm head font
{:}% Punctuation after thm head (e.g. {:})
{\newline}% Space after thm head: \newline = linebreak
{}% Thm head spec
\theoremstyle{prop}
\newtheorem{prop}{Proposition}
\author{me}
\date{} %pour ne pas afficher la date ne rien mettre
\title{blabla}


\includeonly{
%./title/title,
%./abstract/abstract,
%./introFR/GenIntroFR,
%./concluFR/GenConclusionFR,
%./presentationThese2pagesFR/presentationThese2pagesFR,
./intro/GenIntro,
./revueBiblio/BiblioReview,
./modelDedepart/modelDepart,
./modelFractionMassique/modelFractionMassique,
./modelFractionMassiqueValidation/modelFractionMassiqueValidation,
./application/application,
./conclu/GenConclusion,
./annexes/annexes,
}


\begin{document}

%\pagenumbering{alph} % a, b, c, ...
\maketitle
\pagenumbering{roman} % i, ii, iii, iv, ...
\setcounter{page}{1}
\tableofcontents
%\listoffigures
\pagenumbering{arabic} % 1, 2, 3, 4, ...
\setcounter{page}{1}

%\addcontentsline{toc}{chapter}{Remerciements}

%\include{./abstract/abstract}

%\include{./introFR/GenIntroFR}

%\include{./concluFR/GenConclusionFR}

%\include{./presentationThese2pagesFR/presentationThese2pagesFR}

\include{./intro/GenIntro}

\include{./revueBiblio/BiblioReview}

\include{./modelDedepart/modelDepart}

\include{./modelFractionMassique/modelFractionMassique}

\include{./modelFractionMassiqueValidation/
modelFractionMassiqueValidation}

\include{./application/application}

\include{./conclu/GenConclusion}

\appendix %It just changes the chapter numbering to letters

\chapter{Appendices}

\include{./annexes/annexes}


\bibliographystyle{agsm}
\bibliography{../Biblio/biblioWork}

\end{document}

Ulrike Fischer

unread,
May 14, 2009, 9:53:24 AM5/14/09
to
Am Thu, 14 May 2009 06:14:32 -0700 (PDT) schrieb louisJ:

> Hi,
>
> I am written a report in latex, but the hyperlinks in the table of
> contents link to wrong pages.
> I work on windows XP, with Texniccenter 1 beta 7.50, miktex 2.7.
> My packages are up to date.
> Here is my main file.

http://www.tex.ac.uk/cgi-bin/texfaq2html?label=askquestion
http://www.tex.ac.uk/cgi-bin/texfaq2html?label=minxampl

--
Ulrike Fischer

louisJ

unread,
May 14, 2009, 1:34:08 PM5/14/09
to
>
> http://www.tex.ac.uk/cgi-bin/texfaq2html?label=askquestion
> http://www.tex.ac.uk/cgi-bin/texfaq2html?label=minxampl
>
> Ulrike Fischer

ok here is a minimum example (only my package, and my includes, can't
do less):

\documentclass[a4paper,12pt]{report}


\input{unidef.tex}
\usepackage{latexsym}
\usepackage{graphicx}
\usepackage{rotating}
\usepackage{picins}
\usepackage
[colorlinks=true,linkcolor=black,citecolor=black,pagebackref,breaklinks=true,plainpages=false]
{hyperref}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[english]{babel}
\usepackage{amssymb} %math symbols
\usepackage{amsmath} %contient
\usepackage{amsthm} %pour theoremes, contient \newtheoremstyle
\usepackage{pifont} %symbols
\usepackage{color}
\usepackage{empheq}
\usepackage[hang]{subfigure}
\usepackage{harvard}

\usepackage{breakcites}
\usepackage{pict2e}
\usepackage{varioref}

Dan Luecking

unread,
May 14, 2009, 6:56:36 PM5/14/09
to
On Thu, 14 May 2009 10:34:08 -0700 (PDT), louisJ <loui...@gmail.com>
wrote:

>>
>> http://www.tex.ac.uk/cgi-bin/texfaq2html?label=askquestion
>> http://www.tex.ac.uk/cgi-bin/texfaq2html?label=minxampl
>>
>> Ulrike Fischer
>
>ok here is a minimum example (only my package, and my includes, can't
>do less):

Wrong. Remove text and packages to the least required to
make the error show itself. Reread those links for advice on
how to do that. Also, don't use \include in your minimal
example. We don't have access to those files.


Dan
To reply by email, change LookInSig to luecking

louisJ

unread,
May 15, 2009, 3:59:06 AM5/15/09
to
The problem is in the links in the table of content.
But, as you can understand, I can't put here the whole content of my
document.
I removed the includes.


\documentclass[a4paper,12pt]{report}


\usepackage{latexsym}
\usepackage{graphicx}
\usepackage{rotating}
\usepackage{picins}
\usepackage
[colorlinks=true,linkcolor=black,citecolor=black,pagebackref,breaklinks=true,plainpages=false]
{hyperref}
\usepackage[T1]{fontenc}
\usepackage{lmodern}

\usepackage[english]{babel} %choix de la langue de l'environnement
(par exemple, langue d'écriture de "`références") francais english
basque


\usepackage{amssymb} %math symbols
\usepackage{amsmath} %contient
\usepackage{amsthm} %pour theoremes, contient \newtheoremstyle
\usepackage{pifont} %symbols
\usepackage
{color}

%\usepackage[cyr]{aeguill} %police vectorielle true type


\usepackage{empheq}
\usepackage[hang]{subfigure}
\usepackage{harvard}
\usepackage{breakcites}
\usepackage{pict2e}

\setcounter{secnumdepth}{3} %depth jusqu'ou les headings (section
subsection subsubsection) sont numérotés dans le texte
\setcounter{tocdepth}{2} %depth de la table of content

\begin{document}


%\pagenumbering{alph} % a, b, c, ...
\maketitle
\pagenumbering{roman} % i, ii, iii, iv, ...
\setcounter{page}{1}
\tableofcontents
%\listoffigures
\pagenumbering{arabic} % 1, 2, 3, 4, ...
\setcounter{page}{1}

blablabla

Ulrike Fischer

unread,
May 15, 2009, 4:09:43 AM5/15/09
to
Am Fri, 15 May 2009 00:59:06 -0700 (PDT) schrieb louisJ:

> The problem is in the links in the table of content.
> But, as you can understand, I can't put here the whole content of my
> document.

Nobody wants your whole document. We want a small (minimal)
document, which loads as few packages as possible and contains as
few code as possible.

> I removed the includes.

And now start to shorten your preamble.


>
> \documentclass[a4paper,12pt]{report}
> \usepackage{latexsym}
> \usepackage{graphicx}
> \usepackage{rotating}
> \usepackage{picins}

Are this four package needed to reproduce the error? If not remove
them.

> \usepackage
> [colorlinks=true,linkcolor=black,citecolor=black,pagebackref,breaklinks=true,plainpages=false]
> {hyperref}

This one is needed.

> \usepackage[T1]{fontenc}
> \usepackage{lmodern}
> \usepackage[english]{babel} %choix de la langue de l'environnement

> (par exemple, langue d'�criture de "`r�f�rences") francais english


> basque
> \usepackage{amssymb} %math symbols
> \usepackage{amsmath} %contient
> \usepackage{amsthm} %pour theoremes, contient \newtheoremstyle
> \usepackage{pifont} %symbols
> \usepackage
> {color}
> %\usepackage[cyr]{aeguill} %police vectorielle true type
> \usepackage{empheq}
> \usepackage[hang]{subfigure}
> \usepackage{harvard}
> \usepackage{breakcites}
> \usepackage{pict2e}

Which of this packages are needed to reproduce the error?

> \setcounter{secnumdepth}{3} %depth jusqu'ou les headings (section

> subsection subsubsection) sont num�rot�s dans le texte

Are all this definitions needed?

etc.

--
Ulrike Fischer

louisJ

unread,
May 15, 2009, 6:33:40 AM5/15/09
to
If I knew the combination of packages that generates the problem, I
wouldn't be posting on this group.
Moreover if I remove some of the packages in my preambule, my document
doesn't compile any more.
However, minimalizing my document (here below), I see that when
removing the "varioref" package and the following few \labelformat,
the hyperlinks in my table of contents link to the right place.
So the problems comes from varioref.
Do you know if there is a way to do the same thing without varioref?

thanks

\documentclass[a4paper,12pt]{report}
\input{unidef.tex}

\usepackage{graphicx}
\usepackage
[colorlinks=true,linkcolor=black,citecolor=black,pagebackref,breaklinks=true,plainpages=false]
{hyperref}


\usepackage[english]{babel} %choix de la langue de l'environnement

(par exemple, langue d'écriture de "`références") francais english
basque


\usepackage{empheq}
\usepackage[hang]{subfigure}
\usepackage{harvard}

\setcounter{secnumdepth}{3} %depth jusqu'ou les headings (section

subsection subsubsection) sont numérotés dans le texte


\setcounter{tocdepth}{2} %depth de la table of content
\DeclareGraphicsExtensions{.jpg,.pdf,.png} % Formats d'images
\usepackage{varioref} % Style equation references to have
parentheses around them
\labelformat{equation}{(#1)} % Style equation references to have
parentheses around them
\labelformat{align}{(#1)} % Style equation references to have
parentheses around them
\labelformat{eqnarray}{(#1)} % Style equation references to have
parentheses around them


\begin{document}

\pagenumbering{roman} % i, ii, iii, iv, ...
\setcounter{page}{1}
\tableofcontents
%\listoffigures
\pagenumbering{arabic} % 1, 2, 3, 4, ...
\setcounter{page}{1}

\bibliographystyle{agsm}
\bibliography{../Biblio/biblioWork}

\end{document}

Message has been deleted

louisJ

unread,
May 15, 2009, 6:53:41 AM5/15/09
to
SOLVED.
The linking works well when putting "varioref" before "hyperref" in
the preambule.

\usepackage{varioref}
\labelformat{equation}{(#1)}
\labelformat{align}{(#1)}
\labelformat{eqnarray}{(#1)}
\usepackage
[colorlinks=true,linkcolor=black,citecolor=black,pagebackref,breaklinks=true,plainpages=false]
{hyperref}

0 new messages