2

The link to the target inside a tabular is too low. This is not inside a float, so hypcap and \hypcapspace have no effect. Is this a known problem?

\documentclass{article}
\usepackage{hyperref}
\hypersetup{pdftoolbar=true,pdfpagemode=UseNone,pdfstartview={FitH},colorlinks=true}

\begin{document}

\hypertarget{test1}{normal anchor}

\hyperlink{test1}{link}

\begin{tabular}{c}
\hypertarget{test2}{tabular}
\end{tabular}

\hyperlink{test2}{link}
\end{document}
John Kormylo
  • 79,712
  • 3
  • 50
  • 120
  • 1
    It's not really related to the tabular you see the same on the first link if you do \mbox{}\hypertarget{test1}{normal anchor} the anchor is at the reference point, so on the baseline – David Carlisle Jun 22 '14 at 20:26

1 Answers1

4

The target is put on the base line.

  • \raisebox can be used to raise the target.

  • pdfTeX provides \vadjust pre{...} to put something before the current line.

Example:

\documentclass{article}
\usepackage{hyperref}
\hypersetup{%
  pdftoolbar=true,
  pdfpagemode=UseNone,
  pdfstartview={FitH \hypercalcbp{\paperheight}},
  colorlinks=true
}
\usepackage{calc}

\begin{document}

\begin{tabular}{c}
  \raisebox{\heightof{T}+1pt}[0pt][0pt]{\hypertarget{test1}{}}%
  tabular1
\end{tabular}

\hyperlink{test1}{link}

\begin{tabular}{c}
  \vadjust pre{\hypertarget{test2}{}}%
  tabular2
\end{tabular}

\hyperlink{test2}{link}
\end{document}

pdfstartview

The argument top is not known by the PDF reader. AR9/Linux even refuses to display the file, because of the invalid syntax.

  • Either the vertical number can be given, which is interpreted with the unit bp, the default unit in PostScript and PDF.
  • Or the value can be calculated via \hypercalcbp:

    pdfstartview=FitH \hypercalcbp{\paperheight}
    

    or

    pdfstartview=FitH \hypercalcbp{\paperheight-\topmargin-1in}
    

    to get on top of the header line or

    pdfstartview=FitH \hypercalcbp{\paperheight-\topmargin-1in-\headheight-\headsep}
    

    to get on top of the text body.

Heiko Oberdiek
  • 271,626
  • Or you can just put an invisible target one line higher in the tabular. As for top, I just copied from the manual and it seemed to work. – John Kormylo Jun 23 '14 at 00:22
  • Also, \baselineskip=0pt inside a tabular for some reason. Actually, that could explain it. – John Kormylo Jun 23 '14 at 00:37
  • On further reading, the "top" in the manual is a number (like you said). However, if you leave off the number it should default to the top of the page (which is what I want). The Firefox previewer does not, but then it can't handle multifile hypertext at all. – John Kormylo Jun 24 '14 at 12:59