2

I'm looking into replacing an existing documentation system with on based on LaTeX. In this system we have the possibility to link between sections (even if the sections are in different documents. A link from one document to another automatically set up a link going in the opposite direction. What I'd want is something like the following:

Document 1:
Inlinks~\magiclabel{d1-l1}

Document 2:
Outlinks~\magicref{d1-l1}

Document 3:
Outlinks~\magicref{d1-l1}

That should generate the following:
Document 1:
Inlinks [d2-ref1, d3-ref1]

Document 2:
Outlinks [d1-l1]

Document 3:
Outlinks [d1-l1]

Is such a thing even possible?

Edit: Ideally, I would like to have the links clickable. I.e. click d1-l1 in Document 2 to go to Document 1, and then click d2-ref to go back to Document 2.

3
  • 1
    Package hyperref and its \hyperlink, '\hypertarget, \href and \hyperref commands should do, what you request
    – user31729
    Sep 2 '16 at 11:31
  • I tried replacing my \magiclabel with \hypertargetand my \magicref with \hyperlink. This seems to work in one direction, but the list of incoming links do not appear at the \hypertarget.
    – Confused
    Sep 2 '16 at 13:29
  • 1
    Well, you can place one label at a position and refer to it at multiple positions, but each position can have only one backlink -- how should the link know which source it has. A strategy is \hypertarget{foo:dest}{\hyperlink{foobar:dest}{Link to the foobar file}} and at the foo file position \hypertarget{foobar:dest}{\hyperlink{foo:dest}{Go back to the foo file}} -- this provides mutual backlinks
    – user31729
    Sep 2 '16 at 16:41
1

The hyperref package allows that by setting the option pagebackref=true on the package options. Now you just have to use

\usepackage[pagebackref=true]{hyperref}

https://www.sixhat.net/latex-tip-back-references-in-bibliography.html

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.