11

I decided to use a mindmap to show the ToC of my presentation and the section outline.

I'd like to have the nodes clickable like the standard ToC, but I couldn't find any command like \insertsection{number_of_section}: \insertsection insert a linked text but only for the current section.

\label/\ref is not a feasible way since:

  1. this will go in the code of a theme for (semi)automatic generation
  2. beamer is already generating the anchors, so why don't use it?

beamer anchors are named Navigation\c@page, and so I put them manually in the MWE to show roughly what I want to achieve. However, I'd like a sort of automation (by reading \jobname.toc?) since the pages can change.

In addition, is it possible to make the entire circle clickable, and not only the text?

MWE:

\documentclass{beamer}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}\normalfont
\usepackage[T1]{fontenc}
\usepackage{tikz}
\usetikzlibrary{calc,mindmap,trees}
\usepackage{totcount}

\title{There Is No Largest Prime Number\\\small aaa}%
\date[ISPN ?80]{27th International Symposium of Prime Numbers}
\author[Euclid]{Euclid of Alexandria \texttt{euclid@alexandria.edu}}

\tikzset{every mindmap/.style={
                    every node/.style={concept},
                    grow cyclic,
                    concept color=blue!50!green!50!white,
                    text=white,
                    root concept/.style={concept,
                                         fill=white,
                                         line width=1ex,
                                         text=black,
                                         text width=6em,
                                         font=\sffamily\bfseries},
                    level 1 concept/.append style={sibling angle=130/\the\tikznumberofchildren,
                                                   level distance=8cm,
                                                   text width=4em,
                                                   font=\scriptsize\sffamily\bfseries},
                    level 2 concept/.append style={sibling angle=60,
                                                   level distance=5cm,
                                                   font=\scriptsize\sffamily\bfseries},
                    level 3 concept/.append style={sibling angle=50,
%                                                   level distance=2cm,
                                                   font=\scriptsize\sffamily\bfseries}}}


\begin{document}

\begin{frame}{Table of contents}
\centering
\begin{tikzpicture}[small mindmap, scale=0.4, remember picture, overlay]
  \path
    node[root concept] at ($(current page.center) - (3,3)$) {\hyperlink{Navigation1}{There Is No Largest Prime Number}}
    [clockwise from=80]
    child[concept color=blue!70!white] {
      node {\hyperlink{Navigation2}{aaaaa}}
    }
    child[concept color=blue!70!white] {
      node {\hyperlink{Navigation3}{bbbbb}}
      [clockwise from=50]
      child[concept color=orange] {
        node {\hyperlink{Navigation4}{ccccc}}
      }
      child[concept color=orange] {
        node {\hyperlink{Navigation5}{ddddd}}
      }  
    }
    child[concept color=blue!70!white] {
      node {\hyperlink{Navigation6}{eeeee}}
    } ;
\end{tikzpicture}
\end{frame}

\section{aaaaa}
\begin{frame} 
\frametitle{There Is No Largest Prime Number} 
\framesubtitle{The proof uses \textit{reductio ad absurdum}.} 
\begin{theorem}
There is no largest prime number.\end{theorem} 
\begin{enumerate} 
\item Suppose $p$ were the largest prime number. 
\item Let $q$ be the product of the first $p$ numbers. 
\item Then $q+1$ is not divisible by any of them. 
\item But $q + 1$ is greater than $1$, thus divisible by some prime
number not in the first $p$ numbers.
\end{enumerate}
\end{frame}

\section{bbbbb}
\begin{frame}{A longer title}
\begin{itemize}
\item one
\item two
\end{itemize}
\end{frame}

\subsection{ccccc}
\begin{frame}{Void}
\end{frame}

\subsection{ddddd}
\begin{frame}{Void}
\end{frame}

\section{eeee}
\begin{frame}{Void}
\end{frame}

\end{document}
  • How about standard \label and \ref technique? – user11232 Dec 5 '14 at 11:34
  • @HarishKumar In the future I will edit my custom theme to support automatic generation of this type of ToC, so I want this to be transparent for the user. Furthermore, beamer is already generating the links for own usage, so why not use things which already exists? – Astrinus Dec 5 '14 at 11:42
  • @HarishKumar Ok, I'll update by 8 hours. – Astrinus Dec 5 '14 at 12:02
  • @HarishKumar Updated. – Astrinus Dec 5 '14 at 17:22
6

New Version including subsections:

\documentclass{beamer}

\usepackage{tikz}
\usetikzlibrary{mindmap,trees,shadows}

% total number of sections %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{totcount}
\newcounter{totalsection}
\regtotcounter{totalsection}

\AtBeginDocument{%
  \pretocmd{\section}{\refstepcounter{totalsection}}{}{}%
}%

% number of subsections per section %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{xcntperchap}
\RegisterCounters{section}{subsection}
\newcounter{totalsubsection}
\setcounter{totalsubsection}{0}

% creating automatic label %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% based on https://tex.stackexchange.com/a/386557/36296
\AtBeginSection[]{\label{sec:\thesection}}
\AtBeginSubsection[]{\label{subsec:\thesection:\thesubsection}}
\newcounter{currentsub}
\newcounter{totsection}

\newcommand{\mindtoc}{%
    \centering
    \setcounter{totsection}{\number\totvalue{totalsection}}
  \begin{tikzpicture}[
    grow cyclic,
    concept color=blue!50!black, 
    text=white,
    every node/.style={concept, scale=0.8},
    level 1/.style={%
        sibling angle=360/\thetotsection,
        level distance = 25mm,
        concept color=lime,
        text=black,
    },
    level 2/.style={%
        level distance = 25mm,
        concept color=yellow,
        text=black,
    },      
    ]
        \node {\inserttitle}    [clockwise from=135] child 
        foreach \i in {1,...,\thetotsection}{%
            node{\hyperlink{sec:\i}{\nameref{sec:\i}}
                \setcounter{currentsub}{\ObtainTrackedValueExp[\i]{section}{subsection}}
            }%
            \ifnum\thecurrentsub>0%
                child foreach \j in {1,...,\thecurrentsub}{%
                    node {\hyperlink{subsec:\i:\j}{\nameref{subsec:\i:\j}}} 
                }
            \fi%
        }; 
  \end{tikzpicture}
}

\title{Some Title}

\begin{document}

\begin{frame}
    \frametitle{"Table" of Contents}
    \mindtoc    
\end{frame}

\section{Section One}
\frame{abc}

\section{Section Two}
\frame{abc}

\subsection{subsection a}
\frame{abc}

\subsection{subsection b}
\frame{abc}

\subsection{subsection c}
\frame{abc}

\section{Section Three}
\frame{abc} 

\section{Section Three}
\frame{abc}         

\end{document}

enter image description here

Previous version

The following code automatically generates a toc-map for all sections. Subsections are currently not supported.

enter image description here

\documentclass{beamer}

\usepackage{tikz}
\usetikzlibrary{mindmap,trees,shadows}

\usepackage{etoolbox}
\usepackage{totcount}

\newcounter{totalsection}
\regtotcounter{totalsection}

\setbeamertemplate{section in toc}{\vskip-2.5cm\inserttocsection}

\AtBeginDocument{%
    \pretocmd{\section}{\refstepcounter{totalsection}}{\typeout{Yes, prepending was successful}}{\typeout{No, prepending was not it was successful}}%
}%

\title{Some Title}

\newcommand{\mindtoc}{
    \centering
    \begin{tikzpicture}[mindmap, concept color=blue!50!black, font=\sf, text=white]
        \tikzstyle{level 1 concept}+=[font=\sf, sibling angle=360/\number\totvalue{totalsection},level distance = 33mm]
        \node[concept,scale=0.8] {\inserttitle}
            [clockwise from=135]
            child [concept color=lime] foreach \i in {1,...,\number\totvalue{totalsection}}{
        node[concept,scale=0.8]{\tableofcontents[sections={\i},hidesubsections]}  
            };
    \end{tikzpicture}
}

\begin{document}

\begin{frame}
    \frametitle{"Table" of Contents}
    \mindtoc    
\end{frame}

\section{Section One~}
\frame{abc}

\section{Section Two}
\frame{abc}

\section{Section Three}
\frame{abc} 

\section{Section Three}
\frame{abc}         

\end{document}
  • But I need to know the total number of sections. If this code has to be put in a theme, I do not have previous knowledge of the number of sections. – Astrinus Apr 13 '16 at 7:17
  • @Astrinus see the edit, the code calculates the total number of sections – user36296 Apr 13 '16 at 9:33
  • Nice! For what purpose do you include the forloop package? – Daniel Apr 13 '16 at 10:27
  • @Daniel Probably for nothing :) I just copied it from another answer where I stole the section-counting stuff. – user36296 Apr 13 '16 at 10:36
  • The current subsection can be extracted as \tableofcontents[currentsubsection,hideothersubsections,sectionstyle=hide/hide,subsectionstyle=show/hide] – cacamailg Nov 8 '16 at 19:46

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.