summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/stage/stage.cls
blob: 4756c8c89c5363e85aa62f669b491eef2e79e2d8 (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
%% stage.cls
%% Copyright 2005 Robert Jahrling
%% Copyright 2017–2018 Reuben Thomas
%
% This is a LaTeX2e class called stage, providing a class
% for stage play Manuscript Format.
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3
% of this license or (at your option) any later version.
% The latest version of this license is in
%   http://www.latex-project.org/lppl.txt
% and version 1.3 or later is part of all distributions of LaTeX
% version 2003/12/01 or later.
%
% This work has the LPPL maintenance status "maintained".
% 
% This Current Maintainer of this work is Reuben Thomas
%
% This work consists of the file stage.cls.
%
% See https://github.com/rrthomas/stage or contact me at rrt@sc3d.org
%

\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{stage}[2018/05/14 v1.01 Manuscript Format for stage plays]
% The class is based on the default book class
\LoadClass[12pt,oneside]{book}
\PassOptionsToClass{\CurrentOption}{book}
% We're going to use ifthen to do some conditional page breaking.
\RequirePackage{ifthen}
\RequirePackage{fancyhdr}
\RequirePackage{extramarks}
\RequirePackage{needspace}
\RequirePackage{changepage}
% These three commands are required.
% The default font size is 12/14. It looks better than 12 solid.
% The textwidth and textheight represent one-inch margins all
% around.
\renewcommand{\normalsize}{\fontsize{12pt}{14pt}\selectfont}
\setlength{\textwidth}{6.0in}
\setlength{\textheight}{8.5in}
\setlength{\topmargin}{0in}

\raggedbottom


%%% Customizable strings (Note: keep in sync with the docs)
\newcommand{\actname}{Act}
\newcommand{\scenename}{Scene}
\newcommand{\continuedname}{Continued}
\newcommand{\castname}{Cast of Characters}
\newcommand{\theendname}{The End}

%%% pagestyle commands
% use fancy pagestyle
\pagestyle{fancy}
% Sets the left header to use the picture environment to put
% continued marks where necessary!
\lhead{\setlength{\unitlength}{\baselineskip}%
		\begin{picture}(0,0)
			\put(12.9,-1.1){\makebox(0,0)[tl]{\firstxmark}}
		\end{picture}\leftmark}
\rfoot{\lastxmark}
% puts the page numbers in the header on the right
\rhead{\thepage}
% empties center foot; otherwise, the page number would display here.
\cfoot{}
% by default, fancyhdr puts a rule in the header, which I don't want.
\renewcommand{\headrulewidth}{0pt}
% since we're using a slightly larger font, we need more headheight
\renewcommand{\headheight}{14pt}
%%%

% No indentation; space between paragraphs.
\usepackage{parskip}
% \introduce is used the first time we meet a character.
\newcommand{\introduce}[1]{\textsc{#1}}
% \address is used for the writer's address
\newcommand{\address}[1]{\gdef\@address{#1}}
% Counts acts
\newcounter{actcounter}
% We need to initialize actcounter for page numbering.
\setcounter{actcounter}{0}

% Counts scenes per act
\newcounter{scenecounter}[actcounter]
% \dialog sets the character's name above their speech
\let\stageoldep=\everypar
\newlength{\saveparskip}
\newcommand{\dialog}[2]{%
  \needspace{2\baselineskip}%
  {\begin{adjustwidth}{2.5in}{0in}\textsc{#1}\end{adjustwidth}\saveparskip=\parskip\parskip=0pt%
  \extramarks{}{}%
  {\begin{adjustwidth}{0in}{0in}\def\everypar{\parskip=\saveparskip\stageoldep}#2\end{adjustwidth}}%
  \extramarks{\textsc{#1} (\continuedname)}{}}
}

% \dialogue, for people who like that spelling better
\newcommand{\dialogue}[1]{\dialog{#1}}

% \act creates an act header, with large roman numerals
%
% Start a new page for each Act except the first
\newcommand{\act}{%
  \renewcommand{\thepage}{\Roman{actcounter}-\arabic{page}}%
  \ifthenelse{\value{actcounter} > 1}{\newpage}{\vspace{\parskip}}
  \stepcounter{actcounter}
  \hspace*{2.5in}\textsc{\actname} \Roman{actcounter}%
  \setcounter{page}{1}
}
% \scene creates a scene header, with arabic numerals
%
% Start a new page for each scene except the first
\newcommand{\scene}{%
  \extramarks{}{}%
  \stepcounter{scenecounter}
  \ifthenelse{\value{scenecounter} > 1}{\newpage}{\vspace{\parskip}}
  \hspace*{2.5in}\textsc{\scenename} \arabic{scenecounter}%
}
% \stage sets the stage directions farther in than the box
% containing the dialog, and parenthesizes them.
\newcommand{\stage}[1]{%
	\begin{adjustwidth}{2in}{0in}
		(#1)%
	\end{adjustwidth}
}
% \charsd is like \paren in ScriptTeX, used for brief character
% stage directions. It's intended to set properly into a passage
% of dialog.
\newcommand{\charsd}[1]{%
	{\def\everypar{\parskip=0pt\stageoldep}%
	\stage{#1}\par\leavevmode}}
% Undocumented, for backwards compatibility
\newcommand{\initsd}[1]{\charsd{#1}}

% \pause is just convenient.
\newcommand{\pause}{\stage{Pause.}}

% Implemented \paren to ease transition from ScriptTeX
\newcommand{\paren}[1]{\charsd{#1}}

% \opensd is opening stage directions, set differently from
% other stage directions; \opensd sets time and place.
\newcommand{\opensd}[1]{%
	\begin{adjustwidth}{2.5in}{0in}
		(#1)%
	\end{adjustwidth}
}
% \open is the same as \opensd
\newcommand{\open}[1]{\opensd{#1}}

% "placeholder" redefinition of \maketitle.
\renewcommand{\maketitle}{%
	\begin{titlepage}
		\center{\textsc{\@title}}
		\par
		\center{\@author}
		\vspace{5in}
		\begin{adjustwidth}{0in}{0in}
			\ifthenelse{\not\isundefined{\@address}}{\@address}{}
		\end{adjustwidth}
	\end{titlepage}
	\setcounter{page}{1}
}

% The castpage environment sets up the cast page
\newenvironment{castpage}{%
	\thispagestyle{empty}%
	\center{\textsc{\castname}}%
	\vspace{3ex}%
	\begin{adjustwidth}{0in}{0.5in}%
	}{%
	\end{adjustwidth}%
	\setcounter{page}{0}%
	\newpage%
}
% \addcharacter adds characters to the cast page.
\newcommand{\addcharacter}[2]{%
	\begin{tabular}[2]{p{2in} p{4in}}
		\textsc{#1} & #2\\[\parskip]
	\end{tabular}
}
% Mark the end of the document.
\AtEndDocument{%
		\hskip 2.5in %
		\textsc{\theendname}%
}