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.

(a) Is is possible to have certain hyperref-hyperlinks (such as those to sections and also (when using memoir) to the table of contents, lists of figures and tables, and bibliography) point to the very left border of the page, not to the interior? Note that I have already tried the hypcap package, which positions figure and table links to the left edge of the text (just where the left margin ends) but not to the left page border. (For reading text, it is good if the text starts not exactly at the edge of one's viewing window but a tad into the window's border.) Also, hypcap doesn't deal with the table of contents, the lists of figures/tables, and the bibliography.

(b) If, in addition, one could make hyperlinks point not only to the left page border but also to the top left corner of the respective page, that would be a useful option. Is that possible?

If people would like starter code for this, here is some I've slightly adapted for another, related question:

\documentclass{memoir}
  % using the memoir class here is necessary
  % for all the desired hyperlinks to be created
\usepackage{hyperref}
\usepackage[all]{hypcap} % hypcap doesn't help here

\begin{document}

\tableofcontents

\section{A section}
This is the only section.

\listoftables
\listoffigures

\begin{thebibliography}{9}
\end{thebibliography}

\end{document}

Note: I am aware of the hypcap package but not sure whether/how it can be used to address this.

share|improve this question
    
The behavior you seek in question (b) is available automatically whenever you're viewing the page in full-page view. –  Mico Jun 11 '12 at 0:54
    
Yes. Except giving users a finer-grained choice would be nice. –  Lover of Structure Jun 12 '12 at 1:02
add comment

2 Answers 2

up vote 16 down vote accepted
+50

user14996 wrote:

(a) Is is possible to have certain hyperref-hyperlinks [...] point to the very left border of the page, not to the interior?

and

(b) If, in addition, one could make hyperlinks point not only to the left page border but also to the top left corner of the respective page, that would be a useful option. [...]

First I agree with the remark of canaaerus:

Just imagine the user has chosen a high zoom level and you force a jump to the top-left of the page. That point might be very far from the referenced position and the user wont be able to see it.

An alternative answer to the questions: The PDF format also supports other "view" settings for destinations. The default in hyperref is XYZ, X and Y means the anchor position and Z the zoom level (with default null meaning unchanged zoom level). If you want to get the left page border and do not mind also getting the right page border, then you can use

\hyperref{pdfview=FitH}% or FitBH that removes some white space

(Drivers hpdftex and other calculate the Y position from the current position of the anchor.)

You get the whole page with

\hyperref{pdfview=Fit}

But be aware that the user might be annoyed by having to switch the zoom level, if he cannot read the text because of a small window/screen.

share|improve this answer
13  
Ah welcome to TeX.SE your highness! :) –  percusse Jul 26 '12 at 21:00
    
@canaaerus Thanks for your contribution; Heiko: what an honor to be one of the first to get an answer from you here ;-) –  Lover of Structure Jul 26 '12 at 23:39
    
@canaaerus I appreciate your opinion on this. Just now I was reminded why I have a differing intuitive preference: (1) When I click on a document-internal link, the text is often immediately adjacent to the left margin in my viewer. Every time I need to move the document a bit to the right to make reading more comfortable. As you said, maybe it's the viewer's problem, but it's still a problem. (2) When I click on a link for a chapter, my viewer jumps to a place just above the chapter heading. For me however the chapter starts at the top of the page. (Yes, one can defend either choice.) –  Lover of Structure Jan 13 '13 at 12:59
    
@HeikoOberdiek Just in case this might give rise to an feature addition to hyperref, here is pointer to my immediately preceding comment :-) If you've already seen this and deem it not necessary, no problem. (Feel free to mark this comment of mine as obsolete once you've seen it.) –  Lover of Structure Feb 19 '13 at 10:05
add comment

In my, admittedly simplistic, world view, something like you request should not be necessary. The document should point its links to the actual target position and the viewer application can then make a sensible choice of where to jump. That choice will also depend on the current view mode and zoom level.
Just imagine the user has chosen a high zoom level and you force a jump to the top-left of the page. That point might be very far from the referenced position and the user wont be able to see it.

Now the idea to do it anyway, is to put the label mark at the top left. I got until this point:

\documentclass{memoir}

\usepackage[colorlinks]{hyperref}

\usepackage{lipsum}

\usepackage[absolute]{textpos}
\setlength\TPHorizModule{1cm}
\setlength\TPVertModule{1cm}
\textblockorigin{0mm}{0mm}

\newcounter{lbl}
\def\plabel#1{\begin{textblock}{0}(0,0)\refstepcounter{lbl}\label{#1}\end{textblock}}

\begin{document}
\chapter{The first chapter}
\lipsum[1-3]
\section{A section}
Here a label is set!\plabel{lbl1}

\chapter{The second chapter}
Here is a link up.{\Huge(\ref{lbl1})}
\end{document}

First problem is, that the textblock is always at the top left corner of the first page. So there you need to use some other method of absolute positioning. (I bet there are a dozen ways to do that)

Second thing that still needs fixing, is that now the label references the lbl counter. (I think this is similar to the hypcap packages approach.) So you need to fix the reference.

\def\thelbl{\thesection}

would for example help. But maybe you don't only want to reference sections.

share|improve this answer
add comment

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.