Take the 2-minute tour ×

I have a table with many entries and I want to reference the key so another person can quickly look up what the key means.

Here is some pseudocode:

snippet1\label{?key1} & longexplanatory text
snippet2\label{?key2} & longexplanatory text
snippet3\label{?key3} & longexplanatory text

connect \ref{key1} with \ref{key13}

After compilation I want the text to read

connect snippet1 with snippet3

The reader should be able to quickly jump to the table when clicking on snippet-N.

share|improve this question

1 Answer 1

up vote 4 down vote accepted

The following uses \refstepcounter (instead of the internal \@currentlabel) of a dummy counter to make the text to something that can be referenced. \raisebox moves \refstepcounter a bit to move the anchor position, if package hyperref is used. At the place of \refstepcounter hyperref sets the anchor.



\keylabel{snippet1}{key1} & longexplanatory text\\
\keylabel{snippet2}{key2} & longexplanatory text\\
\keylabel{snippet3}{key3} & longexplanatory text\\

connect \ref{key1} with \ref{key3}


share|improve this answer

Your Answer


