1

I am writing a latex document full of hyperlinks pointing to various areas of the document itself (I am using \nameref to reference theorems). I have a questions regarding these: is it possible to generate a visual 'link map' that updates automatically as the links increase?

What I am thinking about is what Zim software does when I ask him to generate a connection graph, except that Zim is not very practical for me for writing in latex.

It would be wonderful to 'see' all the implications between the theorems that I study and write down.

Thank you.

Nameless
  • 111
  • 1
    The main problem is that LaTeX doesn't SEE all the hyperlink anchors. These are sent directly to the PDF driver. One can however use newfloat or glossary and create a \listof{...}, but you would have to add stuff with each new link. – John Kormylo Jan 25 '20 at 16:07
  • Could you make a simple example, please? Thank you very much. – Nameless Jan 25 '20 at 17:57
  • OTOH, if you are using \label and \ref for all your links (instead of \hypertarget and \hyperlink) then all the information is contained in the aux file. Cleverref actually collects all the information, but doesn't have a \listof feature. – John Kormylo Jan 26 '20 at 20:30

1 Answers1

2

This generates a list of all hypertargets. Not sure if this is actually what you want.

\documentclass{article}
\usepackage{newfloat}% for listof
\usepackage{hyperref}

\DeclareFloatingEnvironment[fileext=lnk]{link}
\makeatletter
%\renewcommand*\l@link{\@dottedtocline{1}{1.5em}{2.3em}}
\newcommand*{\linkcap}[2]{% #1 = hypertarget, #2 = text to use in \listoflinks
  \stepcounter{link}%
  \def\@currentHref{#1}%
  \addcontentsline{lnk}{link}{\string\numberline{\thelink}{\ignorespaces #2}}%
}
\makeatother

\begin{document}

\listoflinks
\bigskip

\hypertarget{first}{First target here}.
\linkcap{first}{First Target}%

\hypertarget{second}{Second target here}.
\linkcap{second}{Second Target}%

\end{document}
John Kormylo
  • 79,712
  • 3
  • 50
  • 120