summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/beamer/beamerbaselocalstructure.sty
blob: 1c4832ee3310150303fea413f48427b7c6bcfde1 (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
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
% Copyright 2003--2007 by Till Tantau
% Copyright 2010 by Vedran Mileti\'c
%
% 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.

\ProvidesPackageRCS $Header: /Users/joseph/Documents/LaTeX/beamer/base/beamerbaselocalstructure.sty,v ddfba79dac19 2012/11/13 20:36:32 joseph $

\mode
<all>

\RequirePackage{enumerate}

\mode
<presentation>

%
%
% The \frametitle command
%
%
\newcommand<>\frametitle{\alt#1{\@dblarg\beamer@@frametitle}{\beamer@gobbleoptional}}
\long\def\beamer@@frametitle[#1]#2{%
  \beamer@ifempty{#2}{}{%
    \gdef\insertframetitle{{#2\ifnum\beamer@autobreakcount>0\relax{}\space\usebeamertemplate*{frametitle continuation}\fi}}%
  \gdef\beamer@frametitle{#2}%
  \gdef\beamer@shortframetitle{#1}%
}%
}

\newcommand\insertshortframetitle[1][]{%
  {%
    \beamer@setupshort{#1}%
    \beamer@insertshort{\beamer@shortframetitle}%
  }}


\mode
<all>
{
  \let\beamer@aftersubtitle=\relax
  \newcommand<>\framesubtitle[1]{\only#2{\beamer@ifempty{#1}{}{\gdef\insertframesubtitle{{#1}}\beamer@aftersubtitle}}}
}


\mode
<article>
{
  \newcommand<>\frametitle[2][]{\only#3{\gdef\insertframetitle{#2}%
      \@ifnextchar\framesubtitle{\beamer@donextsubtitle}{\usebeamertemplate{frametitle}}}}
  \def\beamer@donextsubtitle{%
    % Ugly hack...
    \def\beamer@aftersubtitle{\usebeamertemplate{frametitle}\let\beamer@aftersubtitle=\relax}
    }
}



%
% Alerting
%

\mode
<all>
{
  \newenvironment{alertenv}{\begin{altenv}%
      {\usebeamertemplate{alerted text begin}\usebeamercolor[fg]{alerted text}\usebeamerfont{alerted text}}
      {\usebeamertemplate{alerted text end}}{\color{.}}{}}{\end{altenv}}

  \newenvironment{structureenv}{\begin{altenv}%
      {\usebeamertemplate{structure text begin}\usebeamercolor[fg]{structure}\usebeamerfont{structure}}
      {\usebeamertemplate{structure text end}}{\color{.}}{}}{\end{altenv}}

  \newcommand<>{\alert}[1]{\begin{alertenv}#2\relax#1\end{alertenv}}
  \newcommand<>{\structure}[1]{\begin{structureenv}#2\relax#1\end{structureenv}}
}



%
%
% Predefined Blocks
%
%

\mode
<all>
{
  \newenvironment<>{block}[1]{%
    \begin{actionenv}#2%
      \def\insertblocktitle{#1}%
      \par%
      \usebeamertemplate{block begin}}
    {\par%
      \usebeamertemplate{block end}%
    \end{actionenv}}

  \newenvironment<>{alertblock}[1]{%
    \begin{actionenv}#2%
      \def\insertblocktitle{#1}%
      \par%
      \mode<presentation>{%\usebeamerfont{block}%
        \setbeamercolor{local structure}{parent=alerted text}}%
      \usebeamertemplate{block alerted begin}}
    {\par%
      \usebeamertemplate{block alerted end}%
    \end{actionenv}}

  \newenvironment<>{exampleblock}[1]{%
    \begin{actionenv}#2%
      \def\insertblocktitle{#1}%
      \par%
      \mode<presentation>{%\usebeamerfont{block}%
        \setbeamercolor{local structure}{parent=example text}}%
      \usebeamertemplate{block example begin}}
    {\par%
      \usebeamertemplate{block example end}%
    \end{actionenv}}
}


%
% List stuff
%

\setlength\leftmargini  {2em}
\setlength\leftmarginii  {2em}
\setlength\leftmarginiii  {2em}
\setlength  \labelsep  {.5em}
\setlength  \labelwidth{\leftmargini}
\addtolength\labelwidth{-\labelsep}

\def\@listi{\leftmargin\leftmargini
            \topsep 3\p@ \@plus2\p@ \@minus2.5\p@
            \parsep 0\p@
            \itemsep3\p@ \@plus2\p@ \@minus3\p@}
\let\@listI\@listi
\def\@listii{\leftmargin\leftmarginii
              \topsep    2\p@ \@plus1\p@ \@minus2\p@
              \parsep    0\p@   \@plus\p@
              \itemsep   \parsep}
\def\@listiii{\leftmargin\leftmarginiii
              \topsep    2\p@ \@plus1\p@ \@minus2\p@
              \parsep    0\p@   \@plus\p@
              \itemsep   \parsep}


%
%
% Enumerations
%
%

\def\enumerate{%
  \ifnum\@enumdepth>2\relax\@toodeep
  \else%
    \advance\@enumdepth\@ne%
    \edef\@enumctr{enum\romannumeral\the\@enumdepth}%
    \advance\@itemdepth\@ne%
  \fi%
  \beamer@computepref\@enumdepth% sets \beameritemnestingprefix
  \edef\beamer@enumtempl{enumerate \beameritemnestingprefix item}%
  \@ifnextchar[{\beamer@@enum@}{\beamer@enum@}}
\def\beamer@@enum@[{\@ifnextchar<{\beamer@enumdefault[}{\beamer@@@enum@[}}
\def\beamer@enumdefault[#1]{\def\beamer@defaultospec{#1}%
  \@ifnextchar[{\beamer@@@enum@}{\beamer@enum@}}
\def\beamer@@@enum@[#1]{% partly copied from enumerate.sty
  \@enLab{}\let\@enThe\@enQmark
  \@enloop#1\@enum@
  \ifx\@enThe\@enQmark\@warning{The counter will not be printed.%
    ^^J\space\@spaces\@spaces\@spaces The label is: \the\@enLab}\fi
  \def\insertenumlabel{\the\@enLab}
  \def\beamer@enumtempl{enumerate mini template}%
  \expandafter\let\csname the\@enumctr\endcsname\@enThe
  \csname c@\@enumctr\endcsname7
  \expandafter\settowidth
            \csname leftmargin\romannumeral\@enumdepth\endcsname
            {\the\@enLab\hspace{\labelsep}}%
  \beamer@enum@}
\def\beamer@enum@{%
  \beamer@computepref\@itemdepth% sets \beameritemnestingprefix
  \usebeamerfont{itemize/enumerate \beameritemnestingprefix body}%
  \usebeamercolor[fg]{itemize/enumerate \beameritemnestingprefix body}%
  \usebeamertemplate{itemize/enumerate \beameritemnestingprefix body begin}%
  \expandafter
    \list
      {\usebeamertemplate{\beamer@enumtempl}}
      {\usecounter\@enumctr%
        \def\makelabel##1{{\hss\llap{{%
                \usebeamerfont*{enumerate \beameritemnestingprefix item}%
                \usebeamercolor[fg]{enumerate \beameritemnestingprefix item}##1}}}}}%
  \beamer@cramped%
  \raggedright%
  \beamer@firstlineitemizeunskip%
}
\def\endenumerate{\ifhmode\unskip\fi\endlist%
   \usebeamertemplate{itemize/enumerate \beameritemnestingprefix body end}}

\def\beamer@computepref#1{%
  \let\beameritemnestingprefix\@empty%
  \ifcase#1\or\or\def\beameritemnestingprefix{sub}\or\def\beameritemnestingprefix{subsub}\or\@toodeep\fi%
}

\def\insertenumlabel{\theenumi}
\def\insertsubenumlabel{\theenumii}
\def\insertsubsubenumlabel{\theenumiii}

\mode
<article>
{
  \AtBeginDocument{ % Remove any overlay specification
    \let\beamer@@@enum@\@@enum@
    \def\@@enum@[{%
      \@ifnextchar<%
        {\beamer@@@num@@}
        {\beamer@@@enum@[}%
    }
    \def\beamer@@@num@@<#1>]{%
      \@ifnextchar[%
        {\beamer@@@enum@}
        {\@enum@}%
    }
    %\let\beamer@origenumerate=\enumerate
    %\renewcommand*\enumerate{\beamer@origenumerate}
  }
}



%
%
% Itemize
%
%

\renewcommand{\itemize}[1][]{%
  \beamer@ifempty{#1}{}{\def\beamer@defaultospec{#1}}%
  \ifnum \@itemdepth >2\relax\@toodeep\else
    \advance\@itemdepth\@ne
    \beamer@computepref\@itemdepth% sets \beameritemnestingprefix
    \usebeamerfont{itemize/enumerate \beameritemnestingprefix body}%
    \usebeamercolor[fg]{itemize/enumerate \beameritemnestingprefix body}%
    \usebeamertemplate{itemize/enumerate \beameritemnestingprefix body begin}%
    \list
      {\usebeamertemplate{itemize \beameritemnestingprefix item}}
      {\def\makelabel##1{%
          {%
            \hss\llap{{%
                \usebeamerfont*{itemize \beameritemnestingprefix item}%
                \usebeamercolor[fg]{itemize \beameritemnestingprefix item}##1}}%
          }%
        }%
      }
  \fi%
  \beamer@cramped%
  \raggedright%
  \beamer@firstlineitemizeunskip%
}

\def\enditemize{\ifhmode\unskip\fi\endlist%
  \usebeamertemplate{itemize/enumerate \beameritemnestingprefix body end}}

\let\beamer@itemize\itemize

\mode
<article>
{
  \AtBeginDocument{
    \let\beamer@origitemize=\itemize
    \def\itemize{%
      \@ifnextchar[{\beamer@itemize@}{\beamer@origitemize}%
    }
    \def\beamer@itemize@[{%
      \@ifnextchar<{\beamer@itemize@@}{\beamer@origitemize[}%
    }
    \def\beamer@itemize@@<#1>]{\beamer@origitemize}
  }
}




\def\description{\@ifnextchar[{\beamer@testforospec}{\beamer@descdefault\beamer@descriptionwidth\@@description}}
\def\beamer@testforospec[{\@ifnextchar<{\beamer@scandefaultospec[}{\@description[}}
\def\beamer@scandefaultospec[#1]{\def\beamer@defaultospec{#1}\description}
\def\@description[#1]{\setbox\beamer@tempbox=\hbox{\def\insertdescriptionitem{#1}\usebeamertemplate**{description item}}%
  \beamer@descdefault\wd\beamer@tempbox\@@description}
\def\@@description{%
  \advance\beamer@descdefault by \labelsep%
  \list
  {}
  {\labelwidth\beamer@descdefault\leftmargin\beamer@descdefault\let\makelabel\beamer@descriptionitem}%
  \beamer@cramped%
  \raggedright
  \beamer@firstlineitemizeunskip%
}
\def\enddescription{\ifhmode\unskip\fi\endlist}
\long\def\beamer@descriptionitem#1{%
  \def\insertdescriptionitem{#1}%
  \hfil\hspace\labelsep{\usebeamertemplate**{description item}}}

\beamer@descriptionwidth=2cm
\define@key{beamer@margin}{description width}{%
  \beamer@descriptionwidth=#1\relax%
}
\define@key{beamer@margin}{description width of}{%
  \setbox\beamer@tempbox=\hbox{\def\insertdescriptionitem{#1}\usebeamertemplate**{description item}}%
  \beamer@descriptionwidth=\wd\beamer@tempbox\relax%
}

\mode
<article>
{
  \AtBeginDocument{
    \let\beamer@origdescription=\description
    \renewcommand{\description}[1][]{\beamer@origdescription}
  }
}






%
% Abstract command
%

\newenvironment<>{abstract}%
{\actionenv#1%
  \usebeamertemplate{abstract begin}%
  \usebeamerfont{abstract}%
  \usebeamercolor{abstract}%
  \usebeamertemplate**{abstract title}}%
{\usebeamertemplate{abstract end}\endactionenv}


%
% Verse, quotation, quote environments
%

\newenvironment<>{verse}
{\actionenv#1%
  \usebeamertemplate{verse begin}%
  \usebeamerfont{verse}%
  \usebeamercolor{verse}%
  \let\\\@centercr%
  \list{}{\itemsep      \z@
    \itemindent   -1.5em%
    \listparindent\itemindent
    \rightmargin  \leftmargin
    \advance\leftmargin 1.5em
    \parsep       .75em plus .25em minus.25em}%
\item\relax}
{\endlist\usebeamertemplate{verse end}\endactionenv}


\newenvironment<>{quotation}
{\actionenv#1%
  \usebeamertemplate{quotation begin}
  \usebeamerfont{quotation}%
  \usebeamercolor{quotation}%
  \list{}{\listparindent 1.5em%
    \itemindent    \listparindent
    \rightmargin   \leftmargin
    \parsep        \z@ \@plus\p@}%
\item\relax}
{\endlist\usebeamertemplate{quotation end}\endactionenv}

\newenvironment<>{quote}
{\actionenv#1%
  \usebeamertemplate{quote begin}%
  \usebeamerfont{quote}%
  \usebeamercolor{quote}%
  \list{}{\rightmargin   \leftmargin}
\item\relax}
{\endlist\usebeamertemplate{quote end}\endactionenv}


\mode
<article>
{
  \renewenvironment<>{verse}{\actionenv#1\originalverse}{\endoriginalverse\endactionenv}
  \renewenvironment<>{quotation}{\actionenv#1\originalquotation}{\endoriginalquotation\endactionenv}
  \renewenvironment<>{quote}{\actionenv#1\originalquote}{\endoriginalquote\endactionenv}
}




%
% Bibliography code
%
\newenvironment{thebibliography}[1]
{%\leavevmode\unskip%
  \list{\@biblabel{\@arabic\c@enumiv}}%
           {\settowidth\labelwidth{\beamer@biblabeltemplate{\@biblabel{#1}}}%
            \leftmargin\labelwidth
            \advance\leftmargin\labelsep
            \itemsep=0pt%
            \partopsep=0pt%
            \topsep=0pt%
            \usecounter{enumiv}%
            \let\p@enumiv\@empty
            \renewcommand\theenumiv{\@arabic\c@enumiv}
            \let\makelabel\beamer@biblabeltemplate}%
      \sloppy\raggedright
      \clubpenalty10000
      \@clubpenalty \clubpenalty
      \widowpenalty10000%
      \sfcode`\.\@m}
     {\def\@noitemerr
       {\@latex@warning{Empty `thebibliography' environment}}%
      \ifhmode\unskip\fi\endlist}

\long\def\beamer@biblabeltemplate#1{\def\insertbiblabel{#1}\usebeamertemplate*{bibliography item}\hfil}

\def\bibitem{\@ifnextchar<{\beamer@bibitem@store}{\gdef\beamer@bibstore{}\beamer@plainbibitem}}
\def\beamer@bibitem@store<#1>{\gdef\beamer@bibstore{<#1>}\beamer@plainbibitem}
\def\beamer@plainbibitem{\@ifnextchar[\@lbibitem\beamer@bibitem}
\def\@lbibitem[#1]#2{\expandafter\item\beamer@bibstore[\@biblabel{#1}\hfill]%
  \@ifundefined{beamerbib@#2@\the\c@framenumber}{\if@filesw
    {\let\protect\noexpand
      \immediate
      \write\@auxout{\string\bibcite{#2}{\noexpand\hyperlink{beamerbib#2}{#1}}}}\fi%
    \global\@namedef{beamerbib@#2@\the\c@framenumber}{\relax}%
    \hypertarget{beamerbib#2}{}%
    }{}%
  \def\newblock{\beamer@newblock}\newblock%
  \hbox{}\ignorespaces}
\def\beamer@bibitem#1{\@bibitem{#1}\ignorespaces}
\def\@bibitem#1{\expandafter\item\beamer@bibstore\@ifundefined{beamerbib@#1@\the\c@framenumber}%
  {\if@filesw \immediate\write\@auxout
    {\string\bibcite{#1}{\noexpand\hyperlink{beamerbib#1}{\the\value{\@listctr}}}}\fi%
    \global\@namedef{beamerbib@#1@\the\c@framenumber}{\relax}%
    \hypertarget{beamerbib#1}{}}%
  {}%
  \def\newblock{\beamer@newblock}\newblock}
\def\newblock{\beamer@newblock}

\def\beamer@newblock{%
  \usebeamercolor[fg]{bibliography entry author}%
  \usebeamerfont{bibliography entry author}%
  \usebeamertemplate{bibliography entry author}%
  \def\newblock{%
    \usebeamercolor[fg]{bibliography entry title}%
    \usebeamerfont{bibliography entry title}%
    \usebeamertemplate{bibliography entry title}%
    \def\newblock{%
      \usebeamercolor[fg]{bibliography entry location}%
      \usebeamerfont{bibliography entry location}%
      \usebeamertemplate{bibliography entry location}%
      \def\newblock{%
        \usebeamercolor[fg]{bibliography entry note}%
        \usebeamerfont{bibliography entry note}%
        \usebeamertemplate{bibliography entry note}}}}%
  \leavevmode\setbox\beamer@tempbox=\hbox{}\ht\beamer@tempbox=1.5em\box\beamer@tempbox}

% The following code provided by Audrey http://tex.stackexchange.com/a/57247
\AtBeginDocument{%
  \@ifpackageloaded{biblatex}
    {\apptocmd{\blx@env@bibliography}
       {\let\makelabel\beamer@biblabeltemplate}{}{}
     \apptocmd{\abx@macro@begentry}
       {\let\bbx@tempa\@empty%
        \usebeamercolor[fg]{bibliography entry author}}{}{}
     \pretocmd{\abx@macro@labeltitle}
       {\ifboolexpr{ test {\ifcsundef{abx@field@label}}
          and test {\ifcsundef{abx@field@labeltitle}} }{}{\let\bbx@tempa\labelnamepunct}}{}{}
     \pretocmd{\abx@macro@title}
       {\ifcsundef{abx@name@labelname}{}{\let\bbx@tempa\labelnamepunct}%
        \bbx@tempa\newblock\unspace\usebeamercolor[fg]{bibliography entry title}}{}{}
     \apptocmd{\abx@macro@title}
       {\ifcsundef{abx@field@title}{}{\newunitpunct}%
        \newblock\usebeamercolor[fg]{bibliography entry note}}{}{}}
    {}}

\mode
<article>
{
  \AtBeginDocument{
    \renewcommand<>{\bibitem}{\beameroriginal{\bibitem}}%should actually suppress
  }
}



%
% Floats and tables
%

\newenvironment{figure}[1][]{%
  \def\@captype{figure}%
  \par\nobreak\begin{center}\nobreak}
  {\par\nobreak\end{center}}
\newcounter{figure}
\renewcommand\thefigure{\@arabic\c@figure}

\newenvironment{table}[1][]{%
  \def\@captype{table}%
  \par\nobreak\begin{center}\nobreak}
  {\par\nobreak\end{center}\nobreak}
\newcounter{table}
\renewcommand\thetable{\@arabic\c@table}

\newlength\abovecaptionskip
\newlength\belowcaptionskip
\setlength\abovecaptionskip{7pt}
\setlength\belowcaptionskip{7pt}

\def\caption{
  \ifx\@captype\@undefined
    \@latex@error{\noexpand\caption outside figure or table}\@ehd
    \expandafter\@gobble
 \else
   \refstepcounter\@captype
   \expandafter\@firstofone
 \fi
 {\@dblarg{\@caption\@captype}}%
}
\long\def\@caption#1[#2]#3{% second argument ignored
  \par\nobreak
  \begingroup
    \@parboxrestore
    \if@minipage
      \@setminipage
    \fi
    \beamer@makecaption{#1}{\ignorespaces #3}\par\nobreak
    \endgroup}
\long\def\beamer@makecaption#1#2{%
  \def\insertcaptionname{\csname#1name\endcsname}%
  \def\insertcaptionnumber{\csname the#1\endcsname}%
  \def\insertcaption{#2}%
  \nobreak\vskip\abovecaptionskip\nobreak
  \sbox\@tempboxa{\usebeamertemplate**{caption}}%
  \ifdim \wd\@tempboxa >\hsize
    \usebeamertemplate**{caption}\par
  \else
    \global \@minipagefalse
    \hb@xt@\hsize{\hfil\box\@tempboxa\hfil}%
  \fi
  \nobreak\vskip\belowcaptionskip\nobreak}


\mode
<all>