summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/latex/etoc/etocsnippet-28.tex
blob: 6b4ee58302d607d587fcfed05e4774a7c74d58fe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
%% LaTeX2e file `etocsnippet-28.tex'
%% generated by the `filecontentshere' environment
%% from source `etoc' on 2019/11/17.
%%
% \newtoks\treetok % put this (uncommented) preferably in the preamble
% \newtoks\sectiontok
% \newtoks\subsectiontok
\newcommand*{\treenode}{}

\newcommand*{\appendchildtree}[2]{% token list t1 becomes: t1 child {t2}
   \edef\tmp{\the#1 child {\the#2}}%
   #1\expandafter{\tmp}%
}
\newcommand*{\preparetreenode}{%
  \tmptok\expandafter{\etocthelinkednumber}% expanded one time (mandatory)
  \edef\treenode{node {\the\tmptok}}%
}

\etocsetstyle{section}
  {\etocskipfirstprefix}
  {\appendchildtree\treetok\sectiontok}
  {\preparetreenode \sectiontok\expandafter{\treenode}}
  {\appendchildtree\treetok\sectiontok}

\etocsetstyle{subsection}
  {\etocskipfirstprefix}
  {\appendchildtree\sectiontok\subsectiontok}
  {\preparetreenode \subsectiontok\expandafter{\treenode}}
  {\appendchildtree\sectiontok\subsectiontok}

\etocsettocstyle
  {\treetok{\node {\hyperref[part:overview]{Overview}}}}
  {\global\appendtotok\treetok{ ;}}

\begin{figure}[thbp!]\centering
   \etocsetnexttocdepth{subsection}
   \tableofcontents \label{toc:molecule} \ref{toc:overview}
   \hypersetup{hidelinks}%
   \begin{tikzpicture}
              [grow cyclic,
               level 1/.style={level distance=4cm,sibling angle=72},
               level 2/.style={level distance=2cm,sibling angle=60},
               every node/.style={ball color=red,circle,text=SkyBlue},
               edge from parent path={[dashed,very thick,color=cyan]
                           (\tikzparentnode) --(\tikzchildnode)}]
     \the\treetok
   \end{tikzpicture}
\end{figure}