Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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?

share|improve this question
add comment

1 Answer 1

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

So this is only partial answer to your question:

\documentclass[a4paper]{article}
\usepackage[latin2]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{tgschola}
\usepackage{glossaries}
\usepackage[hidelinks]{hyperref}
\glsenablehyper
\usepackage{tikz}
\usetikzlibrary{scopes,chains, positioning}
\tikzset{clickable/.style={draw, rectangle,rounded corners, inner sep = 2pt,fill= blue!20}}
\tikzaddtikzonlycommandshortcutdef{\clickable}{\node[clickable]}
\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}

diagram with links to glossary 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.

share|improve this answer
    
+1 for the use of \tikzaddtikzonlycommandshortcutdef! –  cjorssen Jun 14 '12 at 11:05
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.