Debian Codegraph @

texmf-dist/source/latex/texpower/powersem.dtx

raw
1 % \iffalse meta-comment
2 % --------------------------------------------------------------
3 % Part of the TeXPower bundle
4 % Copyright (C) 1999-2004 Stephan Lehmke
5 %
6 % This program is free software; you can redistribute it and/or
7 % modify it under the terms of the GNU General Public License
8 % as published by the Free Software Foundation; either version 2
9 % of the License, or (at your option) any later version.
10 %
11 % This program is distributed in the hope that it will be useful,
12 % but WITHOUT ANY WARRANTY; without even the implied warranty of
13 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 % GNU General Public License for more details.
15 % --------------------------------------------------------------
16 %
17 % powersem.dtx,v 1.3 2005/03/28 22:31:01 hansfn Exp
18 %
19 % \fi
20 %
21 % \iffalse
22 %<*driver>
23 \ProvidesFile{powersem.dtx}
24 %</driver>
25 %<powersem>\NeedsTeXFormat{LaTeX2e}
26 %<powersem>\ProvidesClass{powersem}
27 %<*powersem>
28 [2004/07/27 v0.8a Create online Presentations with seminar.]
29 %</powersem>
30 %
31 %<*driver>
32 \documentclass{ltxdoc}
33 \EnableCrossrefs
34 \CodelineIndex
35 \RecordChanges
36 \begin{document}
37 \DocInput{powersem.dtx}
38 \end{document}
39 %</driver>
40 %
41 % \fi
42 %
43 % \CheckSum{366}
44 %
45 % \CharacterTable
46 % {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
47 % 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
48 % Digits \0\1\2\3\4\5\6\7\8\9
49 % Exclamation \! Double quote \" Hash (number) \#
50 % Dollar \$ Percent \% Ampersand \&
51 % Acute accent \' Left paren \( Right paren \)
52 % Asterisk \* Plus \+ Comma \,
53 % Minus \- Point \. Solidus \/
54 % Colon \: Semicolon \; Less than \<
55 % Equals \= Greater than \> Question mark \?
56 % Commercial at \@ Left bracket \[ Backslash \\
57 % Right bracket \] Circumflex \^ Underscore \_
58 % Grave accent \` Left brace \{ Vertical bar \|
59 % Right brace \} Tilde \~}
60 %
61 %
62 % \GetFileInfo{powersem.dtx}
63 %
64 % \DoNotIndex{\newcommand,\newenvironment}
65 %
66 % \title{The \textsf{powersem} class\thanks{This document
67 % corresponds to \textsf{powersem}~\fileversion, dated \filedate.}}
68 % \author{ Stephan Lehmke \\ \texttt{[email protected]}}
69 %
70 % \maketitle
71 %
72 % \tableofcontents
73 %
74 % \section{Introduction}
75 %
76 % The user documentation is found in \texttt{manual.tex} and the FAQ.
77 % Only the implementation documentation is covered in this document.
78 %
79 % Make seminar ready for the Third Millennium ;-)
80 % This class loads seminar and tries to fix some problems which occur when trying to create dynamic presentations with
81 % the texpower package.
82 %
83 % Some new features helpful for dynamic presentations are also added.
84 %
85 % This class is part of the TeXPower bundle, to be found at\\ % |http://texpower.sourceforge.net/|
86 %
87 % The TeXPower bundle also contains a package \texttt{fixseminar.sty} which applies some more fixes, in particular for
88 % hyperref. These can not be applied here because they have to be made after hyperref is loaded.
89 %
90 % \StopEventually{\PrintChanges\PrintIndex}
91 %
92 % \section{Implementation}
93 %
94 % \changes{v0.1}{1999/10/18}{First version. So far it doesn't do much more than load seminar.}
95 %
96 % \changes{v0.2}{2000/03/28}{Force seminar to treat \cs{paperwidth} and \cs{paperheight} in a
97 % sensible manner.}
98 %
99 % \changes{v0.3}{2000/05/10}{Added option `calcdimensions'.}
100 %
101 % \changes{v0.4}{2000/06/16}{Now separates text from footnotes when option `display' is given.}
102 %
103 % \changes{v0.5}{2000/06/26}{\cs{@colht} is ignored by seminar, which is bad. Added a patch to
104 % \cs{set@slidesize}. calcdimensions now handles slide frames.}
105 %
106 % \changes{v0.5a}{2000/07/03}{The footnote patch with option display effectively disabled setting
107 % \cs{centerslidestrue}. Fixed.}
108 %
109 % \changes{v0.6}{2001/11/10}{seminar's \cs{output@slide} kernel copied (from seminar.bg2) and
110 % modified for better color handling and to remove some overfull \cs{vbox} warnings. There was
111 % another underfull vbox warning lurking in the footnote patch. Removed. New option truepagenumbers
112 % for cooperation with texpower in case `fragmented' slide numbers (like 3.5.1) are used. Make
113 % seminar's form of raggedright lines (controlled by \cs{raggedslides}) active in parboxes and
114 % minipages (and p columns in tables or arrays).}
115 %
116 % \changes{v0.7}{2002/11/22}{Inserted \cs{nointerlineskip} in page building code to heal a slight
117 % problem with vertical spacing. A small modification was neccessary wrt the KOMA option because
118 % with fixseminar v0.0.4, pdflatex slides can now be rotated.}
119 %
120 % \changes{v0.8}{2003/05/06}{Some fixes provided by Pascal Kockaert to (hopefully) get better
121 % behaviour with seminar's ``article'' option - many thanks!}
122 %
123 % \changes{v0.8a}{2004/07/27}{Moved to dtx format. No other code changes.}
124 %
125 % \begin{macrocode}
126 \RequirePackage{ifthen}
127 % \end{macrocode}
128 %
129 % The display option is understood by all relevant classes and packages from the TeXPower bundle. It means that
130 % `dynamic' features are to be turned on.
131 % There is a boolean register display (as defined in ifthen.sty) which is set by this option and can be used to
132 % differentiate between slides for display and slides for printout.
133 % Notes are disabled automatically.
134 % \begin{macrocode}
135 \newboolean{display}
136 \DeclareOption{display}
137 {\setboolean{display}{true}\PassOptionsToClass{slidesonly}{seminar}}
138 % \end{macrocode}
139 %
140 % The truepagenumbers option makes powersem count pages with the counter page, independently of the counter slide. This
141 % enables proper working of TeXPowers navigation buttons (some of which calculate relative page numbers) even when the
142 % counter slide is reset frequently (for slide numberings of the type |<l>.<n>.<m>|).
143 % \begin{macrocode}
144 \newboolean{truepn@PS}
145 \DeclareOption{truepagenumbers}{\setboolean{truepn@PS}{true}}
146 % \end{macrocode}
147 %
148 % The KOMA option tells powersem to load scrartcl (from the KOMA suite of document classes) instead of article.
149 % \begin{macrocode}
150 \newboolean{BaseClass@PS}
151 \DeclareOption{KOMA}
152 {\setboolean{BaseClass@PS}{true}\providecommand{\baseclass}{scrartcl}}
153 % \end{macrocode}
154 %
155 % The UseBaseClass option is more neutral: It tells powersem to load the class |\baseclass| (initially article) instead of
156 % article.
157 % \begin{macrocode}
158 \DeclareOption{UseBaseClass}
159 {\setboolean{BaseClass@PS}{true}\providecommand{\baseclass}{article}}
160 % \end{macrocode}
161 %
162 % The reportclass option tells powersem to load the class |\baseclass| (initially report) instead of
163 % article.
164 % \begin{macrocode}
165 \DeclareOption{reportclass}
166 {\setboolean{BaseClass@PS}{true}\providecommand{\baseclass}{report}}
167 % \end{macrocode}
168 %
169 % The bookclass option tells powersem to load the class |\baseclass| (initially report) instead of
170 % article.
171 % \begin{macrocode}
172 \DeclareOption{bookclass}
173 {\setboolean{BaseClass@PS}{true}\providecommand{\baseclass}{book}}
174 % \end{macrocode}
175 %
176 % We need to redefine the a4paper option which is broken in seminar.cls
177 % \begin{macrocode}
178 \DeclareOption{a4paper}{\PassOptionsToClass{a4}{seminar}}
179 % \end{macrocode}
180 %
181 % The calcdimensions option tells powersem to automatically calculate slidewidth and slideheight from paper dimensions
182 % and margins.
183 % \begin{macrocode}
184 \newboolean{calcdim@PS}
185 \DeclareOption{calcdimensions}{\setboolean{calcdim@PS}{true}}
186 % \end{macrocode}
187 %
188 % \begin{macrocode}
189 \DeclareOption*{\PassOptionsToClass{\CurrentOption}{seminar}}
190
191 \ProcessOptions
192 % \end{macrocode}
193 %
194 % Now we need to hack a little to make seminar load |\baseclass| instead of article (if one of the respectice options was
195 % given).
196 % \begin{macrocode}
197 \let\oldLC@PS=\LoadClass
198
199 \ifthenelse{\boolean{BaseClass@PS}}
200 {%
201 \def\article@PS{article}
202 % \end{macrocode}
203 % Make |\PassOptionsToClass| and |\LoadClass| use |\baseclass|...
204 % \begin{macrocode}
205 \let\oldPOTC@PS=\PassOptionsToClass
206 \def\PassOptionsToClass#1#2%
207 {\edef\cls@PS{#2}%
208 \ifx\article@PS\cls@PS\oldPOTC@PS{#1}{\baseclass}%
209 \else\oldPOTC@PS{#1}{#2}%
210 \fi}
211 % \end{macrocode}
212 % Furthermore, seminar redefines |\paperheight| and |\paperwidth|, saving their value in |\sem@paperheight| and
213 % |\sem@paperwidth|. We undo this so the paper dimension calculation of typearea can be used.
214 % \begin{macrocode}
215 \renewcommand{\LoadClass}[2][]%
216 {%
217 \edef\cls@PS{#2}%
218 \ifx\article@PS\cls@PS
219 \let\paperheight\sem@paperheight\let\paperwidth\sem@paperwidth
220 \oldLC@PS[#1]{\baseclass}%
221 \ifarticle\else\portraittrue\fi
222 \else
223 \oldLC@PS[#1]{#2}%
224 \fi
225 }%
226 }
227 {}
228 % \end{macrocode}
229 %
230 % Finally, the seminar class and some bug fixes are loaded.
231 % \begin{macrocode}
232 \oldLC@PS{seminar}
233
234 \AtBeginDocument
235 {%
236 \input{seminar.bug}%
237 \input{seminar.bg2}%
238 }
239
240 \expandafter\def\expandafter\set@slidesize\expandafter
241 {\set@slidesize\@colht\vsize}
242
243 \g@addto@macro\@arrayparboxrestore\slide@rightskip
244
245 \ifthenelse{\boolean{truepn@PS}}{\truepagenumbers}{}
246
247 \AtBeginDocument{%
248 \ifthenelse{\boolean{BaseClass@PS}}{\sliderotation{none}}{}}
249 % \end{macrocode}
250 %
251 % Make some changes in the seminar kernel to hopefully get better handling of text colors and avoid overfull box
252 % warnings when |\slidetopmargin| and |\slidebottommargin| are set too small.
253 % \begin{macrocode}
254 \AtBeginDocument{%
255 \ifarticle
256 \else
257 \def\output@slide{%
258 \begingroup
259 \hoffset=-\inverseslidesmag in
260 \voffset=-\inverseslidesmag in
261 \setslidelength\@tempdima{%
262 \ifportrait\paperwidth\else\paperheight\fi}%
263 \setslidelength\@tempdimb{%
264 \ifportrait\paperheight\else\paperwidth\fi}%
265 \ifrotateheaders
266 \@ifrotateslide{%
267 \dimen@=\@tempdima
268 \@tempdima=\@tempdimb
269 \@tempdimb=\dimen@}%
270 \fi
271 % \oddsidemargin, \evensidemargin, \headheight, \footheight
272 % used for scratch:
273 \setslidelength\headheight\slidetopmargin
274 \setslidelength\footheight\slidebottommargin
275 \ifautoslidemargins
276 \textwidth=\wd\@slidebox
277 \oddsidemargin=\@tempdima
278 \advance\oddsidemargin-\textwidth
279 \divide\oddsidemargin 2
280 \else
281 \setslidelength\oddsidemargin\slideleftmargin
282 \setslidelength\evensidemargin\sliderightmargin
283 \textwidth=\@tempdima
284 \advance\textwidth-\oddsidemargin
285 \advance\textwidth-\evensidemargin
286 \fi
287 \setbox\@slidebox=\hbox to \@tempdima{{%
288 % \end{macrocode}
289 % All double \{\{ around box contents added for better color handling (STL).
290 % \begin{macrocode}
291 %
292 \kern\oddsidemargin
293 \vbox to\@tempdimb{{%
294 \ifnum\fancyput@flag>-1
295 \hbox{\kern-\oddsidemargin\do@fancyput}%
296 \fi
297 \let\label\@gobble
298 \let\index\@gobble
299 \let\glossary\@gobble
300 \vbox to\headheight{{%
301 \vfill
302 \color@hbox
303 \normalcolor
304 \slideheadfont\relax%\strut Removed (STL)
305 \hb@xt@\textwidth{\@oddhead}%
306 \color@endbox
307 \kern\z@}}%
308 \nointerlineskip
309 \vss
310 \hbox to\textwidth{{\hss\box\@slidebox\hss}}%
311 \vss
312 \nointerlineskip
313 \vbox to\footheight{{%
314 \vfill
315 \color@hbox
316 \normalcolor
317 \slidefootfont\relax%\strut Removed (STL)
318 \hb@xt@\textwidth{\@oddfoot}%
319 \color@endbox
320 \vfill}}%
321 }}\hss}}%
322 \ifrotateheaders\@ifrotateslide\rotate@slide\fi
323 \insert@specials
324 \shipout\box\@slidebox
325 \endgroup
326 \let\firstmark\botmark
327 \ifthenelse{\boolean{truepn@PS}}{\stepcounter{page}}{}%
328 % \end{macrocode}
329 % The above will seriously upset notes! (STL)
330 % \begin{macrocode}
331 }%
332 \@ifundefined{fancyput@flag}{\def\fancyput@flag{-1}}{}%
333 \fi
334 }
335 % \end{macrocode}
336 %
337 % When producing slides to be displayed interactively, we must make absolutely sure that interactive building of slides
338 % doesn't move text which has already been set. So slides are not to be centered.
339 % \begin{macrocode}
340 \ifthenelse{\boolean{display}}
341 {%
342 \centerslidesfalse
343 \extraslideheight{0pt}%
344 \renewcommand{\slideshrink}{0}%
345 \def\@makeslide{%
346 \ifcenterslides
347 \setbox\@slidebox\vbox{{%
348 \@begindvi % added 1997/04/15 SPQR
349 \unvbox\@cclv
350 \ifvoid\slide@footins\else
351 \vskip\skip\slide@footins
352 \footnoterule
353 \unvbox\slide@footins
354 \fi
355 \vskip\z@}}
356 \else
357 \setbox\@slidebox\vbox to \slide@vsize{{%
358 \@begindvi % added 1997/04/15 SPQR
359 \unvbox\@cclv
360 \ifvoid\slide@footins\vfil\else
361 \vfil\vskip\skip\slide@footins
362 \footnoterule
363 \unvbox\slide@footins
364 \fi
365 \vskip\z@}}%
366 \fi
367 }%
368 }
369 {}
370 % \end{macrocode}
371 %
372 % If powersem is asked to calculate the slide dimensions...
373 % \begin{macrocode}
374 \def\relax@PS{\relax}
375
376 \ifthenelse{\boolean{calcdim@PS}}
377 {%
378 \AtBeginDocument
379 {%
380 \setlength{\slidewidth}{\paperwidth}%
381 \advance\slidewidth by -\slideleftmargin\relax
382 \advance\slidewidth by -\sliderightmargin\relax
383 \ifx\theslideframe\relax@PS
384 \else
385 \advance\slidewidth by -2\slideframewidth\relax
386 \advance\slidewidth by -2\slideframesep\relax
387 \fi
388 \setlength{\slideheight}{\paperheight}%
389 \advance\slideheight by -\slidetopmargin\relax
390 \advance\slideheight by -\slidebottommargin\relax
391 \ifx\theslideframe\relax@PS
392 \else
393 \advance\slideheight by -2\slideframewidth\relax
394 \advance\slideheight by -2\slideframesep\relax
395 \fi
396 }%
397 }
398 {}
399
400 \AtBeginDocument
401 {%
402 \@ifundefined{headwidth}{}
403 {%
404 \setslidelength{\headwidth}{\paperwidth}%
405 \addtoslidelength{\headwidth}{-\slideleftmargin}%
406 \addtoslidelength{\headwidth}{-\sliderightmargin}%
407 }%
408 }
409 % \end{macrocode}
410 % \Finale
411 \endinput