diff options
author | Karl Berry <karl@freefriends.org> | 2019-11-17 22:36:06 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2019-11-17 22:36:06 +0000 |
commit | 305b95e6a4e7344e2a2e66b3a433c526944e3c20 (patch) | |
tree | 54bf66200bc6af49bbbf91993190a32c4fcf9050 /Master/texmf-dist/doc/latex/etoc/etocsnippet-29.tex | |
parent | 23ef0a47d81811188819422f09392e5220e96b59 (diff) |
etoc (17nov19)
git-svn-id: svn://tug.org/texlive/trunk@52842 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/doc/latex/etoc/etocsnippet-29.tex')
-rw-r--r-- | Master/texmf-dist/doc/latex/etoc/etocsnippet-29.tex | 120 |
1 files changed, 120 insertions, 0 deletions
diff --git a/Master/texmf-dist/doc/latex/etoc/etocsnippet-29.tex b/Master/texmf-dist/doc/latex/etoc/etocsnippet-29.tex new file mode 100644 index 00000000000..8116d97e27b --- /dev/null +++ b/Master/texmf-dist/doc/latex/etoc/etocsnippet-29.tex @@ -0,0 +1,120 @@ +%% LaTeX2e file `etocsnippet-29.tex' +%% generated by the `filecontentsdef' environment +%% from source `etoc' on 2019/11/17. +%% +\begingroup +% \newtoks\treetok % done in preamble +% \newtoks\parttok + +\newcommand*\partnode {} % just to check we don't overwrite something +\newcommand*\childnode {} + +\newcommand*\tmprotate {} % just to check we don't overwrite something +\newcommand*\tmpoption {} % just to check we don't overwrite something +\newcommand*\tmpstuff {} % just to check we don't overwrite something + +\newcommand*\appendtotok[2]{% #1=toks variable, #2=macro, expands once #2 + #1\expandafter\expandafter\expandafter{\expandafter\the\expandafter #1#2}} + +\newcommand*{\appendchildtree}[3]{% +% this is to construct "t1 child [#3]{t2}" from #1=t1 and #2=t2 +% t1 and t2 are two toks variable (not macros) +% #3 = for example teal!60 + \edef\tmpstuff {\the#1 child [#3]{\the#2}}% + #1\expandafter {\tmpstuff }% +} + +\newcounter{partco} + +% 1,2,3,4,5,... -> 1,2,3,1,2,3,1,2,3 +\def\pseudomodthree #1{\numexpr #1 + 3 - 3*((#1+1)/3)\relax} + +\etocsetstyle{part} + {\etocskipfirstprefix} +% This updates the global tree with the data from the previous +% part and all its children sections. Moved here because for some parts the +% sections are not displayed due to depth tags. + {\ifnum\value{partco}=3 + \appendchildtree\treetok\parttok {branch color= green!50,level distance=10cm}% + \else +\ifcase\pseudomodthree{\value{partco}}% + \or \appendchildtree\treetok\parttok {branch color= teal!60}% first + \or \appendchildtree\treetok\parttok {branch color= yellow!80}% second + \else\appendchildtree\treetok\parttok {branch color= green!50}% third and next ... + \fi\fi + } + {\stepcounter{partco}% +% customize manually some TikZ set-up (should be done inside the TikZ thing I guess) + \def\tmpoption {}% + \def\tmprotate {}% first + %\ifnum\value{partco}=5 \def\tmprotate {[counterclockwise from =-40]}\fi + %\ifnum\value{partco}=8 \def\tmprotate {[counterclockwise from =-50]}\fi +% define the part node + \edef\partnode{node \tmpoption + {\unexpanded\expandafter{\etocthelinkednumber}. + \unexpanded\expandafter{\etocthelinkedname}}\tmprotate }% +% this is a starting point which will be filled it by the section children + \parttok\expandafter{\partnode}} + {\ifcase\pseudomodthree{\value{partco}}% + \or \appendchildtree\treetok\parttok {branch color= teal!60}% first + \or \appendchildtree\treetok\parttok {branch color= yellow!80}% second + \else\appendchildtree\treetok\parttok {branch color= green!50}% third and next ... + \fi + } + +\etocsetstyle{section} + {} + {} + {% define the section node + \edef\childnode{child {node {\unexpanded\expandafter{\etocthelinkednumber} + \unexpanded\expandafter{\etocthelinkedname}}}}% + % append it to the current \parttok + \appendtotok\parttok\childnode + } + {} + +\etocsettocstyle + {\setcounter{partco}{0}% + \treetok{\node [root concept]{\textbf{The \etoc documentation}}}} + {\global\appendtotok\treetok{ ;}} +% The \global above is mandatory because etoc always typesets TOC inside a group + +\etocsetnexttocdepth{section} +% use of depth tags to cut out some sections. +\etocsettagdepth {preamble} {none} +\etocsettagdepth {overview} {part} +\etocsettagdepth {arbitrarily}{part} +\etocsettagdepth {examples} {section} +\etocsettagdepth {surprising} {part} +\etocsettagdepth {linestyles} {part} +\etocsettagdepth {globalcmds} {part} +\etocsettagdepth {custom} {section} +\etocsettagdepth {tips} {part} +\etocsettagdepth {etocandworld}{part} +\etocsettagdepth {code} {section} + +\tikzset{ + branch color/.style={ + concept color=#1!white, + every child/.append style={concept color=#1!white!30!white, font=\normalsize}, + } +}% + +\begin{figure}[thp!] +\tableofcontents\label{toc:mindmap}% +\centeredline{\resizebox{.85\paperwidth}{!}% +{\begin{tikzpicture}[mindmap, + grow cyclic, + text width=2cm, + align=flush center, + nodes={concept}, + concept color=orange!60, + root concept/.append style={text width=4cm, font=\Large}, + level 1/.append style={level distance=5cm,sibling angle=40, text width=3cm}, + level 2/.append style={level distance=7cm,sibling angle=30, text width=3cm}, + level 1 concept/.append style={font=\normalsize}, + ] +\the\treetok +\end{tikzpicture}}} +\end{figure} +\endgroup |