-
Notifications
You must be signed in to change notification settings - Fork 0
/
screenplayer.cls
405 lines (356 loc) · 11.4 KB
/
screenplayer.cls
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
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{screenplayer}[2010/04/30 Class for Scripts]
% A LaTeX-Class for Scripts
%
% Currently supported typical types of scripts:
% theatre, theater, motionpicture, movie, cabaret, sitcom, comedy, radioplay
%
% Special parameters:
% plain (strips all special commands)
%
% Packages needed
%
\RequirePackage{ifthen}
\usepackage[T1]{fontenc}
\usepackage[a4paper]{geometry}
%
% General rules
%
\renewcommand*\familydefault{\ttdefault}%standard font: typewriter
\renewcommand{\normalsize}{\fontsize{12pt}{10pt}\selectfont}%fontsize 12pt
\pagenumbering{arabic}%for now: arabic numbers
\setlength{\parskip}{\baselineskip}
\pretolerance=500 % acceptable "badness" before trying to hyphenate
\tolerance=10000 % acceptable "badness" of a line
\linepenalty=0 % penalty for each line in a paragraph
\adjdemerits=0 % demerits for adjacent tight and loose line juxtapositions
\finalhyphendemerits=0 % demerits for hyphenating the penultimate line
\doublehyphendemerits=0 % demerits for hyphenating consecutive lines
\hbadness=10000 % avoid useless underfull hbox messages
\newdimen\lineskip \lineskip=12bp % 6 lines per inch
\newdimen\charwid {\setbox0=\hbox{M} \global\charwid=\wd0}
\baselineskip=\lineskip % 2\lineskip for sitcoms
\spaceskip=\charwid % for true typewriter spacing (redundant in cmtt)
\xspaceskip=2\charwid % for two spaces after a sentence (redundant in cmtt)
\parindent 0pt
\splittopskip=\topskip
\splitmaxdepth=\maxdepth
\newdimen\rightmar
\newcommand{\hotzone}{8\charwid} % right margin hotzone
\newcommand{\margins}[2]
{%
\leftskip=#1
\rightmar=\hsize \advance\rightmar by -\leftskip \advance\rightmar by -#2
\rightskip=\rightmar plus \hotzone
}
%
% Global dimensions
%
\newdimen{\sppagenumbermargintopbottom}
\newdimen{\sppagenumbermarginleftright}
\newdimen{\spmarginleft}
\newdimen{\spmarginright}
\newdimen{\spmargintop}
\newdimen{\spmarginbottom}
\newdimen{\spcharnamemarginleft}
\newdimen{\spcharnamemarginright}
\newdimen{\spdialoguemarginleft}
\newdimen{\spdialoguemarginright}
\newdimen{\spparenmarginleft}
\newdimen{\spparenmarginright}
%
% Global strings
%
\newcommand{\splastspeaker}{}%who spoke last? we're keeping track
\newcommand{\scripttype}{oscar} %which type of script?
\newcommand{\spspeechfurthermark}{}%marker for dialogues that will continue e.g. (MORE)
\newcommand{\spspeechcontdmark}{}% marker for continuing dialogs e.g. (CONT'D)
\newcommand{\sppagenumbervalign}{}%page number vertical align: top / bottom
\newcommand{\sppagenumberhalign}{}%page number horiz. align: left / center / right
\newcommand{\sppagenumberdecoration}{}%deco for page number: point / line ('1.' / '-1-')
\newcommand{\spheadlinetype}{}%what to show in the headline?: title
%variables for block-splitting
\newcommand{\spsplitblockfurthermark}{}%text to mark split at the end of a page
\newcommand{\spsplitblockcontdmark}{}%text to mark split at the beginning of a page
%
% Customizing the dimensions according to the specifications for
% each format
%
\newcommand{\screenplayer}
{
\ifthenelse{\equal {\scripttype} {oscar}}
{
%Script according to Oscar
%Paper: US Letter
% Normal left 1,5 inches
\spmarginleft=1.5in
% Normal right 1 inch
\spmarginright=1.0in
% Normal Top 1 inch
\spmargintop=1.0in
% Normal Bottom 0.5 - 1.5 inches
\spmarginbottom=0.5in
% Pagenumber top 0.5 inches
\sppagenumbermargintopbottom=0.5in
\gdef\sppagenumbervalign{top}
% Pagenumber right 1.0 inches
\sppagenumbermarginleftright=1.0in
\gdef\sppagenumberhalign{right}
% Font Courier 12 point 10 pitch (non-proportional)
\fontsize{12pt}{10pt}
% dialogue
% left 3 inches - normal left 1,5 inches = 1,5 inches
\spdialoguemarginleft=1.5in
% right 2.5 inches - normal right 1 inch = 1.5 inches
\spdialoguemarginright=1.5in
% character name
% left 4.2 inches - normal left 1.5 inches = 2.7 inches
\spcharnamemarginleft=2.7in
\spcharnamemarginright=\spdialoguemarginright
% parantheticals
% 0.5 inches left from char-name (3.7 inches) - normal left 1.5 inches = 2.2 inches
\spparenmarginleft=2.2in
% wide 1.5 inches
% other standards
\gdef\spspeechcontdmark{(CONT'D)}%(CONT'D)
\gdef\speechfurthermark{(MORE)}%(MORE)
\gdef\sppagenumberdecoration{}%pagenumber without decoration
\gdef\spheadlinetype{}%no title or whatsoever in the headline
}{}
\ifthenelse{\equal {\scripttype} {bbccinema}}
{
%BBC Movie Screenplay
}{}
\ifthenelse{\equal {\scripttype} {bbctv}}
{
%BBC TV Screenplay
}{}
\ifthenelse{\equal {\scripttype} {bbctvdrama}}
{
%BBC TV Taped Drama
}{}
\ifthenelse{\equal {\scripttype} {bbctvsitcom}}
{
%BBC TV Taped Sitcom
}{}
\ifthenelse{\equal {\scripttype} {bbctvlive}}
{
%BBC TV Taped-Live
}{}
\ifthenelse{\equal {\scripttype} {bbctvus3}}
{
%BBC TV US Three Cameras
}{}
\ifthenelse{\equal {\scripttype} {bbcradiocue}}
{
%BBC Radio Cue Style
}{}
\ifthenelse{\equal {\scripttype} {bbcradioscene}}
{
%BBC Radio Scene Style
}{}
\ifthenelse{\equal {\scripttype} {bbcradiousdrama}}
{
%BBC Radio US Drama
}{}
\ifthenelse{\equal {\scripttype} {bbcstageuk}}
{
%BBC Stage UK
}{}
\ifthenelse{\equal {\scripttype} {bbcstageus}}
{
%BBC Stage US
}{}
}
%
% Output-Routine rewritten
%
\output={%
\dimen0=\textheight% setting the textheight for our output
\ifx\LR\empty \else
\ifx L\LR \setlength{\hoffset}{0.0truein} \gdef\LR{R}
\else \setlength{\hoffset}{0.5truein} \gdef\LR{L}
\fi%
\fi%
%\shipout\vbox to 62\lineskip%
\shipout\vbox to \textheight%
{%
\boxmaxdepth=\maxdepth%
\spheadline%
\sppagebody%
\spfootline%
}%
\unvbox255 \penalty\outputpenalty % put back unused text
\addtocounter{page}{1}
}
\newcommand{\spheadline}
{% Act/scene header and page number
{%
\ifcase1\expandafter\relax\splitbotmark\fi%
\ifthenelse{\equal{\spheadlinetype}{title}}{\MakeUppercase{-TODO-}}{}%
\ifthenelse{\equal{\sppagenumbervalign}{top}}{\sppagenumberreadytogo}{}%
}%
\vskip\lineskip%
}
\newcommand{\spfootline}%
{%
{%
\ifthenelse{\equal{\sppagenumbervalign}{bottom}}{\sppagenumberreadytogo}{}%
}%
}
\newcommand{\sppagebody}
{%
%\ifthenelse{\equal{\spsplitblockcontdmark}{}}{an}{aus \spsplitblockcontdmark}% e.g. (CONT'D)
\ifcase2\expandafter\relax\splitbotmark\fi % So-and-so (CONT'D) \nukeline
\ifcase3\expandafter\relax\botmark\fi % \nukeline for (MORE)
\ifcase5\expandafter\relax\botmark\fi % \nukelines for CONTINUED
{%
\vbadness=10000
\setbox0=\vsplit255 to \dimen0 % split to new height
\unvbox0 % put page into output
}%
\ifcase4\expandafter\relax\splitbotmark\fi % (MORE)
\ifcase6\expandafter\relax\splitbotmark\fi % CONTINUED
%\ifthenelse{\equal{\spsplitblockfurthermark}{}}{an}{aus \spsplitblockfurthermark}% e.g. (MORE)
\kern-\dimen0 \vfil % kern keeps \vfil from being discarded
}
\newcommand{\sppagebodymarksplitbegin}%markers for splits e.g. (MORE)
{}
\newcommand{\sppagebodymarksplitend}%markers for splits e.g. (CONT'D)
{}
%
% supporting the correct pagebreak for dialogs and other fine friends
%
\newcommand{\nukeline}%
{%
\advance\dimen0 by -\lineskip%
}
\newcommand{\mymark}
{%
{%
%\header \noexpand\or%
\contprevscene\noexpand\or%
\contprevdialog\noexpand\or%
\contdialoga\noexpand\or%
\contdialogb\noexpand\or%
\contscenea\noexpand\or%
\contsceneb %\noexpand\or
% \contrev
}%
}
\newcommand{\contprevscene}{}
\newcommand{\contprevdialog}{}
\newcommand{\contdialoga}{}
\newcommand{\contdialogb}{}
\newcommand{\contscenea}{}
\newcommand{\contsceneb}{}
\newcommand{\stage}%
{%
\penalty10000
\gdef\contprevdialog{}
\gdef\contdialoga{}
\gdef\contdialogb{}
\expandafter\mark\mymark
\penalty-100
%\margins{0in}{\hsize}
\parskip\baselineskip
}
%
% Redefining maketitle - creates a title-page
%
\newcommand{\maketitle}
{
}
%
% Dialog - even if it' a monolog
%
\newcommand{\dialog}[2]
{%
\gdef\spsplitblockfurthermark%
{\hskip\spcharnamemarginleft\spspeechfurthermark}%
\gdef\spsplitblockcontdmark%
{\hskip\spcharnamemarginleft\MakeUppercase{#1} \spspeechcontdmark}%
{%
\penalty10000% make sure we don't break until after the clear mark
\gdef\contprevdialog{}
\gdef\contdialoga{}
\gdef\contdialogb{}
\expandafter\mark\mymark
\penalty-100 % OK to break now
%\parskip\lineskip
\begin{margins}{\spcharnamemarginleft}{\spcharnamemarginright}%
\MakeUppercase{#1} % name of the speaker
\def\spcurrentspeaker{#1}%
\ifx\splastspeaker\spcurrentspeaker%continued dialogue?
\spspeechcontdmark%
\fi%
\end{margins}%
\gdef\contprevdialog
{%
\nukeline%
{\uppercase{#1} \spspeechcontdmark}% e.g. (CONT'D) - pagebreak for dialog
}
\gdef\contdialoga{\nukeline}%
\gdef\contdialogb{{\spspeechfurthermark}}% e.g. (MORE) - pagebreak for dialog
\expandafter\mark\mymark%
\begin{margins}{\spdialoguemarginleft}{\spdialoguemarginright}%
%the speech itself
\penalty10000
#2%
\end{margins}%
\stage
\gdef\splastspeaker{#1} %remember this speaker
}
\gdef\spsplitblockfurthermark{tt}
\gdef\spsplitblockcontdmark{tt}
}
%
% Creates the typical script ending
%
\newcommand{\theend}
{
}
%
% Helpful functions
%
% area with changed margins
\def\margins#1#2{\list{}{\rightmargin#2\leftmargin#1}\item[]}
\let\endmargins=\endlist
%current Pagenumber with decoration
\newcommand{\sppagenumberdecorated}
{
\ifthenelse{\equal{\sppagenumberdecoration}{line}}{-}{}%
\the\value{page}%
\ifthenelse{\equal{\sppagenumberdecoration}{point}}{\rlap{.}}{}%
\ifthenelse{\equal{\sppagenumberdecoration}{line}}{-}{}%
}
%pagenumberwithalign
\newcommand{\sppagenumberreadytogo}
{
\ifnum\value{page}>0%
\ifthenelse{\equal{\sppagenumberhalign}{right}}{\hfill}{}%
\ifthenelse{\equal{\sppagenumberhalign}{center}}%
{\centerline{\sppagenumberdecorated}}%
{\sppagenumberdecorated}%
\ifthenelse{\equal{\sppagenumberhalign}{left}}{\hfill}{}%
\fi
}
%
% Options
%
% Oscar
\DeclareOption{oscar}{\renewcommand{\scripttype}{oscar} \screenplayer}
\DeclareOption{movie}{\renewcommand{\scripttype}{oscar} \screenplayer}
%BBC Cinema
\DeclareOption{bbccinema}{\renewcommand{\scripttype}{bbccinema} \screenplayer}
\DeclareOption{picture}{\renewcommand{\scripttype}{bbccinema} \screenplayer}
%BBC Stage UK
\DeclareOption{bbcstageuk}{\renewcommand{\scripttype}{bbcstageuk} \screenplayer}
\DeclareOption{theatre}{\renewcommand{\scripttype}{bbcstageuk} \screenplayer}
%BBC Stage US
\DeclareOption{bbcstageus}{\renewcommand{\scripttype}{bbcstageus} \screenplayer}
\DeclareOption{theater}{\renewcommand{\scripttype}{bbcstageus} \screenplayer}
\DeclareOption*{%
\PackageWarning{fred}{Unknown option ‘\CurrentOption’}%
}
\ProcessOptions\relax