summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/seminar/latex/slidesec.sty
blob: a7dd283ef22be9ce1e672c326ba51d211c2b51fa (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
%% BEGIN slidesec.sty
\def\fileversion{v0.9}
\def\filedate{92/05/07}
%%
%% Style option slidesec.sty, for use with LaTeX 2.09 or SliTeX.
%%
%% COPYRIGHT 1992, by Timothy Van Zandt, Timothy.VAN-ZANDT@insead.edu
%%
%%
%% This file may be distributed and/or modified under the conditions of
%% the LaTeX Project Public License, either version 1.2 of this license
%% or (at your option) any later version.  The latest version of this
%% license is in:
%% 
%%    http://www.latex-project.org/lppl.txt
%% 
%% and version 1.2 or later is part of all distributions of LaTeX version
%% 1999/12/01 or later.
%%
%%
% DISCLAIMER:
%
% Someone who actually uses something like this should rewrite it.
%
% DESCRIPTION:
%
% This file contains macros for sections, headings, tables of contents,
% and lists of slides, for slides. It can probably be used with your
% favorite LaTeX slide package (e.g., seminar.sty).
% However:
%%   If the counter used to keep track of slides is not  slide  ,
%%   then change the following line:
\def\@SCTR{\theslide}
%%
% ACKNOWLEDGEMENTS:
%
% The idea comes from Young U. Ryu's lslides.sty.
%
% USAGE:
%
% \slideheading[#1]{#2}
%  * Analogous to \section.
%  * [#1] is optional; \slideheading{#1} is same as \slideheading[#1]{#2}.
%  * Advances slidesection counter.
%  * Sets \theslideheading to #1; can be used, e.g., in headers and footers.
%  * Adds #1 to slide contents file.
%  * If #2 is non-empty, invokes \makeslideheading{#2} to make a heading.
%    Default definition of \makeslideheading is
%       \begin{center}\large\bf #2 \end{center}
%    but you can redefine this to suit your tastes.
%
% \slidesubheading[#1]{#2}
%  * Analogous to \subsection.
%  * Like \slideheading, but add "sub" to all the names.
%
% \slideheading and \slidesubheading are meant to be used at most once in
% a slide, but this is not a binding restriction.
%
% You may want to define abbreviated forms. E.g.,
%   \newcommand{heading}{\slideheading}
%   \newcommand{subheading}{\slidesubheading}
%
% \listofslides
%  * Analogous to \listoftables.
%
% \slidecontents
%  * Analogous to \tableofcontents
%
% \Slidecontents
%  * List \slidecontents, but puts some check marks and stuff to
%    indicate what you have covered so far and what is coming up.
%    Meant to be used in the middle of a presentation.
%
% To change fonts and otherwise customize what you get from \listofslides,
% \slidecontents, and \Slidecontents, you have to hack at the definitions
% of these macros.
%
% BUGS:
%
% These macros have not been tested very much.
%
% IMPLEMENTATION:
%
\@ifundefined{@startlos}{}{\endinput}
\typeout{File `slidesec.sty' \fileversion\space\space
  \filedate\space\space <tvz>}
%
% If we use \@starttoc{los} to read in \jobname.los, then its contents
% are destroyed and we can't read it again. \@startlos is like \@starttoc,
% but it sets the flae \los@flag to 1, and then we add a few commands
% to \enddocument that open \filename.los if \los@flag=1.
%
\def\los@flag{0}%
\def\@startlos{%
  \begingroup\makeatletter\@input{\jobname.los}\endgroup
  \gdef\los@flag{1}\global\@nobreakfalse}
\newtoks\@temptokenb
\@temptokena{%
  \ifnum\los@flag=1\if@filesw
    \newwrite\tf@los\immediate\openout\tf@los\jobname.los\relax
  \fi\fi}
\expandafter\@temptokenb\expandafter{\enddocument}
\edef\enddocument{\the\@temptokena\the\@temptokenb}
%
\newcounter{slidesection}
\newcounter{slidesubsection}
\def\theslidesection{\arabic{slidesection}}
\def\thesubslidesection{\theslidesection.\arabic{subslidesection}}
%
\def\slideheading{\@dblarg\slide@heading}%
\def\slide@heading[#1]#2{%
  \stepcounter{slidesection}%
  \addtocontents{los}{\protect\l@slide
    {\the\c@slidesection}{\ignorespaces#1}{\@SCTR}}%
  \gdef\theslideheading{#1}%
  \def\@tempa{#2}%
  \ifx\@tempa\@empty\else
    {\edef\@currentlabel{\csname p@slidesection\endcsname\theslidesection}%
      \makeslideheading{#2}}%
  \fi}
\def\slidesubheading{\@dblarg\slide@subheading}
\def\slide@subheading[#1]#2{%
  \stepcounter{slidesection}%
  \addtocontents{los}{\protect\l@subslide
    {\the\c@slidesubsection}{\ignorespaces#1}{\@SCTR}}%
  \gdef\theslidesubheading{#1}%
  \def\@tempa{#2}%
  \ifx\@tempa\@empty\else
    {\edef\@currentlabel{\csname p@slidesubsection\endcsname
      \theslidesubsection}\makeslideheading{#2}}%
  \fi}
\def\theslideheading{}\def\theslidesubheading{}
%
\def\makeslideheading#1{%
  \begin{center}\large\bf #1\end{center}}
\def\makeslidesubheading{\makeslideheading}
%
\def\@undottedtocline#1#2#3#4#5{\vskip \z@ plus .2pt
  \bgroup
    \leftskip #2\relax \parindent #2\relax\@afterindenttrue
    \interlinepenalty\@M
    \leavevmode
    \@tempdima #3\relax \advance\leftskip \@tempdima
    \hbox{}\hskip -\leftskip
    #4\par
  \egroup}
\def\slide@dottedcline{\@dottedtocline{1}{1.5em}{2.3em}}
\def\slide@undottedcline{\@undottedtocline{1}{1.5em}{2.3em}}
\def\slide@cline{\slide@dottedcline}
%
\def\slidenumberline#1{\hbox to\@tempdima{\hss#1\hskip 1em}}
%
\def\listofslides{\section*{List of Slides%
  \@mkboth{LIST OF SLIDES}{LIST OF SLIDES}}%
  \def\l@slide##1##2##3{%
    \slide@undottedcline{\slidenumberline{##3}{##2}}{}}%
  \let\l@subslide\l@slide
  \@startlos}
%
\def\slidecontents{\@ifstar%
  {\def\slide@cline{\slide@undottedcline}\slide@contents}%
  {\def\slide@cline{\slide@dottedcline}\slide@contents}}
\def\slide@contents{%
  \def\l@slide##1##2##3{%
    \slide@cline{\slidenumberline{$\bullet$}{##2}}{##3}}%
  \let\l@subslide\@gobbletwo
  \@startlos}
%
\def\Slidecontents{\@ifstar%
  {\def\slide@cline{\slide@undottedcline}\Slide@contents}%
  {\def\slide@cline{\slide@dottedcline}\Slide@contents}}
\def\Slide@contents{%
  \def\l@slide##1##2##3{%
    \ifcase\lslide@flag
      \message{##1 ** \the\c@slidesection}
      \ifnum##1>\c@slidesection
        \def\lslide@flag{1}{\large\slide@cline{%
          \slidenumberline{$\Rightarrow\bullet$}{##2}}{##3}}%
      \else
        {\large\slide@cline{%
          \slidenumberline{$\surd\;\bullet$}{##2}}{##3}}%
      \fi
    \or
      \def\lslide@flag{2}{\large\slide@cline{%
        \slidenumberline{$\bullet$}{##2}}{##3}}%
    \or
      {\large\slide@cline{%
        \slidenumberline{$\bullet$}{##2}}{##3}}%
    \fi}%
  \def\l@subslide##1##2##3{%
    \ifnum\lslide@flag=1
      \@undottedtocline{2}{3.8em}{3.2em}{##2}{}%
    \fi}%
  \def\lslide@flag{0}%
  \@startlos}
%
\endinput
%% END slidesec.sty