The drama package

drama package

                 Matt Swift <swift@bu.edu>

Version: v0.1 Documentation revision: 1996/05/05

Abstract

This package is unsupported and incomplete. It seems to work for a basic production-style stage script, but no guarantees.

I do intend to transform this in to a full-featured, supported package for writing scripts of all kinds. But I don’t know when I will get to it.

Part I

Discussion

I am close to handling the insertion of a “continued” message at the top of the page when a speech is broken across the page. But it’s not there yet.

script This is the only environment so far, for a basic production-style stage script. It is implemented as a bitstyle: see the bits package for details of use. I think you only need to issue an \author {⟨author’s name⟩} and \datedate command. Also, create an empty file called bits.cfg on your system (or put the \author declaration in it).

Options come in pairs (boldface is default):

oneact/multiact Multiact scripts use act numbers; oneacts just have scenes.

\character \character {⟨full description⟩}namecsname defines a new character. ⟨full description⟩ is used in the dramatis personae listing. ⟨name⟩ is the name to use to refer to the character in stage directions, and to introduce their speeches. \character defines a command ⟨“csname⟩ which prints ⟨name⟩ in the font given in \DirectStyle. Use this in stage directions. It is an abbreviation macro of category Character; following spacing is handled automatically for you. See the abbrevs package for details. Also defined is the command

\SpeakAppend ⟨“csname⟩says, which is used to introduce the character’s speeches. The suffix

“says” can be changed by defining \SpeakAppend before using \character. \scene Use \scene and \act to start acts and scenes.

\act \direct{⟨stage directions⟩}. Use \setstagestage directions at the beginning

\direct
\setstage

of scenes and acts.

Part II

Implementation

1 Version control

\fileinfo \fileversion \filedate \docdate \PPOptArg These definitions must be the first ones in the file.
 1 \def\fileinfo{drama package}
 2 \def\DoXNeeDME{}
 3 \def\fileversion{v0.1}
 4 \def\filedate{1996/05/05}
 5 \def\docdate{1996/05/05}
 6 \edef\PPOptArg {%
 7 \filedate\space \fileversion\space \fileinfo
 8 }

Stop right here if we’re just loading the file’s information, and don’t want to load this code for typesetting its documentation (only makes sense for certain packages). The JuStLaAdInFoRmAtIoN flag will be set by the documentation driver; the DoXNeeDME flag will be set in the dtx file, and will appear above if it’s set.

 9 \makeatletter
10 \@ifundefined{JuStLoAdInFoRmAtIoN} {%
11 }{% ELSE
12 \@ifundefined{DoXNeeDME} {%
13  }{% ELSE
14  \UndefineCS\JuStLoAdInFoRmAtIoN
15  \usepackage{drama}%

16 }

17 \makeatother
18 \endinput

19 }

Now we check for L^{A}TEX2e and declare the package.

20 \NeedsTeXFormat{LaTeX2e}
21 \ProvidesPackage{drama}[\PPOptArg]
22 \RequirePackage{abbrevs,bits,dialogue,moredefs,relsize}
23 %\RequirePackage{xmark}
24 \let\sc@mark\Gobble
25 \VerboseErrors

26

27 \DeclareBooleanOptions{oneact}{multiact}
28 \ProcessOptions

2 characters

\SpeakAppend
\sc@cast
\character

29 \providecommand\SpeakAppend {says}
30 \ReserveCS\sc@cast
31 \NewUserAbbrevDefiner\NewCharacterAbbrev{Character}
32 \let\TMFontCharacter\scshape
33 \newcommand*\character [3] {% args: dramper name csname

34 \expandafter\NewCharacterAbbrev\csname #3\endcsname{#2}%
35 \NewName* {#3\SpeakAppend} {} {%
36  \speak{#2}%
37 }%
38 \addto@macro\sc@cast{,#1}%

39 }

The \@cdr gets rid of the first silly comma.

40 \newcommand\DramPer {%
41 \ifx\sc@cast\LongEmpty\else
42  {\larger\scshape Cast}%
43  \relax\begin{verse}
44  \edef\sc@t@a{\E@cdr\sc@cast\@nil}%
45  \@for\sc@t@b:=\sc@t@a \do {%
46  \sc@t@b\\%
47  }%
48  \relax\end{verse}%

Prepare for another set of characters.

49  \InitCS\sc@cast
50  \bigbreak
51 \fi

52 }

2.0.1 sectioning

\sc@toks@saved@output We pull some fancy stuff with the output routine here. The algorithm is a simpler version of Knuth’s [?, 260ff].

53 \newtokens\sc@toks@saved@output
54 \sc@toks@saved@output=\output

The \sc@botmark, if not empty, will contain text to be inserted at the top of the next page. It must contain vertical not horizontal material.

We actually need to communicate the boolean sc@directing via the mark, because only the information in the marks is guaranteed to reflect the state at the end of the page, and not several lines later.

55 \providelength\sc@len

56

57 \newcommand\sc@outputwrapper {%
58 \setlength{\sc@len}{\dp255}%
59 \the\sc@toks@saved@output
60 \def\sc@t@b {%
61  \sc@botmark
62  \addtolength{\sc@len}{-\prevdepth}%
63  \kern\sc@len
64 }%
65 \InitCS\sc@t@a
66 \ifx\sc@botmark\ShortEmpty
67  \let\sc@t@a\sc@t@b
68 \else
69  \ifsc@directing
70  \let\sc@t@a\sc@t@b
71  \fi
72 \fi

73 \sc@t@a

74 }

75 \newcommand\script {%
76 \MakeDirectTakeArg
77 \relax\begin{Script}%

78 }

79 \NewName{endscript} {} {%
80 \relax\end{Script}%

81 }

82 \NewName{script*} {} {%
83 \MakeDirectTakeNoArg
84 \relax\begin{Script}%

85 }

86 \NewName{endscript*} {} {%
87 \relax\end{Script}%

88 }

89 \newcommand\sc@make@begin@bit@D [2] {% args: bitstyle copystyle
90 \DefName{sc@begin@bit@#1@#2}{##1##2} {%
91  \def\BitStyle{#1}%
92  \sc@begin@bit@common{##1}{##2}%
93  \PreBitAll

94 %

95 %    \ClaimXMarkTwo
96 %    \MonsterInfo{drama}{The script environment is changing \protect\output.}%
97 %    \output={\sc@outputwrapper}%
98 %    \let\maxdepth\maxdimen
99 %    \let\@maxdepth\maxdimen
100  \if@oneact@
101  \def\thepage {%
102  \arabic{bitbitbit}\hspace{\@ne em}\arabic{page}%

103 }%

104  \else
105  \def\thepage {%
106  \arabic{bitbit}--\arabic{bitbitbit}\hspace{\@ne em}\arabic{page}%

107 }%

108  \fi
109  \DramPer

110 %

111  \@nameuse{PreBit#1}%

112 }% 113 }

114 \newcommand\sc@make@end@bit@D [2]  {% args: bitstyle copystyle
115 \DefName{sc@end@bit@#1@#2}{##1} {%
116  \sc@possiblyfinishdirecting
117  \TheEnd
118  \MonsterInfo{drama}{\protect\output is back to normal now.}%

119 }% 120 }

121 \NewBitstyle{Script}
122 \PromulgateComponentAcrossCopystyles{end@bit}{D}{Script}
123 \PromulgateComponentAcrossCopystyles{begin@bit}{D}{Script}

124

125 \newcommand\act {%
126 \sc@possiblyfinishdirecting

127 \sc@mark{\ShortEmpty}%
128 \stepcounter{bitbit}%
129 \pagebreak[3]%
130 \bigskip
131 \centerline{\relsize{2}Act \thebitbit}%
132 \par
133 \nobreak
134 \smallskip

135 }

136 \newcommand\scene {%
137 \sc@possiblyfinishdirecting
138 \sc@mark{\ShortEmpty}%
139 \stepcounter{bitbitbit}%
140 \pagebreak[3]%
141 \bigskip
142 \centerline{\relsize{1}Scene \thebitbitbit}%
143 \par
144 \nobreak
145 \smallskip

146 }

2.0.2 speakers and stage directions

147 \newlength{\halfacross}
148 \setlength{\halfacross}{\textwidth}
149 \divide\halfacross by 2
150 \newlength{\quarteracross}
151 \setlength{\quarteracross}{\textwidth}
152 \divide\quarteracross by 4

153

154 \newenvironment{DramaTab} [1] {%
155  \relax\begin{list}{} {%
156  \setlength{\leftmargin}{#1}%
157  \setlength{\listparindent}{\z@}%
158  \sloppy

159 }%

160  \item\relax
161 }{%
162 \relax\end{list}%

163 }

164 \newcommand\setstage [1] {%
165 \relax\begin{DramaTab}{\halfacross}%
166  \DirectStyle
167  \DirectOpen
168  \ignorespaces
169  #1%
170  \unskip
171  \DirectClose
172 \relax\end{DramaTab}%

173 }

It is a question of style whether to announce the speaker’s name a second time, if his speech continues after a stage direction in a paragraph by itself. If the page breaks immediately before the stage direction, or duringit, no continuation message will be given. If it breaks after the stage direction, and before the next speaker is announced with the \speak command, a continuation message appropriate to the speaker before the stage direction is given. Of course, sectioning commands will cancel any continuation messages.

Communicating via the mark is giving me a problem. I need to solve this problem and replace @sc@bool with mark information.

Also, when using the no-argument form on a source with arguments, you cannot swallow the spaces with \ignorespaces, because the open brace shields them.

There are problems with certain combinations of taking arguments and reannouncing speakers after a stage direction. I should draw a chart, and see how I can handle things.

\DirectOpen
\DirectClose
174 \newcommand\DirectOpen {\textrm{(}}
175 \newcommand\DirectClose {\textrm{)}}
176 \newboolean{sc@directing}

177

178 \newcommand*\DirectNoArg {%
179 \sc@noargs@finishdirecting
180 \sc@direct

181 }

182 \newcommand\DirectWithArg [1] {%
183 \sc@args@finishdirecting
184 \sc@direct
185 #1%
186 \sc@really@finishdirecting

187 }

188 \newcommand\sc@direct {%
189 \global\let\sc@lastmark\sc@themark
190 \sc@mark{\ShortEmpty}%
191 \sc@directingtrue
192 \pagebreak[0]% mild encouragement
193 \relax\begin{DramaTab}{\quarteracross}%
194  \DirectStyle
195  \DirectOpen
196  \ignorespaces

197 }

198 \newcommand\sc@really@finishdirecting {%
199 \unskip
200 \DirectClose
201 \relax\end{DramaTab}
202 \sc@directingfalse
203 %  \sc@mark\expandafter{\sc@lastmark}% FIXME:

204 }

Looks like args version is null.

205 \ReserveCS\sc@args@finishdirecting
206 \newcommand\sc@noargs@finishdirecting {%
207 \ifsc@directing
208  \sc@really@finishdirecting
209 \fi

210 }

211 \ReserveCS\sc@possiblyfinishdirecting
212 \newcommand\MakeDirectTakeArg {%

213 \let\sc@possiblyfinishdirecting\sc@args@finishdirecting
214 \let\direct\DirectWithArg

215 }

216 \newcommand\MakeDirectTakeNoArg {%
217 \let\sc@possiblyfinishdirecting\sc@noargs@finishdirecting
218 \let\direct\DirectNoArg

219 }

To do: Do penalties better?

\GiveSpeaker
220 \newcommand\GiveSpeaker [1] {%
221 \par
222 \centerline{\textsc{#1}}%

223 }

\GiveSpeakerContinued The space is explicit for clarity.

224 \newcommand\GiveSpeakerContinued [1] {%
225 \GiveSpeaker{#1\space\rlap{\textsl{(continued)}}}%

226 }

227 \newcommand\speak [1] {%
228 \sc@possiblyfinishdirecting
229 \sc@mark{\ShortEmpty}%
230 \pagebreak[2]%
231 \smallskip
232 \sc@mark{\GiveSpeakerContinued{#1}}%
233 \GiveSpeaker{#1}%
234 \par
235 \nopagebreak
236 \noindent

237 }

Index

Numbers written in italic refer to the page where the corresponding entry is described, the ones underlined to the code line of the definition, the rest to the code lines where the entry is used.

act=  \subitem *+\act+, \usage{1}, 125
macro=  \subitem macro+, 38
addtolength=  \subitem *+\addtolength+, 62
arabic=  \subitem *+\arabic+, 102, 106
begin=  \subitem *+\begin+, 43, 77, 84, 155, 165, 193
bigbreak=  \subitem *+\bigbreak+, 50
bigskip=  \subitem *+\bigskip+, 130, 141
BitStyle=  \subitem *+\BitStyle+, 91
centerline=  \subitem *+\centerline+, 131, 142, 222
character=  \subitem *+\character+, \usage{1}, \main{29}
ClaimXMarkTwo=  \subitem *+\ClaimXMarkTwo+, 95
csname=  \subitem *+\csname+, 34
DeclareBooleanOptions=  \subitem *+\DeclareBooleanOptions+, 27
def=  \subitem *+\def+, 1--5, 60, 91, 101, 105
DefName=  \subitem *+\DefName+, 90, 115
direct=  \subitem *+\direct+, \usage{1}, 214, 218
DirectClose=  \subitem *+\DirectClose+, 171, \main{174}, 200
DirectNoArg=  \subitem *+\DirectNoArg+, 178, 218
DirectOpen=  \subitem *+\DirectOpen+, 167, \main{174}, 195
DirectStyle=  \subitem *+\DirectStyle+, 166, 194
DirectWithArg=  \subitem *+\DirectWithArg+, 182, 214
divide=  \subitem *+\divide+, 149, 152
do=  \subitem *+\do+, 45
docdate=  \subitem *+\docdate+, \main{1}
DoXNeeDME=  \subitem *+\DoXNeeDME+, 2
dp=  \subitem *+\dp+, 58
DramPer=  \subitem *+\DramPer+, 40, 109
cdr=  \subitem cdr+, 44
edef=  \subitem *+\edef+, 6, 44
else=  \subitem *+\else+, 41, 68, 104
end=  \subitem *+\end+, 48, 80, 87, 162, 172, 201
endcsname=  \subitem *+\endcsname+, 34
endinput=  \subitem *+\endinput+, 18

environments:¿script, 1

expandafter=  \subitem *+\expandafter+, 34, 203
fi=  \subitem *+\fi+, 51, 71, 72, 108, 209
filedate=  \subitem *+\filedate+, \main{1}
fileinfo=  \subitem *+\fileinfo+, \main{1}
fileversion=  \subitem *+\fileversion+, \main{1}
GiveSpeaker=  \subitem *+\GiveSpeaker+, \main{220}, 225, 233
GiveSpeakerContinued=  \subitem *+\GiveSpeakerContinued+, \main{224}
global=  \subitem *+\global+, 189

                          Gobble=  \subitem *+\Gobble+, 24
                          halfacross=  \subitem *+\halfacross+, 147--149, 165
                          hspace=  \subitem *+\hspace+, 102, 106
                          directing=  \subitem directing+, 69, 207
                          ifx=  \subitem *+\ifx+, 41, 66
                          ignorespaces=  \subitem *+\ignorespaces+, 168, 196
                          InitCS=  \subitem *+\InitCS+, 49, 65
                          item=  \subitem *+\item+, 160
                          JuStLoAdInFoRmAtIoN=  \subitem *+\JuStLoAdInFoRmAtIoN+, 14
                          kern=  \subitem *+\kern+, 63
                          larger=  \subitem *+\larger+, 42
                          leftmargin=  \subitem *+\leftmargin+, 156
                          let=  \subitem *+\let+, 24, 32, 67, 70, 98, 99, 189, 213, 214, 217, 218
                          listparindent=  \subitem *+\listparindent+, 157
                          LongEmpty=  \subitem *+\LongEmpty+, 41
                          makeatletter=  \subitem *+\makeatletter+, 9
                          makeatother=  \subitem *+\makeatother+, 17
                          MakeDirectTakeArg=  \subitem *+\MakeDirectTakeArg+, 76, 212
                          MakeDirectTakeNoArg=  \subitem *+\MakeDirectTakeNoArg+, 83, 216
                          maxdepth=  \subitem *+\maxdepth+, 98
                          maxdimen=  \subitem *+\maxdimen+, 98, 99
                          MonsterInfo=  \subitem *+\MonsterInfo+, 96, 118
                          NeedsTeXFormat=  \subitem *+\NeedsTeXFormat+, 20
                          NewBitstyle=  \subitem *+\NewBitstyle+, 121
                          newboolean=  \subitem *+\newboolean+, 176
                          NewCharacterAbbrev=  \subitem *+\NewCharacterAbbrev+, 31, 34
                          newcommand=  \subitem *+\newcommand+, 33, 40, 57, 75, 89, 114, 125, 136, 164,174,

175, 178, 182, 188, 198, 206, 212, 216, 220, 224, 227

                          newenvironment=  \subitem *+\newenvironment+, 154
                          newlength=  \subitem *+\newlength+, 147, 150
                          NewName=  \subitem *+\NewName+, 35, 79, 82, 86
                          newtokens=  \subitem *+\newtokens+, 53
                          NewUserAbbrevDefiner=  \subitem *+\NewUserAbbrevDefiner+, 31
                          nobreak=  \subitem *+\nobreak+, 133, 144
                          noindent=  \subitem *+\noindent+, 236
                          nopagebreak=  \subitem *+\nopagebreak+, 235
                          output=  \subitem *+\output+, 54, 96, 97, 118

                                                   pagebreak=  \subitem *+\pagebreak+, 129, 140, 192, 230
                                                   par=  \subitem *+\par+, 132, 143, 221, 234
                                                   PPOptArg=  \subitem *+\PPOptArg+, \main{1}, 21
                                                   PreBitAll=  \subitem *+\PreBitAll+, 93
                                                   prevdepth=  \subitem *+\prevdepth+, 62
                                                   ProcessOptions=  \subitem *+\ProcessOptions+, 28
                                                   PromulgateComponentAcrossCopystyles=  \subitem *+\PromulgateComponentAcrossCopystyles+, 122, 123
                                                   protect=  \subitem *+\protect+, 96, 118
                                                   providecommand=  \subitem *+\providecommand+, 29
                                                   providelength=  \subitem *+\providelength+, 55
                                                   ProvidesPackage=  \subitem *+\ProvidesPackage+, 21
                                                   quarteracross=  \subitem *+\quarteracross+, 150--152, 193
                                                   relax=  \subitem *+\relax+, 43, 48, 77, 80, 84, 87, 155, 160, 162, 165, 172,193,

201

                                                   relsize=  \subitem *+\relsize+, 131, 142
                                                   RequirePackage=  \subitem *+\RequirePackage+, 22, 23
                                                   ReserveCS=  \subitem *+\ReserveCS+, 30, 205, 211
                                                   rlap=  \subitem *+\rlap+, 225
                                                   botmark=  \subitem botmark+, 61, 66
                                                   cast=  \subitem cast+, \main{29}, 41, 44, 49
                                                   direct=  \subitem direct+, 180, 184, 188
                                                   directingfalse=  \subitem directingfalse+, 202
                                                   directingtrue=  \subitem directingtrue+, 191
                                                   lastmark=  \subitem lastmark+, 189, 203
                                                   len=  \subitem len+, 55, 58, 62, 63
                                                   mark=  \subitem mark+, 24, 127, 138, 190, 203, 229, 232
                                                   outputwrapper=  \subitem outputwrapper+, 57, 97
                                                   possiblyfinishdirecting=  \subitem possiblyfinishdirecting+, 116, 126, 137, 211, 213, 217,228
                                                   themark=  \subitem themark+, 189
                                                   scene=  \subitem *+\scene+, \usage{1}, 136
                                                   script=  \subitem *+\script+, 75

script=script (en-

vironment), 1

                                                   scshape=  \subitem *+\scshape+, 32, 42
                                                   setlength=  \subitem *+\setlength+, 58, 148, 151, 156, 157
                                                   setstage=  \subitem *+\setstage+, \usage{1}, 164
                                                   ShortEmpty=  \subitem *+\ShortEmpty+, 66, 127, 138, 190, 229
                                                   sloppy=  \subitem *+\sloppy+, 158
                                                   smallskip=  \subitem *+\smallskip+, 134, 145, 231
                                                   space=  \subitem *+\space+, 7, 225
                                                   speak=  \subitem *+\speak+, 36, 227
                                                   SpeakAppend=  \subitem *+\SpeakAppend+, \usage{1}, \main{29}
                                                   stepcounter=  \subitem *+\stepcounter+, 128, 139
                                                   textrm=  \subitem *+\textrm+, 174, 175

textsc=  \subitem *+\textsc+, 222
textsl=  \subitem *+\textsl+, 225
textwidth=  \subitem *+\textwidth+, 148, 151
the=  \subitem *+\the+, 59
thebitbit=  \subitem *+\thebitbit+, 131
thebitbitbit=  \subitem *+\thebitbitbit+, 142

                          TheEnd=  \subitem *+\TheEnd+, 117
                          thepage=  \subitem *+\thepage+, 101, 105
                          TMFontCharacter=  \subitem *+\TMFontCharacter+, 32
                          UndefineCS=  \subitem *+\UndefineCS+, 14
                          unskip=  \subitem *+\unskip+, 170, 199

                                                   usepackage=  \subitem *+\usepackage+, 15
                                                   VerboseErrors=  \subitem *+\VerboseErrors+, 25
                                                   =  \subitem +, 157