Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I'm using the hyperref package to create a Table of Contents with internal links (bookmarks in Acrobat Reader). However, I don't like the fact that it jumps a little too low when the links are clicked. I'd rather like the links to display the relevant pages directly starting with the top of the page.

In other words, I want the same behaviour as with the \bookmark command I'm also using:

\usepackage{bookmark}
\bookmark[page=10]{Some Page}

MWE:

\documentclass[oneside,a4paper,11pt,headings=normal,parskip=half,version=first]{scrreprt}

\usepackage[pdftex,colorlinks=true]{hyperref}

\makeindex 

\begin{document}

\tableofcontents

% -------------------------------------------------------------------------
\chapter{Introduction1}\label{chap:Intro1}

\section{Abstract1}
Lorem ipsum dolor sit amet, consectetur adipisici elit, sed eiusmod tempor incidunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquid ex ea commodi consequat. Quis aute iure reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint obcaecat cupiditat non roident, sunt in culpa qui officia deserunt mollit anim id est laborum.
--

Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.

\section{Introduction1}
Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla  acilisi. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.

\subsection{Interviews of the outgoing team members1}

Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.

\chapter{Introduction2}\label{chap:Intro2}

\section{Abstract2}
Lorem ipsum dolor sit amet, consectetur adipisici elit, sed eiusmod tempor incidunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquid ex ea commodi consequat. Quis aute iure reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint obcaecat cupiditat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
--
Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait  ulla facilisi. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy  ibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.

\section{Introduction2}
Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.

\subsection{Interviews of the outgoing team members2}

Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.

\chapter{Introduction3}\label{chap:Intro3}

\section{Abstract3}
Lorem ipsum dolor sit amet, consectetur adipisici elit, sed eiusmod tempor incidunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquid ex ea commodi consequat. Quis aute iure reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint obcaecat cupiditat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
--
Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.

\section{Introduction3}
Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.

\subsection{Interviews of the outgoing team members3}

Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.

\end{document}

Here is a picture of the situation:

picture as description

share|improve this question
    
In this question, old package versions is blamed for this. Try to upgrade to the newest versions if you don't have them. –  tohecz Nov 6 '12 at 21:43
    
Negative! Updated to latest version but no difference. –  weiglt Nov 6 '12 at 22:42
    
The hyperlinks and bookmarks both appear fine (according to me) on my system. Perhaps include the output of \listfiles (and version of Adobe Reader, and zoom level, and screenshots of the problem...)? If you would like to change all the links to link to the top of pages instead of the relevant sections regardless, perhaps change the question title to reflect this. –  cyberSingularity Nov 6 '12 at 23:04
    
Okay, now I see that the behaviour you are getting is the expected behaviour, but not the desired behaviour. I believe there is nothing so simple as an option to the hyperref package to achieve what you want, but it should still be possible with some work. I'm not sure I'll be able to help as I do not know enough about hyperref internals, but someone else may be able to assist... –  cyberSingularity Nov 6 '12 at 23:25

1 Answer 1

up vote 5 down vote accepted

Yes, the anchor position can be improved by moving it downwards. But I do not see the point in moving the anchor upwards showing lots of white space.

For example, \@chapter can be redefined to move \refstepcounter to the position you want:

\documentclass[oneside,a4paper,11pt,headings=normal,parskip=half,version=first]{scrreprt}

\usepackage{etoolbox}
\makeatletter
\newcommand*{\chapter@refstepcounter}[1]{%
  \hbox{%
    \raisebox{\dimexpr\headsep+\headheight\relax}[0pt]{%
      \refstepcounter{#1}%
    }%
  }%
}
\patchcmd\@chapter{\refstepcounter}{%
  \chapter@refstepcounter
}{}{}
\makeatother

\usepackage[pdftex,colorlinks=true]{hyperref}

\makeindex

\begin{document}
...
\end{document}
share|improve this answer
    
Thanks, it seems that it can be done that way (still a bit too low in your example, but almost ok). However, if it's that complicated, i'll probably drop the idea. –  weiglt Nov 10 '12 at 20:00

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.