[Tex/LaTex] reference to a label linked with a longtable row

cross-referencinghyperreflongtable

Is there a way to link to a specific row in a Longtabl environment. This is usefull when using the hyperref package and allows the viewer to simply jump from somewhere in the document to the right row of the table. At the moment one jumps always to the top of the column?

For instance:

\begin{longtable}
\label{r1}cell1a&cell1b&cell1c&cell1d&cell1e\\
\label{r2}cell2a&cell2b&cell2c&cell2d&cell2e\\
\label{r3}cell3a&cell3b&cell3c&cell3d&cell3e\\
\label{r4}cell4a&cell4b&cell4c&cell4d&cell4e\\
\end{longtable}

As one can see in \hyperref[r3]{row 3}...

Best Answer

Have a look at the macros \hypertarget and \hyperlink of the hyperref package.

One can create an internal link (almost) anywhere in the document -- including some row in a tabular environment -- with the instruction

\hypertarget{<name>}{<text>}

where <name> should be a unique "label" that will be used by hyperref to create the "target" and <text> should be whatever should be placed there. E.g., in a tabular environment, <text> could be the content of the first cell of a certain row. You can then link to that "label" elsewhere in the document with the command

\hyperlink{<name>}{<text>}

where <name> should be the label you chose in the \hypertarget command and <text> can be anything that passes TeX's syntax rules; e.g., it could be the string "there".

Related Question