% TeX stageplay macros -- typeset format
% Copyright 1991-2002 Adrian McCarthy  See documentation for re-distribution info.
\def\banner{ScriptTeX 1.04, 10-MAR-2002, typeset stageplay format}%version
\immediate\write16{\banner}
%
% These macros will produce a typeset script in stageplay format.
%
%
% General page layout:
%
\font\sc=cmcsc10 % Caps and small caps
\font\twbf=cmbx12 % Twelve point bold face
\hsize=6.5truein
\vsize=8.3truein
\parindent 0pt
\parskip\baselineskip
\hoffset=0.5truein
%
% My first output routine.  Marks have three parts:  act/scene header,
% dialog continuation text for top of page, and dialog continuation text
% for the bottom of the page.  No insertions are handled at this time.
%
\output={%
  \ifx\LR\empty \else
    \if L\LR \hoffset=0.0truein \global\def\LR{R}
      \else \hoffset=0.5truein \global\def\LR{L}
    \fi
  \fi%x
  \shipout\vbox to 9.0truein{\makeheadline \pagebody \makefootline}
  \advancepageno
% No supereject nonsense since we aren't going to deal with insertions.
}
\def\makeheadline{%  Act/scene header and page number
  \line{\tenrm \ifcase0\expandafter\relax\firstmark\fi%
    \ifnum\pageno>0 \hss $\oldstyle\folio$. \fi}
  \vskip\baselineskip
}
\def\pagebody{%
  \line{\ifcase1\expandafter\relax\topmark\fi \hss}
  \unvbox255
  \line{\ifcase2\expandafter\relax\botmark\fi \hss}
  \vfil
}
\def\makefootline{%
  \line{\footer}
}
%
% Revision information
%
\def\titletext{Stageplay}
\def\title#1{\def\titletext{#1}}
\def\seriestext{}  % here for compatibility with screenplay format
\def\series#1{\def\seriesname{#1}}
\def\authortext{}
\def\author#1{\def\authortext{#1}}
\def\drafttext{}
\def\draft#1{\def\drafttext{#1}}
\def\basedon#1{\def\basedontext{#1}}
\def\basedontext{}
\def\showcopyright#1{\def\copyrighttext{$\copyright$~#1}}
\def\copyrighttext{}
\def\address#1{\def\addresstext{\vtop{\settabs 1\columns \tabalign #1\cr}}}
\def\\{\cr\tabalign}
\def\addresstext{}
\def\today{%
  \hbox{\number\day-\ifcase\month\or JAN\or FEB\or MAR\or APR\or MAY%
    \or JUN\or JUL\or AUG\or SEP\or OCT\or NOV\or DEC\fi%
    -\number\year}%
}
\edef\datetext{\today}
\def\date#1{\def\datetext{#1}}
%
% We count acts and scenes for you.
%
\newcount\actcnt \actcnt=0
\def\currentact{}
\newcount\scenecnt \scenecnt=0
\def\currentscene{}
\def\stdhead{%
  {\tenit \titletext\/}
  {\tenrm \currentact\ifx\currentscene\empty \else,\currentscene\fi}
}
\def\stdfoot{{\tenrm \drafttext} \hss {\tenrm \datetext}}
\def\stdxref{%
  \ifx\currentact\emtpy \else%
    \currentact, %
  \fi%
  \ifx\currentscene\empty \else%
    \currentscene%
  \fi
}
\def\Roman#1{\uppercase\expandafter{\romannumeral#1}}
\def\roman#1{\romannumeral#1}
%
% Variants
%
\def\LR{}
\def\twoside{\def\LR{R}}
\def\jlbrooks{} % for compatibility with screenplay format
\def\movie{}
\def\TV{}
\def\sitcom{}
\def\manuscript{
  \def\header{\stdhead}
  \def\footer{}
  \def\draftblock{}
}
\def\proof{
  \ifx\drafttext\empty \draft{Working Draft}\fi
  \def\header{\stdhead}
  \def\footer{\stdfoot}
}
\def\shoot{  % here for compatibility with screenplay format
  \manuscript
}
%
% Breakdowns
%
\def\makecastlist{\immediate\write16{Cast lists no longer supported.}}
\def\collectcast{\immediate\write16{Cast lists no longer supported.}}
\def\makescenelist{\immediate\write16{Scene lists no longer supported.}}
\def\collectscenes{\immediate\write16{Scene lists no longer supported.}}
%
% Make a titlepage
%
\def\maketitle{%
  \ifx\LR\empty \else \def\LR{R} \fi
  \hbox{}
  \vskip 2in
  \ifx\seriestext\empty \else 
    \centerline{\rm \seriestext}
    \vskip 3\baselineskip
  \fi
  \centerline{\twbf \titletext}
  \vskip\baselineskip
  \ifx\authortext\empty \else
    \centerline{\rm \authortext}
  \fi
  \vskip\baselineskip
  \centerline{\basedontext}
  \vskip 3.5in
  \line{\copyrighttext\hfill\addresstext}
  \vskip 3\baselineskip
  \draftblock
  \pageno=0
  {
    \def\header{}
    \def\footer{}
    \eject
  }
  \pageno=1
}
\def\draftblock{%
  \vskip 2in
  \ifx\drafttext\empty \else
    \rightline{\rm \drafttext}
  \fi
  \rightline{\rm \datetext}
}
%
% Standard header for acts, tags, and teasers
%
\def\acthead#1{%
  \acttail
  \advance\actcnt by 1
  \scenecnt=0
  \edef\currentact{#1}
  \mark{\header\noexpand\or\noexpand\or}
  \vfill
  \penalty-10000
  \vskip\baselineskip
  \centerline{\twbf ACT #1}
  \vskip 2\baselineskip
}
%
% Standard tail for acts, tags, and teasers
%
\def\acttail{%
  \penalty1000
  \ifx\currentact\empty \else
    \vskip 2\baselineskip
    \centerline{\twbf END OF ACT \currentact}
  \fi
}
%
% Regular script constructs:
%
\def\act{\acthead{\Roman\actcnt}}
\def\teaser{\prolog}  % Here for compatibility with
\def\tag{\epilog}     % screenplay format.
\def\prolog{\acthead{Prolog}\actcnt=0}
\def\epilog{\acthead{Epilog}}
\def\prologue{\acthead{Prologue}\actcnt=0}
\def\epilogue{\acthead{Epilogue}}
\def\theend{
  \def\acttailblock{
    \vskip 2\baselineskip
    \centerline{\bf THE END}
  }
}

\def\scene#1{%
  \advance\scenecnt by 1
  \edef\currentscene{\roman\scenecnt}
  \mark{\header\noexpand\or\noexpand\or}
  {\it Scene \roman\scenecnt:  #1}\par
  \penalty1000
}

\def\stage{%
  \mark{\header\noexpand\or\noexpand\or}
  \it
}

\def\trans#1{%
  \mark{\header\noexpand\or\noexpand\or}
  \penalty100
  \rightline{\it #1}
  \par
  \penalty-100
}

\def\open#1{\trans{#1}}
\def\close#1{\trans{#1}}

\outer\def\dialog#1#2\par{%
  \mark{\header\noexpand\or\noexpand\or}
  \hangindent=5pc {\sc #1:} \rm
  \mark{\header\noexpand\or {\sc #1:} {\it (cont'd)\/}%
    \noexpand\or \rightline{\it (more)}}
  #2\par
}

\def\paren#1{{\sl (#1)\/}}

\def\leadin#1{%
  #1~\ldots
  \par
  \penalty200
  \def\leadtext{#1}
}
\def\pickup{\phantom{\leadtext}\llap{\ldots}~}

\def\em#1{{\it #1\/}}
\def\extra#1{#1}
\def\introduce#1{#1}
\def\sound#1{#1}  % Here for compatibility with screenplay format.
\def\ldots{.\thinspace.\thinspace.}

\def\cleanup{%
  \par
  \acttail
  \mark{\header\noexpand\or\noexpand\or}
  \vfill
  \penalty-10000
}
\def\bye{
  \cleanup
  \end
}
%
% Shortcuts:
%   (Most of these make more sense in the screenplay format.)
\def\beat{\paren{pause}}
\def\cut{\trans{cut to}}
\def\dissolve{\trans{dissolve to}}
\def\ext#1{\scene{#1}}
\def\fadein{\open{Lights up}}
\def\fadeout{\close{Lights down}}
\def\int#1{\scene{#1}}
\def\os{\paren{off stage}}
\def\shot#1\par{\par\stage #1}
\let\tv=\TV
\def\vo{\paren{voice over}}
%
% Defaults
%
\manuscript
