Debian Codegraph @

texmf-dist/doc/latex/frankenstein/unsupported/drama.sty

raw
1 %^^A* legal notices
2 % \iffalse
3 %
4 % This program is part of the Frankenstein bundle for LaTeX.
5 %
6 % Copyright 1995-2001 Matt Swift <[email protected]>.
7 %
8 % This file contains both the code and documentation for the
9 % drama LaTeX package. It will work ONLY if it is placed in a
10 % proper directory. Files called README, INSTALL, drama.tex
11 % and drama.ins should have also been distributed to you
12 % with this file. See them for more information on how to typeset
13 % the documentation with LaTeX and how to generate a version of this
14 % file that will work faster than this one.
15 %
16 % This program is free software; you may redistribute it and/or
17 % modify it under the conditions of the LaTeX Project Public
18 % License, either version 1.2 or (at your option) any later version.
19 % The latest version of this license is in
20 % http://www.latex-project.org/lppl.txt, and version 1.2 or later is
21 % part of all distributions of LaTeX version 1999/12/01 or later.
22 %
23 % This program is distributed in the hope that it will be useful,
24 % but without any warranty; without even the implied warranty of
25 % merchantability or fitness for a particular purpose. See the
26 % LaTeX Project Public License for more details.
27 %
28 % \fi
29 %
30 %^^A* checks
31 %
32 %^^A NOTE: The character table, with two %'s, will get written to all files.
33 %% \CharacterTable
34 %% {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
35 %% 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
36 %% Digits \0\1\2\3\4\5\6\7\8\9
37 %% Exclamation \! Double quote \" Hash (number) \#
38 %% Dollar \$ Percent \% Ampersand \&
39 %% Acute accent \' Left paren \( Right paren \)
40 %% Asterisk \* Plus \+ Comma \,
41 %% Minus \- Point \. Solidus \/
42 %% Colon \: Semicolon \; Less than \<
43 %% Equals \= Greater than \> Question mark \?
44 %% Commercial at \@ Left bracket \[ Backslash \\
45 %% Right bracket \] Circumflex \^ Underscore \_
46 %% Grave accent \` Left brace \{ Vertical bar \|
47 %% Right brace \} Tilde \~}
48 %
49 % \CheckSum{314}
50 %
51 %^^A** abstract
52 % \begin{abstract}
53 % Defines macros for typesetting a basic production-style stage script.
54 %
55 % This package is useful but may have problems and is unsupported.
56 % \end{abstract}
57 % \tableofcontents
58 %
59 % \part{Discussion}
60 %
61 % I am close to handling the insertion of a ``continued'' message at the top
62 % of the page when a speech is broken across the page. But it's not there
63 % yet.
64 %
65 % \DescribeEnv{script}
66 % This is the only environment so far, for a basic production-style stage
67 % script. It is implemented as a bitstyle: see the \package{bits} package
68 % for details of use. I think you only need to issue an
69 % \cs\author\marg{author's name} and \cs\date\marg{date} command. Also,
70 % create an empty file called \file{bits.cfg} on your system (or put the
71 % \cs\author declaration in it).
72 %
73 % Options come in pairs (boldface is default):
74 % \begin{description}
75 % \item[\textmd{oneact}/multiact] Multiact scripts use act numbers; oneacts
76 % just have scenes.
77 % \end{description}
78 %
79 % \DescribeMacro\character
80 % \cs\character\marg{full description}\marg{name}\marg{csname} defines a new
81 % character. \meta{full description} is used in the dramatis personae
82 % listing. \meta{name} is the name to use to refer to the character in stage
83 % directions, and to introduce their speeches. \cs\character defines a
84 % command |\|\meta{csname} which prints \meta{name} in the font given in
85 % \cs\DirectStyle. Use this in stage directions. It is an abbreviation
86 % macro of category \cat{Character}; following spacing is handled
87 % automatically for you. See the \package{abbrevs} package for details. Also
88 % defined is the command
89 % \DescribeMacro\SpeakAppend
90 % |\|\meta{csname}|says|, which is used to introduce the character's
91 % speeches. The suffix ``says'' can be changed by redefining \cs\SpeakAppend
92 % before using \cs\character. You can also define it before loading the
93 % \package{drama} package.
94 %
95 % \DescribeMacro\scene
96 % \DescribeMacro\act
97 % Use \cs\scene and \cs\act to start acts and scenes.
98 %
99 % \DescribeMacro\direct
100 % \DescribeMacro\setstage
101 % \cs\direct\marg{stage directions}. Use \cs\setstage\marg{stage directions}
102 % at the beginning of scenes and acts.
103 %
104 % \StopEventually{}
105 %
106 % \part{Implementation}
107 %
108 % \section{Version control}
109 %
110 % \begin{macro}{\fileinfo}
111 % \begin{macro}{\DoXUsepackagE}
112 % \begin{macro}{\HaveECitationS}
113 % \begin{macro}{\fileversion}
114 % \begin{macro}{\filedate}
115 % \begin{macro}{\docdate}
116 % \begin{macro}{\PPOptArg}
117 % These definitions must be the first ones in the file.
118 % \begin{macrocode}
119 \def\fileinfo{drama package (Frankenstein's heart)}
120 \def\DoXPackageS {}
121 \def\initelyHavECitationS {}
122 \def\fileversion{v0.2}
123 \def\filedate{1996/05/05}
124 \def\docdate{1996/05/05}
125 \edef\PPOptArg {%
126 \filedate\space \fileversion\space \fileinfo
127 }
128 % \end{macrocode}
129 % \end{macro}
130 % \end{macro}
131 % \end{macro}
132 % \end{macro}
133 % \end{macro}
134 % \end{macro}
135 % \end{macro}
136 %
137 % If we're loading this file from a \cs\ProcessDTXFile command (see the
138 % \package{compsci} package), then \cs\JusTLoaDInformatioN will be defined;
139 % othewise we assume it is not (that's why the FunkY NamE).
140 %
141 % If we're loading from \cs\ProcessDTXFile, we want to load the packages listed
142 % in \cs\DoXPackageS (needed to typeset the documentation for this file) and
143 % then bail out. Otherwise, we're using this file in a normal way as a
144 % package, so do nothing. \cs\DoXPackageS, if there are any, are declared in
145 % the \ext{dtx} file, and, if you're reading the typeset documentation of this
146 % package, would appear just above. (It's OK to call \cs\usepackage with an
147 % empty argument or \cs\relax, by the way.)
148 % \begin{macrocode}
149 \makeatletter% A special comment to help create bst files. Don't change!
150 \@ifundefined{JusTLoaDInformatioN} {%
151 }{% ELSE (we know the compsci package is already loaded, too)
152 \UndefineCS\JusTLoaDInformatioN
153 \SaveDoXVarS
154 \eExpand\csname DoXPackageS\endcsname\In {%use \csname in case it's undefined
155 \usepackage{#1}%
156 }%
157 \RestoreDoXVarS
158 \makeatother
159 \endinput
160 }% A special comment to help create bst files. Don't change!
161 % \end{macrocode}
162 %
163 % Now we check for \LaTeX2e and declare the LaTeX package.
164 % \begin{macrocode}
165 \NeedsTeXFormat{LaTeX2e}
166 \ProvidesPackage{drama}[\PPOptArg]
167 % \end{macrocode}^^A special comment to help create bst files. Don't change!
168 %
169 % ^^A NOTE: We have to compensate for the above backslashes, which are not
170 % ^^A actually in the .dtx file the author works on, by adding to the
171 % ^^A CheckSum.
172 %%
173 % \AddToCheckSum{17}^^A `dtx-update-checksum' automatically handles this.
174 % \AddToCheckSum{7}^^A The half a macrocode env. at the top is missed, however...
175 % \AddToCheckSum{10}^^A ... and so are the 5 \defs from the .dtx file
176 % ^^A that precede it.
177 % \IfCitations {%
178 % \AddToCheckSum{2}^^A When \initelyHavECitationS is defined in
179 % } ^^A the .dtx file, we need 2 more in the CheckSum.
180 %
181 %
182 % \begin{macrocode}
183 \RequirePackage{abbrevs,bits,dialogue,moredefs,relsize}
184 %\RequirePackage{xmark}
185 \let\sc@mark\Gobble
186 \VerboseErrors
187
188 \DeclareBooleanOptions{oneact}{multiact}
189 \ProcessOptions
190 % \end{macrocode}
191 %
192 % \section{characters}
193 %
194 % \begin{macro}{\SpeakAppend}
195 % \begin{macro}{\sc@cast}
196 % \begin{macro}{\character}
197 %
198 % \begin{macrocode}
199 \providecommand\SpeakAppend {says}
200 \ReserveCS\sc@cast
201 \NewUserAbbrevDefiner\NewCharacterAbbrev{Character}
202 \let\TMFontCharacter\scshape
203 \newcommand*\character [3] {% args: dramper name csname
204 \expandafter\NewCharacterAbbrev\csname #3\endcsname{#2}%
205 \NewName* {#3\SpeakAppend} {} {%
206 \speak{#2}%
207 }%
208 \addto@macro\sc@cast{,#1}%
209 }
210 % \end{macrocode}
211 % \end{macro}
212 % \end{macro}
213 % \end{macro}
214 %
215 % The |\@cdr| gets rid of the first silly comma.
216 % \begin{macrocode}
217 \newcommand\DramPer {%
218 \ifx\sc@cast\LongEmpty\else
219 {\larger\scshape Cast}%
220 \relax\begin{verse}
221 \edef\sc@t@a{\E@cdr\sc@cast\@nil}%
222 \@for\sc@t@b:=\sc@t@a \do {%
223 \sc@t@b\\%
224 }%
225 \relax\end{verse}%
226 % \end{macrocode}
227 % Prepare for another set of characters.
228 % \begin{macrocode}
229 \InitCS\sc@cast
230 \bigbreak
231 \fi
232 }
233 % \end{macrocode}
234 %
235 % \subsubsection{sectioning}
236 %
237 % \begin{macro}{\sc@toks@saved@output}
238 % We pull some fancy stuff with the output routine here. The algorithm is a
239 % simpler version of Knuth's \cite[260ff]{knuth:texbook}.
240 % \begin{macrocode}
241 \newtokens\sc@toks@saved@output
242 \sc@toks@saved@output=\output
243 % \end{macrocode}
244 % \end{macro}
245 %
246 % The |\sc@botmark|, if not empty, will contain text to be inserted at the top
247 % of the next page. It must contain vertical not horizontal material.
248 %
249 % We actually need to communicate the boolean |sc@directing| via the mark,
250 % because only the information in the marks is guaranteed to reflect the state
251 % at the end of the page, and not several lines later.
252 % \begin{macrocode}
253 \providelength\sc@len
254
255 \newcommand\sc@outputwrapper {%
256 \setlength{\sc@len}{\dp255}%
257 \the\sc@toks@saved@output
258 \def\sc@t@b {%
259 \sc@botmark
260 \addtolength{\sc@len}{-\prevdepth}%
261 \kern\sc@len
262 }%
263 \InitCS\sc@t@a
264 \ifx\sc@botmark\ShortEmpty
265 \let\sc@t@a\sc@t@b
266 \else
267 \ifsc@directing
268 \let\sc@t@a\sc@t@b
269 \fi
270 \fi
271 \sc@t@a
272 }
273 \newcommand\script {%
274 \MakeDirectTakeArg
275 \relax\begin{Script}%
276 }
277 \NewName{endscript} {} {%
278 \relax\end{Script}%
279 }
280 \NewName{script*} {} {%
281 \MakeDirectTakeNoArg
282 \relax\begin{Script}%
283 }
284 \NewName{endscript*} {} {%
285 \relax\end{Script}%
286 }
287 \newcommand\sc@make@begin@bit@D [2] {% args: bitstyle copystyle
288 \DefName{sc@begin@bit@#1@#2}{##1##2} {%
289 \def\BitStyle{#1}%
290 \sc@begin@bit@common{##1}{##2}%
291 \PreBitAll
292 %
293 % \ClaimXMarkTwo
294 % \FrankenInfo{drama}{The script environment is changing \protect\output.}%
295 % \output={\sc@outputwrapper}%
296 % \let\maxdepth\maxdimen
297 % \let\@maxdepth\maxdimen
298 \if@oneact@
299 \def\thepage {%
300 \arabic{bitbitbit}\hspace{\@ne em}\arabic{page}%
301 }%
302 \else
303 \def\thepage {%
304 \arabic{bitbit}--\arabic{bitbitbit}\hspace{\@ne em}\arabic{page}%
305 }%
306 \fi
307 \DramPer
308 %
309 \@nameuse{PreBit#1}%
310 }%
311 }
312 \newcommand\sc@make@end@bit@D [2] {% args: bitstyle copystyle
313 \DefName{sc@end@bit@#1@#2}{##1} {%
314 \sc@possiblyfinishdirecting
315 \TheEnd
316 \FrankenInfo{drama}{\protect\output is back to normal now.}%
317 }%
318 }
319 \NewBitstyle{Script}
320 \PromulgateComponentAcrossCopystyles{end@bit}{D}{Script}
321 \PromulgateComponentAcrossCopystyles{begin@bit}{D}{Script}
322
323 \newcommand\act {%
324 \sc@possiblyfinishdirecting
325 \sc@mark{\ShortEmpty}%
326 \stepcounter{bitbit}%
327 \pagebreak[3]%
328 \bigskip
329 \centerline{\relsize{2}Act \thebitbit}%
330 \par
331 \nobreak
332 \smallskip
333 }
334 \newcommand\scene {%
335 \sc@possiblyfinishdirecting
336 \sc@mark{\ShortEmpty}%
337 \stepcounter{bitbitbit}%
338 \pagebreak[3]%
339 \bigskip
340 \centerline{\relsize{1}Scene \thebitbitbit}%
341 \par
342 \nobreak
343 \smallskip
344 }
345 % \end{macrocode}
346 %
347 % \subsubsection{speakers and stage directions}
348 %
349 % \begin{macrocode}
350 \newlength{\halfacross}
351 \setlength{\halfacross}{\textwidth}
352 \divide\halfacross by 2
353 \newlength{\quarteracross}
354 \setlength{\quarteracross}{\textwidth}
355 \divide\quarteracross by 4
356
357 \newenvironment{DramaTab} [1] {%
358 \relax\begin{list}{} {%
359 \setlength{\leftmargin}{#1}%
360 \setlength{\listparindent}{\z@}%
361 \sloppy
362 }%
363 \item\relax
364 }{%
365 \relax\end{list}%
366 }
367 \newcommand\setstage [1] {%
368 \relax\begin{DramaTab}{\halfacross}%
369 \DirectStyle
370 \DirectOpen
371 \ignorespaces
372 #1%
373 \unskip
374 \DirectClose
375 \relax\end{DramaTab}%
376 }
377 % \end{macrocode}
378 %
379 % It is a question of style whether to announce the speaker's name a second
380 % time, if his speech continues after a stage direction in a paragraph by
381 % itself. If the page breaks immediately before the stage direction, or
382 % duringit, no continuation message will be given. If it breaks after the
383 % stage direction, and before the next speaker is announced with the |\speak|
384 % command, a continuation message appropriate to the speaker \emph{before} the
385 % stage direction is given. Of course, sectioning commands will cancel any
386 % continuation messages.
387 %
388 % Communicating via the mark is giving me a problem. I need to solve this
389 % problem and replace @sc@bool with mark information.
390 %
391 % Also, when using the no-argument form on a source with arguments, you cannot
392 % swallow the spaces with |\ignorespaces|, because the open brace shields them.
393 %
394 % There are problems with certain combinations of taking arguments and
395 % reannouncing speakers after a stage direction. I should draw a chart, and
396 % see how I can handle things.
397 % \begin{macro}{\DirectOpen}
398 % \begin{macro}{\DirectClose}
399 % \mbox{}
400 % \begin{macrocode}
401 \newcommand\DirectOpen {\textrm{(}}
402 \newcommand\DirectClose {\textrm{)}}
403 % \end{macrocode}
404 % \end{macro}
405 % \end{macro}
406 %
407 % \begin{macrocode}
408 \newboolean{sc@directing}
409
410 \newcommand*\DirectNoArg {%
411 \sc@noargs@finishdirecting
412 \sc@direct
413 }
414 \newcommand\DirectWithArg [1] {%
415 \sc@args@finishdirecting
416 \sc@direct
417 #1%
418 \sc@really@finishdirecting
419 }
420 \newcommand\sc@direct {%
421 \global\let\sc@lastmark\sc@themark
422 \sc@mark{\ShortEmpty}%
423 \sc@directingtrue
424 \pagebreak[0]% mild encouragement
425 \relax\begin{DramaTab}{\quarteracross}%
426 \DirectStyle
427 \DirectOpen
428 \ignorespaces
429 }
430 \newcommand\sc@really@finishdirecting {%
431 \unskip
432 \DirectClose
433 \relax\end{DramaTab}
434 \sc@directingfalse
435 % \sc@mark\expandafter{\sc@lastmark}% FIXME:
436 }
437 % \end{macrocode}
438 % Looks like args version is null.
439 % \begin{macrocode}
440 \ReserveCS\sc@args@finishdirecting
441 \newcommand\sc@noargs@finishdirecting {%
442 \ifsc@directing
443 \sc@really@finishdirecting
444 \fi
445 }
446 \ReserveCS\sc@possiblyfinishdirecting
447 \newcommand\MakeDirectTakeArg {%
448 \let\sc@possiblyfinishdirecting\sc@args@finishdirecting
449 \let\direct\DirectWithArg
450 }
451 \newcommand\MakeDirectTakeNoArg {%
452 \let\sc@possiblyfinishdirecting\sc@noargs@finishdirecting
453 \let\direct\DirectNoArg
454 }
455 % \end{macrocode}
456 %
457 % \todo{Do penalties better?}
458 %
459 % \begin{macro}{\GiveSpeaker}
460 % \begin{macrocode}
461 \newcommand\GiveSpeaker [1] {%
462 \par
463 \centerline{\textsc{#1}}%
464 }
465 % \end{macrocode}
466 % \end{macro}
467 %
468 % \begin{macro}{\GiveSpeakerContinued}
469 % The space is explicit for clarity.
470 % \begin{macrocode}
471 \newcommand\GiveSpeakerContinued [1] {%
472 \GiveSpeaker{#1\space\rlap{\textsl{(continued)}}}%
473 }
474 \newcommand\speak [1] {%
475 \sc@possiblyfinishdirecting
476 \sc@mark{\ShortEmpty}%
477 \pagebreak[2]%
478 \smallskip
479 \sc@mark{\GiveSpeakerContinued{#1}}%
480 \GiveSpeaker{#1}%
481 \par
482 \nopagebreak
483 \noindent
484 }
485 % \end{macrocode}
486 % \end{macro}
487 %
488 % \Finale