1

I'm looking at a behaviour very similar to how hyperref works but for cross-referencing (including non-floatable objects such as descriptions). The pseudo code below should illustrate the behaviour I'm looking for

\begin{description}
    \label{listofitems}
    \item[\textbf{Item 1}] This is item 1
    \item[\textbf{Item 2}] This is item 2
    \item[\textbf{Item 3}] This is item 3
\end{description}

... about the items that we have \ref{listofitems}{discussed previously}.
... however as we have seen in the \ref{listofitems}{list} there is ...

And the result should look like that:

  • Item 1 This is item 1
  • Item 2 This is item 2
  • Item 3 This is item 3

... about the items that we have discussed previously.

... however as we have seen in the list there is ...

Clicking on the links above takes us to the beginning of the same list of items that both these references are pointing to.

hyperref doesn't seem to be able to handle other than...well..hyperlinks so it's a no go. Any ideas? I would like to use a single package (if such package exists) or as a simple custom command as possible (still learning writing commands in Latex :P).

I tried to reference such objects by doing \ref{listofitems}. The problem with this is that I get the "amazing" x.y.z or whatever chapter, section, subsection etc. the label is part of. I looked at \nameref{} which - from what I understand - should display the name you have written inside the label (in the example above I would have "see listofitems" as a result). However even though no errors were returned upon building the document there was nothing that even remotely hinted towards the existence of the reference (no number, no other characters).

3

Are you looking for something like this?

\documentclass{article}

\usepackage{hyperref}
\begin{document}

\begin{description}
    \label{listofitems}
    \item[\textbf{Item 1}] This is item 1
    \item[\textbf{Item 2}] This is item 2
    \item[\textbf{Item 3}] This is item 3
\end{description}

\newpage

\hyperref[listofitems]{list}


\end{document}
1
  • 1
    facepalm I have used the [] and {} incorrectly and that's why it wasn't working. Thank you! – rbaleksandar Oct 26 '16 at 12:49

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.