summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/texpower/powersem.dtx
blob: 9aa23d72bafb508d42b4b502669ca2be83b86e1e (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
% \iffalse meta-comment
% --------------------------------------------------------------
% Part of the TeXPower bundle
% Copyright (C) 1999-2004 Stephan Lehmke
%
% This program is free software; you can redistribute it and/or
% modify it under the terms of the GNU General Public License
% as published by the Free Software Foundation; either version 2
% of the License, or (at your option) any later version.
%
% This program is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
% GNU General Public License for more details.
% --------------------------------------------------------------
%
% powersem.dtx,v 1.3 2005/03/28 22:31:01 hansfn Exp
%
% \fi
%
% \iffalse
%<*driver>
\ProvidesFile{powersem.dtx}
%</driver>
%<powersem>\NeedsTeXFormat{LaTeX2e}
%<powersem>\ProvidesClass{powersem}
%<*powersem>
    [2004/07/27 v0.8a Create online Presentations with seminar.]
%</powersem>
%
%<*driver>
\documentclass{ltxdoc}
\EnableCrossrefs
\CodelineIndex
\RecordChanges
\begin{document}
  \DocInput{powersem.dtx}
\end{document}
%</driver>
%
% \fi
%
% \CheckSum{366}
%
% \CharacterTable
%  {Upper-case    \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
%   Lower-case    \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
%   Digits        \0\1\2\3\4\5\6\7\8\9
%   Exclamation   \!     Double quote  \"     Hash (number) \#
%   Dollar        \$     Percent       \%     Ampersand     \&
%   Acute accent  \'     Left paren    \(     Right paren   \)
%   Asterisk      \*     Plus          \+     Comma         \,
%   Minus         \-     Point         \.     Solidus       \/
%   Colon         \:     Semicolon     \;     Less than     \<
%   Equals        \=     Greater than  \>     Question mark \?
%   Commercial at \@     Left bracket  \[     Backslash     \\
%   Right bracket \]     Circumflex    \^     Underscore    \_
%   Grave accent  \`     Left brace    \{     Vertical bar  \|
%   Right brace   \}     Tilde         \~}
%
%
% \GetFileInfo{powersem.dtx}
%
% \DoNotIndex{\newcommand,\newenvironment}
%
% \title{The \textsf{powersem} class\thanks{This document
%   corresponds to \textsf{powersem}~\fileversion, dated \filedate.}}
% \author{ Stephan Lehmke \\ \texttt{Stephan.Lehmke@cs.uni-dortmund.de}}
%
% \maketitle
%
% \tableofcontents
%
% \section{Introduction}
%
% The user documentation is found in \texttt{manual.tex} and the FAQ.
% Only the implementation documentation is covered in this document.
%
% Make seminar ready for the Third Millennium ;-)
% This class loads seminar and tries to fix some problems which occur when trying to create dynamic presentations with
% the texpower package. 
%
% Some new features helpful for dynamic presentations are also added.
%
% This class is part of the TeXPower bundle, to be found at\\ % |http://texpower.sourceforge.net/|
%
% The TeXPower bundle also contains a package \texttt{fixseminar.sty} which applies some more fixes, in particular for
% hyperref. These can not be applied here because they have to be made after hyperref is loaded.
%
% \StopEventually{\PrintChanges\PrintIndex}
%
% \section{Implementation}
%
% \changes{v0.1}{1999/10/18}{First version. So far it doesn't do much more than load seminar.}
%
% \changes{v0.2}{2000/03/28}{Force seminar to treat \cs{paperwidth} and \cs{paperheight} in a
% sensible manner.}
%
% \changes{v0.3}{2000/05/10}{Added option `calcdimensions'.}
%
% \changes{v0.4}{2000/06/16}{Now separates text from footnotes when option `display' is given.}
%
% \changes{v0.5}{2000/06/26}{\cs{@colht} is ignored by seminar, which is bad. Added a patch to
% \cs{set@slidesize}.  calcdimensions now handles slide frames.}
%
% \changes{v0.5a}{2000/07/03}{The footnote patch with option display effectively disabled setting
% \cs{centerslidestrue}. Fixed.}
%
% \changes{v0.6}{2001/11/10}{seminar's \cs{output@slide} kernel copied (from seminar.bg2) and
% modified for better color handling and to remove some overfull \cs{vbox} warnings.  There was
% another underfull vbox warning lurking in the footnote patch. Removed.  New option truepagenumbers
% for cooperation with texpower in case `fragmented' slide numbers (like 3.5.1) are used.  Make
% seminar's form of raggedright lines (controlled by \cs{raggedslides}) active in parboxes and
% minipages (and p columns in tables or arrays).}
%
% \changes{v0.7}{2002/11/22}{Inserted \cs{nointerlineskip} in page building code to heal a slight
% problem with vertical spacing.  A small modification was neccessary wrt the KOMA option because
% with fixseminar v0.0.4, pdflatex slides can now be rotated.}
%
% \changes{v0.8}{2003/05/06}{Some fixes provided by Pascal Kockaert to (hopefully) get better
% behaviour with seminar's ``article'' option - many thanks!}
%
% \changes{v0.8a}{2004/07/27}{Moved to dtx format. No other code changes.}
%
%    \begin{macrocode}
\RequirePackage{ifthen}
%    \end{macrocode}
%
% The display option is understood by all relevant classes and packages from the TeXPower bundle. It means that
% `dynamic' features are to be turned on.
% There is a boolean register display (as defined in ifthen.sty) which is set by this option and can be used to
% differentiate between slides for display and slides for printout.
% Notes are disabled automatically.
%    \begin{macrocode}
\newboolean{display}
\DeclareOption{display}
{\setboolean{display}{true}\PassOptionsToClass{slidesonly}{seminar}}
%    \end{macrocode}
%
% The truepagenumbers option makes powersem count pages with the counter page, independently of the counter slide. This
% enables proper working of TeXPowers navigation buttons (some of which calculate relative page numbers) even when the
% counter slide is reset frequently (for slide numberings of the type |<l>.<n>.<m>|).
%    \begin{macrocode}
\newboolean{truepn@PS}
\DeclareOption{truepagenumbers}{\setboolean{truepn@PS}{true}}
%    \end{macrocode}
%
% The KOMA option tells powersem to load scrartcl (from the KOMA suite of document classes) instead of article.
%    \begin{macrocode}
\newboolean{BaseClass@PS}
\DeclareOption{KOMA}
{\setboolean{BaseClass@PS}{true}\providecommand{\baseclass}{scrartcl}}
%    \end{macrocode}
%
% The UseBaseClass option is more neutral: It tells powersem to load the class |\baseclass| (initially article) instead of
% article. 
%    \begin{macrocode}
\DeclareOption{UseBaseClass}
{\setboolean{BaseClass@PS}{true}\providecommand{\baseclass}{article}}
%    \end{macrocode}
%
% The reportclass option tells powersem to load the class |\baseclass| (initially report) instead of
% article. 
%    \begin{macrocode}
\DeclareOption{reportclass}
{\setboolean{BaseClass@PS}{true}\providecommand{\baseclass}{report}}
%    \end{macrocode}
%
% The bookclass option tells powersem to load the class |\baseclass| (initially report) instead of
% article. 
%    \begin{macrocode}
\DeclareOption{bookclass}
{\setboolean{BaseClass@PS}{true}\providecommand{\baseclass}{book}}
%    \end{macrocode}
%
% We need to redefine the a4paper option which is broken in seminar.cls
%    \begin{macrocode}
\DeclareOption{a4paper}{\PassOptionsToClass{a4}{seminar}}
%    \end{macrocode}
%
% The calcdimensions option tells powersem to automatically calculate slidewidth and slideheight from paper dimensions
% and margins.
%    \begin{macrocode}
\newboolean{calcdim@PS}
\DeclareOption{calcdimensions}{\setboolean{calcdim@PS}{true}}
%    \end{macrocode}
%
%    \begin{macrocode}
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{seminar}}

\ProcessOptions
%    \end{macrocode}
%
% Now we need to hack a little to make seminar load |\baseclass| instead of article (if one of the respectice options was
% given). 
%    \begin{macrocode}
\let\oldLC@PS=\LoadClass

\ifthenelse{\boolean{BaseClass@PS}}
{%
  \def\article@PS{article}
%    \end{macrocode}
% Make |\PassOptionsToClass| and |\LoadClass| use |\baseclass|...
%    \begin{macrocode}
  \let\oldPOTC@PS=\PassOptionsToClass
  \def\PassOptionsToClass#1#2%
  {\edef\cls@PS{#2}%
   \ifx\article@PS\cls@PS\oldPOTC@PS{#1}{\baseclass}%
   \else\oldPOTC@PS{#1}{#2}%
   \fi}
%    \end{macrocode}
% Furthermore, seminar redefines |\paperheight| and |\paperwidth|, saving their value in |\sem@paperheight| and
% |\sem@paperwidth|. We undo this so the paper dimension calculation of typearea can be used.
%    \begin{macrocode}
  \renewcommand{\LoadClass}[2][]%
  {%
    \edef\cls@PS{#2}%
    \ifx\article@PS\cls@PS
      \let\paperheight\sem@paperheight\let\paperwidth\sem@paperwidth
      \oldLC@PS[#1]{\baseclass}%
      \ifarticle\else\portraittrue\fi
     \else
      \oldLC@PS[#1]{#2}%
    \fi
  }%
} 
{}
%    \end{macrocode}
%
% Finally, the seminar class and some bug fixes are loaded.
%    \begin{macrocode}
\oldLC@PS{seminar}

\AtBeginDocument
{%
\input{seminar.bug}%
\input{seminar.bg2}%
}

\expandafter\def\expandafter\set@slidesize\expandafter
{\set@slidesize\@colht\vsize}

\g@addto@macro\@arrayparboxrestore\slide@rightskip

\ifthenelse{\boolean{truepn@PS}}{\truepagenumbers}{}

\AtBeginDocument{%
\ifthenelse{\boolean{BaseClass@PS}}{\sliderotation{none}}{}}
%    \end{macrocode} 
%
% Make some changes in the seminar kernel to hopefully get better handling of text colors and avoid overfull box
% warnings when |\slidetopmargin| and |\slidebottommargin| are set too small.
%    \begin{macrocode}
\AtBeginDocument{%
\ifarticle
\else
  \def\output@slide{%
    \begingroup
      \hoffset=-\inverseslidesmag in
      \voffset=-\inverseslidesmag in
      \setslidelength\@tempdima{%
        \ifportrait\paperwidth\else\paperheight\fi}%
      \setslidelength\@tempdimb{%
        \ifportrait\paperheight\else\paperwidth\fi}%
      \ifrotateheaders
        \@ifrotateslide{%
          \dimen@=\@tempdima
          \@tempdima=\@tempdimb
          \@tempdimb=\dimen@}%
      \fi
      % \oddsidemargin, \evensidemargin, \headheight, \footheight
      % used for scratch:
      \setslidelength\headheight\slidetopmargin
      \setslidelength\footheight\slidebottommargin
      \ifautoslidemargins
        \textwidth=\wd\@slidebox
        \oddsidemargin=\@tempdima
        \advance\oddsidemargin-\textwidth
        \divide\oddsidemargin 2
      \else
        \setslidelength\oddsidemargin\slideleftmargin
        \setslidelength\evensidemargin\sliderightmargin
        \textwidth=\@tempdima
        \advance\textwidth-\oddsidemargin
        \advance\textwidth-\evensidemargin
      \fi
      \setbox\@slidebox=\hbox to \@tempdima{{%    
%    \end{macrocode}
% All double \{\{ around box contents added for better color handling (STL).
%    \begin{macrocode}
      %                                                         
        \kern\oddsidemargin
        \vbox to\@tempdimb{{%
          \ifnum\fancyput@flag>-1
            \hbox{\kern-\oddsidemargin\do@fancyput}%
          \fi
          \let\label\@gobble
          \let\index\@gobble
          \let\glossary\@gobble
          \vbox to\headheight{{%
            \vfill
            \color@hbox
            \normalcolor
           \slideheadfont\relax%\strut         Removed (STL)
           \hb@xt@\textwidth{\@oddhead}%
            \color@endbox
            \kern\z@}}%
          \nointerlineskip
          \vss
          \hbox to\textwidth{{\hss\box\@slidebox\hss}}%
          \vss
          \nointerlineskip
          \vbox to\footheight{{%
            \vfill
              \color@hbox
              \normalcolor
             \slidefootfont\relax%\strut         Removed (STL)
             \hb@xt@\textwidth{\@oddfoot}%
              \color@endbox
            \vfill}}%
        }}\hss}}%
      \ifrotateheaders\@ifrotateslide\rotate@slide\fi
      \insert@specials
      \shipout\box\@slidebox
    \endgroup
    \let\firstmark\botmark
    \ifthenelse{\boolean{truepn@PS}}{\stepcounter{page}}{}%
%    \end{macrocode} 
% The above will seriously upset notes! (STL)
%    \begin{macrocode} 
    }%
  \@ifundefined{fancyput@flag}{\def\fancyput@flag{-1}}{}%
\fi
}
%    \end{macrocode} 
%
% When producing slides to be displayed interactively, we must make absolutely sure that interactive building of slides
% doesn't move text which has already been set. So slides are not to be centered. 
%    \begin{macrocode}
\ifthenelse{\boolean{display}}
{%
  \centerslidesfalse
  \extraslideheight{0pt}%
  \renewcommand{\slideshrink}{0}%
  \def\@makeslide{%
    \ifcenterslides
      \setbox\@slidebox\vbox{{%
        \@begindvi % added 1997/04/15 SPQR
        \unvbox\@cclv
        \ifvoid\slide@footins\else
          \vskip\skip\slide@footins
          \footnoterule
          \unvbox\slide@footins
        \fi
        \vskip\z@}}
     \else
      \setbox\@slidebox\vbox to \slide@vsize{{%
        \@begindvi % added 1997/04/15 SPQR
        \unvbox\@cclv
        \ifvoid\slide@footins\vfil\else
          \vfil\vskip\skip\slide@footins
          \footnoterule
          \unvbox\slide@footins
        \fi
        \vskip\z@}}%
    \fi
    }%
  }
{}
%    \end{macrocode} 
%
% If powersem is asked to calculate the slide dimensions...
%    \begin{macrocode}
\def\relax@PS{\relax}

\ifthenelse{\boolean{calcdim@PS}}
{%
  \AtBeginDocument
  {%
    \setlength{\slidewidth}{\paperwidth}%
    \advance\slidewidth by -\slideleftmargin\relax
    \advance\slidewidth by -\sliderightmargin\relax
    \ifx\theslideframe\relax@PS
     \else
      \advance\slidewidth by -2\slideframewidth\relax
      \advance\slidewidth by -2\slideframesep\relax
    \fi
    \setlength{\slideheight}{\paperheight}%
    \advance\slideheight by -\slidetopmargin\relax
    \advance\slideheight by -\slidebottommargin\relax
    \ifx\theslideframe\relax@PS
     \else
      \advance\slideheight by -2\slideframewidth\relax
      \advance\slideheight by -2\slideframesep\relax
    \fi
    }%
  }
{}

\AtBeginDocument
{%
  \@ifundefined{headwidth}{}
  {%
    \setslidelength{\headwidth}{\paperwidth}%
    \addtoslidelength{\headwidth}{-\slideleftmargin}%
    \addtoslidelength{\headwidth}{-\sliderightmargin}%
  }%
}
%    \end{macrocode} 
% \Finale
\endinput