# Producing a PDF with clickable chart

Greetings.

John Cook provides a clickable chart of probability distributions with different interconnections. Every node is linked to definition and every arrow is linked to a brief description of interconnection.

I am interested in producing a PDF with analogous functionality. I. e., I'd like to have a chart with arrows interlinked with various (text) definitions and descriptions.

Is it possible with LaTeX/ConTeXt/whatever?

-

With Tikz package, it is possible to have nodes connected with definitions, but I cannot find way how to connect arrows with definitions.

\documentclass[a4paper]{article}
\usepackage[latin2]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{tgschola}
\usepackage{glossaries}
\glsenablehyper
\usepackage{tikz}
\usetikzlibrary{scopes,chains, positioning}
\tikzset{clickable/.style={draw, rectangle,rounded corners, inner sep = 2pt,fill= blue!20}}
\begin{document}
\makeglossaries
\newglossaryentry{geometric}{
name={geometric}
,description={$f(x) = p (1-p)^x$ for non-negative integers $x$.}
}
\newglossaryentry{discrete}{
name={Discrete uniform}
,description={$(x) = \frac{1}{n}$ for $x = 1, 2, ..., n$}
}
\newglossaryentry{negative}{
name={Negative binomial}
,description={$f(x) = C(r + x - 1, x) p^r(1-p)^x$ for non-negative integers $x$}
}
\begin{tikzpicture}
\clickable  (or) {\gls{geometric}} edge [loop right, ->] (or);
\clickable [below of=or] (bn) {\gls{discrete}} edge [dashed,<-] (or);
\clickable [right= 0.5cm of bn] (oo) {\gls{negative}} edge [<->] (bn);
\end{tikzpicture}
\printglossary
\end{document}


Glossary entries are defined with \newglossaryentry macro. For example:

\newglossaryentry{discrete}{
name={Discrete uniform}
,description={$(x) = \frac{1}{n}$ for $x = 1, 2, ..., n$}
}


discrete is the name you link to in your diagram, name is glossary heading.

To get the glossary list, you have to after you compile your document, run script makeglossaries nameofthedocumentwithoutextension.

You can refer to your glossary entries with macro \gls{}, for example, command \gls{discrete} will print Discrete uniform.

To learn about tikz, run command texdoc tikz in your shell. Just some notes about my code:

\begin{tikzpicture}
\clickable  (or) {\gls{geometric}} edge [loop right, ->] (or);
\clickable [below of=or] (bn) {\gls{discrete}} edge [dashed,<-] (or);
\clickable [right= 0.5cm of bn] (oo) {\gls{negative}} edge [<->] (bn);
\end{tikzpicture}


Our diagram is defined in tikzpicture environment. Macro \clickable is shortcut for \node [clickable]. In curly braces is text for label, because we are referring to the glossary entry, we call \gls macro. (or) is name of the node, it is used for referencing to the node from the other nodes. it is useful for placing the other nodes (below of=or) and for the arrows. edge is used for definition of the arrow. in [] brackets we set its style.

-
+1 for the use of \tikzaddtikzonlycommandshortcutdef! – cjorssen Jun 14 '12 at 11:05