summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/beamer/base/beamerbasetoc.sty
blob: 6b003e80e3808a71f02cdc90c7be20d6bb1706bb (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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
% Copyright 2003--2007 by Till Tantau
% Copyright 2010 by Vedran Mileti\'c
% Copyright 2012,2013,2015 by Vedran Mileti\'c, Joseph Wright
% Copyright 2017,2018 by Louis Stuart, Joseph Wright
%
% This file may be distributed and/or modified
%
% 1. under the LaTeX Project Public License and/or
% 2. under the GNU Public License.
%
% See the file doc/licenses/LICENSE for more details.

\mode
<presentation>

%
% Local counters/ifs/dimensions
%
\newif\ifbeamer@pausesections
\newif\ifbeamer@pausesubsections

%
%
% Table of Contents Format
%
%

\def\beamer@toc@sectionstyle#1{\beamer@toc@process\beamer@toc@cs\beamer@toc@os#1//}
\def\beamer@toc@subsectionstyle#1{\beamer@toc@sprocess\beamer@toc@css\beamer@toc@oss\beamer@toc@ooss#1///}
\def\beamer@toc@subsubsectionstyle#1{\beamer@toc@ssprocess\beamer@toc@csss\beamer@toc@osss\beamer@toc@oosss\beamer@toc@ooosss#1////}

\define@key{beamertoc}{sectionstyle}{\beamer@toc@sectionstyle{#1}}
\define@key{beamertoc}{subsectionstyle}{\beamer@toc@subsectionstyle{#1}}
\define@key{beamertoc}{subsubsectionstyle}{\beamer@toc@subsubsectionstyle{#1}}
\def\beamer@toc@process#1#2#3/#4/{%
  \ifblank{#4}{\def#1{#3}\def#2{#3}}{\def#1{#3}\def#2{#4}\@gobble}}
  
\def\beamer@toc@sprocess#1#2#3#4/#5/#6/{%
  \ifblank{#5}%
  {\def#1{#4}\def#2{#4}\def#3{#4}}
  {\ifblank{#6}
    {\def#1{#4}\def#2{#5}\def#3{#5}\@gobble}
    {\def#1{#4}\def#2{#5}\def#3{#6}\@gobbletwo}}}

\def\beamer@toc@ssprocess#1#2#3#4#5/#6/#7/#8/{%
  \ifblank{#6}%
  {\def#1{#5}\def#2{#5}\def#3{#5}\def#4{#5}}
  {\ifblank{#7}
    {\def#1{#5}\def#2{#6}\def#3{#6}\def#4{#6}\@gobble}
    {\ifblank{#8}
      {\def#1{#5}\def#2{#6}\def#3{#7}\def#4{#7}\@gobbletwo}
      {\def#1{#5}\def#2{#6}\def#3{#7}\def#4{#8}\expandafter\@gobble\@gobbletwo}}}% no gobblethree?
}

\define@key{beamertoc}{pausesections}[true]{\beamer@pausesectionstrue}
\define@key{beamertoc}{pausesubsections}[true]{\beamer@pausesubsectionstrue}

\define@key{beamertoc}{currentsection}[]{\beamer@toc@sectionstyle{show/shaded}\beamer@toc@subsectionstyle{show/show/shaded}\beamer@toc@subsubsectionstyle{show/show/shaded}}
\define@key{beamertoc}{currentsubsection}[]{\beamer@toc@subsectionstyle{show/shaded}\beamer@toc@subsubsectionstyle{show/shaded}}
\define@key{beamertoc}{hideallsubsections}[]{\beamer@toc@subsectionstyle{hide}\beamer@toc@subsubsectionstyle{hide}}
\define@key{beamertoc}{hideothersubsections}[]{\beamer@toc@subsectionstyle{show/show/hide}\beamer@toc@subsubsectionstyle{show/shaded/hide}}

\define@key{beamertoc}{part}{\beamer@showpartnumber=#1\relax}
\define@key{beamertoc}{sections}{\beamer@parsetocsections#1[]}
\define@key{beamertoc}{firstsection}{\beamer@sectionadjust=-#1\relax\advance\beamer@sectionadjust by 1\relax}
\define@key{beamertoc}{lastsection}{\beamer@toclastsection=#1}
\def\beamer@parsetocsections{\@ifnextchar<\beamer@@parsetocsections\beamer@@@parsetocsections}
\def\beamer@@parsetocsections#1[]{\def\beamer@tocsections{#1}}
\def\beamer@@@parsetocsections#1[]{\def\beamer@tocsections{<all:#1>}}

\def\tableofcontents{\@ifnextchar[{\beamer@tableofcontents}{\beamer@tableofcontents[]}}
\def\beamer@tableofcontents[#1]{%
  \def\beamer@toc@cs{show}%
  \def\beamer@toc@os{show}%
  \def\beamer@toc@css{show}%
  \def\beamer@toc@oss{show}%
  \def\beamer@toc@ooss{show}%
  \def\beamer@toc@csss{show}%
  \def\beamer@toc@osss{show}%
  \def\beamer@toc@oosss{show}%
  \def\beamer@toc@ooosss{show}%
  \beamer@showpartnumber=\c@part%
  \beamer@pausesectionsfalse%
  \beamer@pausesubsectionsfalse%
  \def\beamer@tocsections{<*>}%
  \setkeys{beamertoc}{firstsection=1}%
  \setkeys{beamertoc}{#1}%
  \vspace*{-.5em}{\makeatletter%
    \pause[0]%
    \@input{\jobname.toc}%
    \vfill}%
  }

\def\beamer@tocaction@show#1{\usebeamertemplate**{#1}}
\def\beamer@tocaction@shaded#1{\usebeamertemplate**{#1 shaded}}
\def\beamer@tocaction@hide#1{}

\def\beamer@tocact#1#2{\csname beamer@tocaction@#1\endcsname{#2}}

\def\beamer@tocifnothide#1{\csname beamer@tocinvcheck@#1\endcsname}
\let\beamer@tocinvcheck@hide\@gobble
\let\beamer@tocinvcheck@show\@firstofone
\let\beamer@tocinvcheck@shaded\@firstofone

\def\beamer@hidetext{hide}

% initialize count with something large 
\beamer@toclastsection=\maxdimen
\multiply\beamer@toclastsection by 2

\def\sectionintoc{}
\def\beamer@sectionintoc#1#2#3#4#5{%
  \ifnum\c@tocdepth>0%
  \ifnum#4=\beamer@showpartnumber%
  {
  \beamer@saveanother%
  \gdef\beamer@todo{}%
  \beamer@slideinframe=#1\relax%
  \expandafter\only\beamer@tocsections{\gdef\beamer@todo{%
      \beamer@tempcount=#5\relax%
      \advance\beamer@tempcount by\beamer@sectionadjust%
      \ifnum\beamer@tempcount>0 
        \ifnum\beamer@tempcount>\beamer@toclastsection
          \def\inserttocsectionnumber{}%
        \else
          \edef\inserttocsectionnumber{\the\beamer@tempcount}%
        \fi
      \else
        \def\inserttocsectionnumber{}%
      \fi%
      \def\inserttocsection{\hyperlink{Navigation#3}{#2}}%
      \beamer@tocifnothide{\ifnum\c@section=#1\beamer@toc@cs\else\beamer@toc@os\fi}%
      {%
        \ifbeamer@pausesections\pause\fi%
        \ifx\beamer@toc@ooss\beamer@hidetext
          \vskip1.5em
        \else
          \vfill
        \fi
        {%
          \hbox{\vbox{%
              \def\beamer@breakhere{\\}%
              \beamer@tocact{\ifnum\c@section=#1\beamer@toc@cs\else\beamer@toc@os\fi}{section in toc}}}%
         \par%
        }%
      }%
    }%
  }%
  \beamer@restoreanother%
  }
  \beamer@todo%
  \fi\fi%
}

\def\subsectionintoc{}
\long\def\beamer@subsectionintoc#1#2#3#4#5#6{%
  \ifnum\c@tocdepth>1%
  \ifnum#5=\beamer@showpartnumber%
  {%
    \beamer@saveanother%
    \gdef\beamer@todo{}%
    \beamer@slideinframe=#1\relax%
    \expandafter\only\beamer@tocsections{\gdef\beamer@todo{%
      \ifbeamer@pausesubsections\pause\fi%
      \beamer@tempcount=#6%
      \advance\beamer@tempcount by\beamer@sectionadjust%
      \edef\inserttocsectionnumber{\the\beamer@tempcount}%
      \def\inserttocsubsectionnumber{#2}%
      \def\inserttocsubsection{\hyperlink{Navigation#4}{#3}}%
      \beamer@tocifnothide{\ifnum\c@section=#1\beamer@toc@css\else\beamer@toc@oss\fi}%
      {%
        \def\beamer@breakhere{\\}%
        \beamer@tocact{\ifnum\c@section=#1\ifnum\c@subsection=#2\beamer@toc@css\else\beamer@toc@oss\fi\else\beamer@toc@ooss\fi}
        {subsection in toc}%
      }%
    }}%
    \beamer@restoreanother%
  }%
  \beamer@todo%
  \fi\fi%
}

\def\subsubsectionintoc{}
\long\def\beamer@subsubsectionintoc#1#2#3#4#5#6#7{%
  \ifnum\c@tocdepth>2%
  \ifnum#6=\beamer@showpartnumber%
  {
    \beamer@saveanother%
    \gdef\beamer@todo{}%
    \beamer@slideinframe=#1\relax%
    \expandafter\only\beamer@tocsections{\gdef\beamer@todo{%
      \ifbeamer@pausesubsections\pause\fi%
      \beamer@tempcount=#7%
      \advance\beamer@tempcount by\beamer@sectionadjust%
      \edef\inserttocsectionnumber{\the\beamer@tempcount}%
      \def\inserttocsubsectionnumber{#2}%
      \def\inserttocsubsubsectionnumber{#3}%
      \def\inserttocsubsubsection{\hyperlink{Navigation#5}{#4}}%
      \beamer@tocifnothide{\ifnum\c@section=#1\beamer@toc@csss\else\beamer@toc@osss\fi}%
      {%
        \def\beamer@breakhere{\\}%
        \beamer@tocact{\ifnum\c@section=#1\ifnum\c@subsection=#2\ifnum\c@subsubsection=#3\beamer@toc@csss\else\beamer@toc@osss\fi\else\beamer@toc@oosss\fi\else\beamer@toc@ooosss\fi}
        {subsubsection in toc}%
      }%
    }}%
    \beamer@restoreanother%
  }
  \beamer@todo%
  \fi\fi%
}

\mode
<article>
{
  \long\def\beamer@sectionintoc#1#2#3#4#5{}
  \long\def\beamer@subsectionintoc#1#2#3#4#5#6{}
  \long\def\beamer@subsubsectionintoc#1#2#3#4#5#6#7{}
  \AtBeginDocument{
    \let\beamer@origtableofcontents=\tableofcontents
    \renewcommand{\tableofcontents}[1][]{\beamer@origtableofcontents}
    }
}


\mode
<all>