我决定使用思维导图来展示我的演示文稿的目录和章节大纲。
我希望节点可以像标准目录一样点击,但我找不到任何命令,例如\insertsection{number_of_section}
:\insertsection
插入链接文本,但仅适用于当前的部分。
\label
/\ref
不是一个可行的方法,因为:
- 这将进入主题代码中,用于(半)自动生成
beamer
已经生成了锚点,那么为什么不使用它呢?
beamer
锚点被命名为Navigation\c@page
,因此我手动将它们放入 MWE 中,以大致显示我想要实现的目标。但是,我希望实现某种自动化(通过读取\jobname.toc
?),因为页面可以更改。
此外,是否可以使整个圆圈可点击,而不仅仅是文本?
梅威瑟:
\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{[email protected]}}
\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}
答案1
新版本包括以下小节:
\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}
先前版本
以下代码会自动为所有部分生成目录图。目前不支持子部分。
\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]
\tikzset{level 1 concept/.append style={font=\sffamily, 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}