5

I'm using the hyperref package to create links and targets between citations in the main text and references at the end of my document.

Clicking on one of these hyperlinks leads to displaying the hypertarget, although shifted by one line, i.e. I cannot see the first line of the hypertarget. Does anyone know this issue?

Header:

\documentclass[11pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[english]{babel}
\usepackage{color}
\usepackage{float}
\usepackage{amsmath}
\usepackage{graphicx}
\usepackage{subfig}
\usepackage{framed}
\usepackage[linktocpage]{hyperref} % interactive bookmarks
\usepackage{xcolor}
2
  • 1
    This is typical if you're using the low-level commands. There's a need to raise the link targets so you land with a visual of the target, rather than on the baseline. Regardless, in order to help you, we need a document that could replicate the problem. We need to copy-and-paste-and-compile and see exactly what you're seeing.
    – Werner
    Aug 3 '15 at 4:51
  • Thank you for the code edit Jesse, appreciate the help to new users
    – user222552
    Aug 3 '15 at 15:46
9

The target is set at the current baseline in horizontal mode. TeX does not provide the means to get the height of the current line.

  • pdfTeX provides the keyword pre for \vadjust to insert something before the current line:

    \vadjust pre{\hypertarget{...}{}}
    
  • \raisebox can be used to shift the target, e.g.:

    \raisebox{.7\baselineskip}[0pt][0pt]{\hypertarget{...}{}}
    
1
  • \vadjust pre{\hypertarget{...}{}} did the trick for me. Quick and easy, thank you!
    – user222552
    Aug 3 '15 at 15:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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