%$Log:	TeX $
%Revision 1.1  91/10/30  15:08:24  RC-HH
%Initial revision
% Amendments made 08/11/91
% \colsref amended (/ deleted)
% \getaddress amended (/ added)
% \bsdft altered by adding conditionals (ifx sols, sref, cref)
% \nsnbp changed to \nsnbps (\space added) and \nsn added
% The names of these should, perhaps be changed to include @
% Alterations to \xref and \newxref to ensure correct updating
% Alteration to \arrangement
% \global added in \party in one place. May need adding in others
% Alterations to \chittitle (for use in \faxsheet)
% Minor alteration to \advising
% Alteration to \familydivision and to \family and assoc macros
% \pleadingtrue added to \ch etc, \pleading false as default
% Alteration to affidavit to correct error
% \clientpltrue added in \specialwrit
% \sjsummons altered: do same to others
% \origprocess : \par added after #2
% \widowpenalty added to \pageparameters and \draftparameters
% \string added in \write statement in \schedule
% Alterations to \schedref and \appendref to deal with singles
% Added \pararef = to \clref
% Minor alterations to correct pagenumbering---check
% Duplicate definition of \faxsheet removed
% \everyjob added
% Minor alterations re \workdone
% Minor alteration to \plainoutput. \count1 & 2 swapped
% 12 Nov 91 Alteration made to \maxpartywidth 
% and to \resetpleadingdefaults
% Many %% removed
% 20 Nov 1991
% Minor alterations to \today and \everyjob
% \makeatletter \makeatother added
% time macros (taken from gentle.tex) added
% 21 Nov 1991
% TUBboat.sty macros added to remove spaces
% \oldquotes and ancilliary macros added
% \futureday etc and \dayofweek added


% This is LeXTeX, by Roger C-H. Horne.
% Some of it is original, and some is not.
% e.g., it takes chunks from manmac.tex relating to font sizing
% and amends those to include poundsigns
% It also takes footnotes from AMSptt.sty
% And uses a number of macros that have appeared in TUGboat
%
% The present version is an amalgamation of two files---and it shows.
%
% Last modified 21th November 1991

% Introduction (ie general purpose stuff) 
% 
\newif\ifdebugging
\def\dbhelp#1{\ifdebugging\inform{#1}\fi} 
\debuggingfalse

\ifx\lextexisloaded\relax\message{ - already loaded}
  \afterassignment\endinput
  \else\let\lextexisloaded=\relax
  \fi

\def\fmtname{LeXTeX}\def\fmtversion{1.005}
\message{Version \fmtversion}

\catcode`@=11 % Turn the `at' sign into a letter.
\catcode`\^=7 % Ensure that ^ is superscript.
%\catcode`\|=12% Ensure that | is `other'.

% time macros
\newcount\hour \newcount\minute
\def\mm@{\ifnum \minute<10 0\fi\number\minute}
\def\writetime{\hh@\mm@\space\am@pm}

\everyjob{%
  \hour=\time  \divide \hour by 60
  \minute=\time
  \loop  \ifnum \minute > 59 \advance \minute by -60 \repeat
  \ifnum \hour<13 
    \def\hh@{\number\hour:}%  % supresses leading 0's
    \def\am@pm{\ifnum \hour < 12 a.m.\else p.m.\fi}
  \else \advance \hour by -12 
    \def\hh@{\number\hour:}%  % supresses leading 0's                    \fi
    \def\am@pm{\ifnum \hour > 11 a.m.\else p.m.\fi}
  \fi
  \inform{}%
  \inform{This is LeXTeX, Version \fmtversion, running at \writetime}%
  \inform{\space\space on the \today.}%
  \inform{}%
  \inform{Comments and bug reports to}%
  \inform{}%
  \inform{\space\space Roger Horne}%
  \inform{\space\space 7 New Square}%
  \inform{\space\space Lincoln's Inn}%
  \inform{\space\space London WC2A 3QS}%
  \inform{\space\space rhorne@cix.compulink.co.uk}%
  \inform{}%
  }

% LeX TeX logo---looking distinctly similar to \LaTeX...
%
\def\LeXTeX{L\kern-.25em\raise.5ex\hbox{ex}T\kern-.1667em\lower
   .5ex\hbox{E}\kern-.125emX}
% The LaTeX logo sometimes looks like this (it varies a little)
\def\LaTeX{{\rm L\kern-.36em\raise.3ex\hbox{\scaps a}\kern-.15em
    T\kern-.1667em\lower.7ex\hbox{E}\kern-.125emX}}


% Part 1 - Fonts etc---

% Main maths + roman---

\font\tentex=cmtex10
\font\twelverm=cmr12
\font\ninerm=cmr9
\font\eightrm=cmr8
\font\sixrm=cmr6
\font\fiverm=cmr5

% Maths italic---

\font\twelvei=cmmi12
\font\ninei=cmmi9
\font\eighti=cmmi8 % This is used as a scriptfont
\font\sixi=cmmi6 % reinstated for the time being
\skewchar\twelvei='177
\skewchar\ninei='177 \skewchar\eighti='177
\skewchar\sixi='177

% Math symbols---

\font\twelvesy=cmsy10 scaled \magstep1
\font\ninesy=cmsy9
\font\eightsy=cmsy8 % used as a scriptfont
\font\sixsy=cmsy6 % reinstated
\skewchar\twelvesy='60
\skewchar\ninesy='60
\skewchar\eightsy='60
\skewchar\sixsy='60

% Bold extended---

\font\twelvebf=cmbx12
\font\ninebf=cmbx9

% Typewriter style---

\font\twelvett=cmtt12 % Now not using proportional version
%\font\twelvett=cmvtt10 scaled \magstep1
%\font\tentt=cmvtt10
\font\tentt=cmtt10
\font\ninett=cmtt9

% Slanted type---

\font\twelvesl=cmsl12
\font\ninesl=cmsl9

% Italic---

\font\twelveit=cmti12
\font\nineit=cmti9

% Odd fonts---

\font\headerfont=cmr12 scaled \magstep1
\font\titlefont=cmr12 scaled \magstephalf

% Now the poundsign fonts:

\font\tenu=cmu10 % unslanted text italic
\font\twelveu=cmu10 scaled \magstep1
\font\tentiit=cmitt10

% And the caps and small caps fonts:

\font\fourteencaps=cmcsc10 scaled \magstep2
\font\twelvecaps=cmcsc10 scaled \magstep1
\font\tencaps=cmcsc10          

% The underline and cross-out macros

\def\gobble#1{}

\def\changefont#1{%
  \edef\testfontname{#1\fontname\font}%
  \edef\testfont{\expandafter\string\the\font}%
  \edef\testtwo{#1\expandafter\gobble\testfont}%
  \edef\testthree{\csname\testtwo\endcsname}%
  \expandafter\ifx\csname\testtwo\endcsname\relax
  \global\expandafter\font\testthree\expandafter=\testfontname
  \fi\ignorespaces
  \let\temppounds=\pounds
  \testthree\ignorespaces}

\gdef\ul{\changefont{u}
      \def\pounds{%
         \setbox1\hbox{\temppounds}%
         \setbox2\hbox{p}%
         \copy1\kern-\wd1
         \vrule depth .6\dp2 height -.45\dp2 width\wd1
         \relax}%
       }

\gdef\xo{\changefont{x}
       \def\pounds{%
         \setbox1\hbox{\temppounds}%
         \setbox2\hbox{p}%
         \copy1\kern-\wd1
         \vrule depth -.35ex height .45ex width\wd1
         \relax}%
       }

\def\xu{\changefont{xu}}
\let\xul\xu

% The next ones are at present somewhat abbreviated
% ie, poundsigns will not be crossed-out or underlined properly

\gdef\uul{\changefont{uu}}
\gdef\xxo{\changefont{xx}}
\gdef\uuul{\changefont{uuu}}
\gdef\xxxo{\changefont{xxx}}

% It will also be necessary in due course to define
% \def\xxu - inserted by am1, deleted by am2
% \def\xxxu - inserted by am1, deleted by am3
% \def\xxxuu - inserted by am2, deleted by am3

% Part 2 - Dimensions, etc.

\newdimen\footindent % fn indentation
\newdimen\clindent % clause indentation
\newdimen\sclindent % sub-clause indentation
\newdimen\ssclindent
\newdimen\sssclindent
\newdimen\ssssclindent
\newdimen\sssssclindent
\newdimen\cnindent % "computer-numbering" indentation
\newdimen\hclindent % hanging indentation
\newdimen\hsclindent
\newdimen\hssclindent
\newdimen\hsssclindent
\newdimen\hssssclindent
\newdimen\hsssssclindent
\newdimen\quoteindent % indentation of quotations
\newdimen\quoteparindent % \parindent in quotes
\newdimen\clbox % box holding \cl in \clcont
%\newdimen\sclbox % not used yet
%\newdimen\ssclbox
%\newdimen\sssclbox
%\newdimen\ssssclbox
%\newdimen\sssssclbox 
\newdimen\signindent % indentation of signature
\newdimen\rbracketsize % size of brackets round sworn, etc
\newdimen\lbracketsize
\newdimen\brackdepth % Depth of space in sworn etc
\newdimen\notespace % space marginal notes--text
\newdimen\maxnote % width of marginal note
\newdimen\clnamelength % length of "clause" in contents macros
\newdimen\pagewidth % alternative name for \hsize
\newdimen\pageheight % alternative name for \vsize

\newcount\footmarkcount@ % No. of footnotes
\newcount\recno % recitals
\newcount\clno % clauses and sub-clauses
\newcount\sclno
\newcount\ssclno % sub-sub etc
\newcount\sssclno
\newcount\ssssclno
\newcount\sssssclno
\newcount\greekno % see \ssscl & \sssscl
\newcount\cardno % see \sssscl & \ssssscl
\newcount\exno % Exhibits in affidavits
\newcount\clauselevel
\newcount\ssdcount \ssdcount=0 % new
\newcount\schedcount \schedcount=0
\newcount\partcount \partcount=0

\newskip\quoteparskip %parskip in quotes
\newskip\ttglue
\newskip\blankskip % Used in \noaddr etc
\newskip\twelvebase % \normalbaselines (12pt type)
\newskip\tenbase % \normalbaselines (10pt type)
\newskip\ninebase % \normalbaselines (9pt type)
\newskip\twelvesmallskipamount % TB p. 349
\newskip\tensmallskipamount
\newskip\ninesmallskipamount
\newskip\twelvemedskipamount
\newskip\tenmedskipamount
\newskip\ninemedskipamount
\newskip\twelvebigskipamount
\newskip\tenbigskipamount
\newskip\ninebigskipamount
\newskip\settledgap % distance between settled & sig.
\newskip\clskip % vskip for clauses
\newskip\sclskip % vskip for sub-clauses
\newskip\ssclskip % ditto ss-clauses
\newskip\sssclskip % ditto sss-clauses

\newif\ifgreek % see \sssscl
\newif\ifcard % see \ssssscl
\newif\ifclind % hanging indentation in clauses
\newif\ifcontents % table of contents produced
\newif\ifnocommaindate % used in \today
\newif\ifq % Used (?) in the quote macros
\newif\ifxrfmissing % cross-refs file
\newif\ifvisible % used in contents
\newif\ifmarginalnotes % if true, notes in margin
\newif\ifxrefs % check this
\newif\ifoldxrffile % 
\newif\ifindex
\newif\iffullsize \fullsizefalse% Whether fullsize backsheet
\newif\ifdraft \drafttrue% Draft or engrossment
\newif\ifpleading % No date req'd for pleadings
\newif\ifucfirstline % \ucfirstlinetrue
\newif\ifchit % print a fee chit
\newif\ifendorsement \endorsementfalse

\newread\xrf
\newread\inx

\newwrite\cont 
\newwrite\inx
\newwrite\xrf


% Part 3 - Now add the poundsign macros:

\def\rmpo{\leavevmode\lower.055ex\hbox{\$}\kern-.0em}
\def\itpo{\leavevmode\lower.055ex\hbox{\$}\kern-.09em}
\def\slpo{\leavevmode\lower.055ex\hbox{\$}\kern-.07em}
\def\bfpo{\leavevmode\pmb{\lower.025ex\hbox{\$}\kern-.04em}}
\def\ttpo{\leavevmode\lower.0ex\hbox{\$}\kern0em}
\def\ttkludgepo{\leavevmode\epmb{\lower.0ex\hbox{\$}\kern-.0em}}

\def\pmb#1{\setbox0=\hbox{#1}% Poor man's bold
  \kern-.025em\copy0\kern-\wd0
  \kern.05em\copy0\kern-\wd0
  \kern-.025em\raise.0003em\box0 }

\def\epmb#1{\setbox0=\hbox{#1}% Extremely poor man's bold
  \kern-.005em\copy0\kern-\wd0
  \raise.015em\copy0\kern-\wd0
  \kern.01em\copy0\kern-\wd0
  \kern-.005em\raise.015em\box0 }


% Part 4 - The size-changing macros

% These are adapted from the 10-point manmac macros
% Script and scriptscrip removed except in \rm

\def\twelvepoint{\def\rm{\def\pounds{{\twelveu\rmpo}}\fam0\twelverm}%
  \textfont0=\twelverm \scriptfont0=\eightrm \scriptscriptfont0=\sixrm
  \textfont1=\twelvei \scriptfont1=\eighti \scriptscriptfont1=\sixi
  \textfont2=\twelvesy \scriptfont2=\eightsy \scriptscriptfont2=\sixsy
  \textfont3=\tenex \scriptfont3=\tenex \scriptscriptfont3=\tenex
  \def\it{\def\pounds{{\itpo}}\fam\itfam\twelveit}%
  \textfont\itfam=\twelveit
  \def\sl{\def\pounds{{\twelveit\slpo}}\fam\slfam\twelvesl}%
  \textfont\slfam=\twelvesl
  \def\bf{\def\pounds{{\twelveu\bfpo}}\fam\bffam\twelvebf}% pmb poundsign
  \textfont\bffam=\twelvebf
  \def\tt{\def\pounds{{\tenu\ttkludgepo}}\fam\ttfam\twelvett}% ! poundsign
  \textfont\ttfam=\twelvett
  \tt \ttglue=.5em plus.25em minus.15em % not needed for cmvtt fonts
  \normalbaselineskip=\twelvebase
  \smallskipamount=\twelvesmallskipamount
  \medskipamount=\twelvemedskipamount
  \bigskipamount=\twelvebigskipamount
  \def\caps{\def\pounds{~}\fourteencaps}% don't use the pound sign
  \def\scaps{\def\pounds{{\twelveu\rmpo}}\twelvecaps}%
  \setbox\strutbox=\hbox{\vrule height.7\normalbaselineskip
    depth.3\normalbaselineskip width\z@}%
  \normalbaselines\rm}
% consider changing normalbaselineskip to \the\twelvebase

\def\tenpoint{\def\rm{\def\pounds{{\tenu\rmpo}}\fam0\tenrm}%
  \textfont0=\tenrm \scriptfont0=\sevenrm \scriptscriptfont0=\fiverm
  \textfont1=\teni
  \textfont2=\tensy
  \textfont3=\tenex \scriptfont3=\tenex \scriptscriptfont3=\tenex
  \def\it{\def\pounds{{\itpo}}\fam\itfam\tenit}%
  \textfont\itfam=\tenit
  \def\sl{\def\pounds{{\tenit\slpo}}\fam\slfam\tensl}%
  \textfont\slfam=\tensl
  \def\bf{\def\pounds{{\tenu\bfpo}}\fam\bffam\tenbf}%
  \textfont\bffam=\tenbf
  \def\tt{\def\pounds{{\tentiit\ttpo}}\fam\ttfam\tentt}%
  \textfont\ttfam=\tentt
  \tt \ttglue=.5em plus.25em minus.15em
  \smallskipamount=\tensmallskipamount
  \medskipamount=\tenmedskipamount
  \bigskipamount=\tenbigskipamount
  \normalbaselineskip=\tenbase
  \def\caps{\def\pounds{{\twelveu\rmpo}}\twelvecaps}%
  \def\scaps{\def\pounds{{\tenu\rmpo}}\tencaps}%
  \setbox\strutbox=\hbox{\vrule height10pt depth5pt width\z@}%
  \normalbaselines\rm}

\def\ninepoint{\def\rm{\def\pounds{{\nineit\slpo}}\fam0\ninerm}%
  \textfont0=\ninerm \scriptfont0=\sixrm \scriptscriptfont0=\fiverm
  \textfont1=\ninei
  \textfont2=\ninesy
  \textfont3=\tenex \scriptfont3=\tenex \scriptscriptfont3=\tenex
  \def\it{\def\pounds{{\nineit\itpo}}\fam\itfam\nineit}%
  \textfont\itfam=\nineit
  \def\sl{\def\pounds{{\nineit\slpo}}\fam\slfam\ninesl}%
  \textfont\slfam=\ninesl
  \def\bf{\def\pounds{~}\fam\bffam\ninebf}% pound sign to be added
  \textfont\bffam=\ninebf
  \def\tt{\def\pounds{~}\fam\ttfam\ninett}% no pound sign
  \textfont\ttfam=\ninett
  \tt \ttglue=.5em plus.25em minus.15em
  \smallskipamount=\ninesmallskipamount
  \medskipamount=\ninemedskipamount
  \bigskipamount=\ninebigskipamount
  \normalbaselineskip=\ninebase
  \setbox\strutbox=\hbox{\vrule height8pt depth3pt width\z@}%
  \normalbaselines\rm}


% Part 5 - Footnotes

% These are adapted from the AMSTeX macros
% For details of usage see "The Joy of TeX" by Spivak M.D.

\def\relaxnext@{\let\next\relax}

% This is new. Adaption of \hang etc (Vol.B p.355)

\def\fang{\hangindent\footindent}
\def\fitem{\par\fang\toeindent}
\def\toeindent#1{\noindent\hbox to \footindent{\hss#1\thinspace}}

% This is where AMSPPT.STY is added:

\def\footmarkform@#1{$^{#1}$}
\let\thefootnotemark\footmarkform@
\def\makefootnote@#1#2{\insert\footins
  {\interlinepenalty\interfootnotelinepenalty
% The original (AMSTeX) uses 8-point:
  \ninepoint\splittopskip\ht\strutbox\splitmaxdepth\dp\strutbox
  \floatingpenalty\@MM\leftskip\z@\rightskip\z@
    \spaceskip\z@\xspaceskip\z@
% This differs from the original:
  \fitem{#1}\footstrut\ignorespaces#2\unskip\lower\dp\strutbox
  \vbox to\dp\strutbox{}}}
  \footmarkcount@\z@
\def\footnotemark{%
 \let\@sf\empty\relaxnext@\ifhmode\edef
 \@sf{\spacefactor\the\spacefactor}\/\fi
 \def\next@{\ifx[\next\let\next\nextii@\else
  \ifx"\next\let\next\nextiii@\else
  \let\next\nextiv@\fi\fi\next}% and from here
 \def\nextii@[##1]{\footmarkform@{##1}\@sf}%
 \def\nextiii@"##1"{{##1}\@sf}%
 \def\nextiv@{{\scriptfont0=\sevenrm % scriptfont changed to 7pt
  \global\advance\footmarkcount@\@ne
  \footmarkform@{\number\footmarkcount@}\@sf}}%
 \futurelet\next\next@}
\def\footnotetext{\relaxnext@
 \def\next@{\ifx[\next\let\next\nextii@\else
  \ifx"\next\let\next\nextiii@\else
  \let\next\nextiv@\fi\fi\next}%
 \def\nextii@[##1]##2{\makefootnote@{%
  \footmarkform@{##1}}{{\frenchspacing##2}}}% {\frenchspacing} added
 \def\nextiii@"##1"##2{\makefootnote@{##1}{{\frenchspacing##2}}}%
 \def\nextiv@##1{\makefootnote@{%
  \footmarkform@{\number\footmarkcount@}}{{\frenchspacing}##1}}%
 \futurelet\next\next@}
\def\footnote{\let\@sf\empty\relaxnext@\ifhmode\edef
 \@sf{\spacefactor\the\spacefactor}\/\fi
 \def\next@{\ifx[\next\let\next\nextii@\else
  \ifx"\next\let\next\nextiii@\else
  \let\next\nextiv@\fi\fi\next}%
 \def\nextii@[##1]##2{%
  \footnotemark[##1]\footnotetext[##1]{{\frenchspacing##2}}}%
 \def\nextiii@"##1"##2{%
  \footnotemark"##1"\footnotetext"##1"{{\frenchspacing##2}}}%
 \def\nextiv@##1{\footnotemark\footnotetext{{\frenchspacing##1}}}%
 \futurelet\next\next@}
\def\adjustfootnotemark#1{\advance\footmarkcount@#1\relax}

\def\ref{\unskip\footnote}% Remove space from \se if necessary

% Prevent footnote splitting

\interfootnotelinepenalty=10000 % No splitting of footnotes
\skip\footins=12pt plus 2pt minus 4pt
% space added when footnote is present - taken from manmac


% Part 6 - Macros to set all counts to zero

\def\clearnotenumber{\footmarkcount@\z@} % footnote counter 
\def\clearrecno{\recno=64}         % Recital counter: 65 is `A'
\def\clearclno{\clno=0}            % Clause etc counters
\def\clearsclno{\sclno=0}
\def\clearssclno{\ssclno=96}       % 97 is `a'
\def\clearsssclno{\sssclno=0}
\def\clearssssclno{\ssssclno=96}
\def\clearsssssclno{\sssssclno=96}
\def\cleargreekno{\greekno="010A}  % "010B is alpha "027C is heart
\def\clearcardno{\cardno="027B}    % "027C is heart-suit
\def\clearexno{\exno=0} % exhibits
\def\clearpageno{\pageno=1 \footline={\hss\tenrm\folio\hss}}

\def\reset{%
  \clearrecno
  \clearclno
  \clearsclno
  \clearssclno
  \clearsssclno
  \clearssssclno
  \clearsssssclno
  \cleargreekno
  \clearcardno
  \clearexno
  \clearnotenumber
  \clearpageno
  \clauselevel=0}


% Part 7 - Automatic clause numbering

% The #1 in \xcl etc. is the clause number
% These macros do not increase the count regs.
% \ignorespaces is used to excess since these macros
% can be abused somewhat - leading to odd spaces
% appearing in unexpected places!

\def\xcl#1{\clearsclno% Set scl counter to zero
  \dimen0=\the\parindent\parindent=0pt% store current setting
  \ifclind \hangindent=\clindent \else\hangindent=\hclindent\fi
  \clauselevel=1
  \hangafter=1
  \vskip\clskip
  \edef\testit{#1}%
  \ifx\testit\empty\hangafter0\noindent
  \else
    \leavevmode\hbox to\clindent{%
      \ignorespaces#1\hfil}\ignorespaces
  \fi
  \parindent=\the\dimen0\relax
  \ignorespaces}

\def\xscl#1{\clearssclno %
  \dimen0=\the\parindent \parindent=0pt 
  % Note the difference between next line and same in \xsscl
  % This seems to be essential
  \ifnum\prevgraf=0\kern-\clindent\else\vskip\sclskip\fi
  \ifclind \hangindent=\sclindent \else\hangindent=\hsclindent\fi
  \clauselevel=2
  \hangafter=1
  \edef\testit{#1}%
  \ifx\testit\empty\hangafter0\noindent
  \else\leavevmode\unskip\hbox to \sclindent{%
    \hskip\clindent\ignorespaces #1\hfil}%
    \ignorespaces
  \fi
  \parindent=\the\dimen0\relax
  \unskip\ignorespaces}

\def\xsscl#1{\clearsssclno % \advance\ssclno by 1
  \dimen0=\the\parindent \parindent=0pt
  \ifdim\hangindent>0pt \kern-\sclindent\else\vskip\ssclskip\fi
  \ifclind \hangindent=\ssclindent \else\hangindent=\hssclindent\fi
  \clauselevel=3
  \hangafter=1
  \edef\testit{#1}%
  \ifx\testit\empty\hangafter0\noindent
  \else
    \leavevmode\unskip\hbox to \ssclindent{%
    \hskip\sclindent
    \ignorespaces #1\hfil}\ignorespaces
  \fi
  \parindent=\the\dimen0\relax
  \unskip\ignorespaces}

\def\xssscl#1{\clearssssclno \cleargreekno % \advance\sssclno by 1
  \dimen0=\the\parindent \parindent=0pt
  \ifdim\hangindent>0pt \kern-\ssclindent\else\vskip\sssclskip\fi
  \ifclind \hangindent=\sssclindent \else\hangindent=\hsssclindent\fi
  \clauselevel=4
  \hangafter=1
  \edef\testit{#1}%
  \ifx\testit\empty\hangafter0\noindent
  \else
    \leavevmode\unskip\hbox to \sssclindent{%
    \hskip\ssclindent
    \ignorespaces #1\hfil}\ignorespaces
  \fi
  \parindent=\the\dimen0\relax
  \aftergroup\ignorespaces}

\def\xsssscl#1{\clearsssssclno \clearcardno
  \dimen0=\the\parindent \parindent=0pt
  \ifdim\hangindent>0pt \kern-\sssclindent\fi
  \ifclind \hangindent=\ssssclindent \else\hangindent=\hssssclindent\fi
  \clauselevel=5 % This is not used as yet
  \hangafter=1
  \edef\testit{#1}%
  \ifx\testit\empty\hangafter0\noindent
  \else
  \leavevmode\unskip\hbox to \ssssclindent{%
    \hskip\sssclindent
    \ignorespaces #1\hfil}\ignorespaces
  \fi
  \parindent=\the\dimen0\relax
  \aftergroup\ignorespaces}

\def\xssssscl#1{% Nothing to clear!
  \dimen0=\the\parindent \parindent=0pt
  \ifdim\hangindent>0pt \kern-\ssssclindent\fi
  \ifclind \hangindent=\sssssclindent 
    \else\hangindent=\hsssssclindent\fi
  \clauselevel=6
  \hangafter=1
  \edef\testit{#1}%
  \ifx\testit\empty\hangafter0\noindent
  \else
    \leavevmode\unskip\hbox to \sssssclindent{%
      \hskip\ssssclindent
      \ignorespaces #1\hfil}\ignorespaces
  \fi
  \parindent=\the\dimen0\relax
  \aftergroup\ignorespaces}

% The Recital macros use \xcl and \xscl
% Recitals have the same indentation as Clauses.

\def\rec{\clauselevel=0%
  \advance\recno by1 \xcl{(\char\the\recno)}}% Letter A
\def\srec{\clauselevel=0
  \advance\sclno by1 \xscl{(\romannumeral\the\sclno)}}% Small Roman i

% Now Clauses etc

\def\normalnumbering{%
  \def\cl{\advance\clno by1\xcl{\the\clno.}}%
  \def\scl{\advance\sclno by1\xscl{(\the\sclno)}}%
  \def\sscl{\advance\ssclno by1\xsscl{(\char\the\ssclno)}}%
  \def\ssscl{\advance\sssclno by1\xssscl{%
    (\romannumeral\the\sssclno)}}%
  \def\sssscl{\advance\ssssclno by1 \advance\greekno by1\xsssscl{%
    \ifgreek($\mathchar\the\greekno$)
    \else(\char\the\ssssclno\char\the\ssssclno)\fi}}%
  \def\ssssscl{\advance\sssssclno by1 \advance\cardno by1\xssssscl{%
    \ifcard($\mathchar\the\cardno$)
    \else\ifgreek(\char\the\sssssclno\char\the\sssssclno)
    \else(\char\the\sssssclno\char\the\sssssclno
    \char\the\sssssclno)\fi\fi}}}

\def\computernumbering{%
  \clindent=\the\cnindent
  \sclindent=\the\cnindent
  \ssclindent=\the\cnindent
  \sssclindent=\the\cnindent
  \ssssclindent=\the\cnindent
  \sssssclindent=\the\cnindent
  \hclindent=0pt % Indentation of clauses if clindfalse
  \hsclindent=0pt
  \hssclindent=0pt
  \hsssclindent=0pt
  \hssssclindent=0pt
  \hsssssclindent=0pt
  \def\clearssclno{\ssclno=0}%       97 is `a'
  \def\clearssssclno{\ssssclno=0}%
  \def\clearsssssclno{\sssssclno=0}%
  \def\clearrecno{\recno=0}%
  \def\cl{\advance\clno by1\xcl{\the\clno.}}%
  \def\scl{\advance\sclno by1\xscl{\unskip\the\clno.\the\sclno.}}%
  \def\sscl{\advance\ssclno by1\xsscl{%
    \unskip\the\clno.\the\sclno.\the\ssclno.}}%
  \def\ssscl{\advance\sssclno by1\xssscl{%
    \unskip\the\clno.\the\sclno.\the\ssclno.\the\sssclno.}}%
  \def\sssscl{\advance\ssssclno by1\xsssscl{%
    \unskip\the\clno.\the\sclno.\the\ssclno.\the\sssclno\the\ssssclno.}}%
  \def\ssssscl{\advance\sssssclno by1\xssssscl{%
    \unskip\the\clno.\the\sclno.\the\ssclno.%
    \the\sssclno\the\ssssclno.\the\sssssclno.}}%
  \def\rec{\clauselevel=0%
    \advance\recno by1 \xcl{\unskip\the\recno.}}%
  \def\srec{\clauselevel=0
    \advance\sclno by1 \xscl{\unskip\the\recno.\the\sclno.}}%
  \def\hcl##1\par{\cl{\bf##1}\par\nobreak}%
  }

% The \ncl "clauses" have the same indentation - but no numbers

\def\ncl{\xcl{}}
\def\nscl{\xscl{}}
\def\nsscl{\xsscl{}}
\def\nssscl{\xssscl{}}
\def\nsssscl{\xsssscl{}}
\def\nssssscl{\xssssscl{}}

\def\tcl#1{% For use with text or numbers longer than \clindent.
  \clearsclno% Set scl counter to zero
  \dimen0=\the\parindent\parindent=0pt% store current setting
  \ifclind \hangindent=\clindent \else\hangindent=\hclindent\fi
  \clauselevel=1
  \hangafter=1
  \vskip\clskip
  \leavevmode\hbox{% to\clindent{%
    \ignorespaces#1\space}\ignorespaces
  \parindent=\the\dimen0\relax
  \ignorespaces}

% \def\tscl etc to follow


% Part 8

% The contents, index and cross-reference macros
% First, the commands to use them

\def\contents{\contentstrue \writecontents}
\def\marginalnotes{\marginalnotestrue}

% Minor definitions

\def\ctstitle#1{\gdef\titlename{\vtop{#1}}}% Title used on Contents page
\ctstitle{}% Default is nothing

% Use this for sub-headings in Table of Contents 
\def\stitle#1{% 
  \xdef\next{\write\cont{\string\centerline{%
  \string\vtop{\string#1}}\par
  \string\nobreak\string\medskip}}\next
  \inform{#1}}

\def\contentsname{Table of Contents}% Obvious.

\gdef\topofcontents{\centerline{\titlefont\titlename}
  \bigskip\centerline{\titlefont\contentsname}
  \vfill} % this material will start the table of contents page
\def\botofcontents{\vfill\eject} % this material will end it
\def\contentspagenumber{-1} % default page number for table of contents
\def\contentsreadfile{\jobname.cts} % file that gets table of contents info
\def\contentswritefile{\jobname.cts} % file that takes it
\def\writecontents{\inform{Opening contents file: }
  \openout\cont=\contentswritefile}
\def\readcontents{\input \contentsreadfile}
\def\leaderfill{\leaders\hbox to .75em{\hss.\hss}\hfil}
\def\clname{Clause}
\def\xreffile{\jobname.xrf}
\def\raggedleft{\leftskip=0pt plus 4em% see tb p101
 \spaceskip=.3333em \xspaceskip=.5em } % Can be used in mnote
\def\bigpenalty{\penalty10000\ }
\def\xrfwarn#1{%
   \xrfmissingtrue
   \warn{This cross-reference (#1) does not exist.}
   \inform{Re-run TeX on the file.}
   }

% Now the contents macros themselves.

\def\printcontents{% Print the contents
  \write\cont{}% ensure that the contents file isn't empty  
  \immediate\closeout\cont% contents information has been fully gathered
  \pageno=\contentspagenumber
  \inform{Table of contents: }%
  \topofcontents
  \line{\hfill Page}%
  \medskip
   \advance\baselineskip by0pt plus1pt minus0pt % add some give
   \readcontents\relax % read the contents info
   \botofcontents }% print the contents page(s), don't terminate

% TUGboat 1987/3/310 + tb p 423

\let\hat=\^ % Is this necessary?
 
% Note that the order of the lines in \specialhat is critical

\def\specialhat{\ifmmode\def\next{^}
  \else\let\next=\checkit\fi\next}
\def\checkit{\futurelet\next\testdoublehat}
\def\testdoublehat{\ifx\next\specialhat\let\next=\silentnote
  \else\visibletrue\let\next=\anote\fi \next}%
\catcode`\^=\active \let ^=\specialhat
\def\silentnote^{\visiblefalse\anote}% 
\def\mnote#1{%
  \strut\vadjust{%
    \kern-\dp\strutbox
    \vtop to \dp\strutbox{%
      \vss\baselineskip=\dp\strutbox
%     \moveleft\notespace
      \moveright\notespace\rightline{%
        \rlap{%
          \hbox{%
            \ninebase=12pt \ninepoint
            \vbox to \ht\strutbox{%
              \hsize\maxnote \raggedright
              \tolerance=1000
              \leftskip=0pt
              \rightskip=0pt plus.6\maxnote
              \noindent\bf\strut#1% \strut
              \vss
              }% end of \vbox to \ht\strutbox
            }% end of \hbox
          }%  end of \rlap
        } % end of \rightline
      \null
      }% end of \vtop tp \dp\strutbox
    }% end of \vadjust
  }% end of \mnote

% Note that this now works on the basis that a space before the 
% macro is neutral, ie printed unless it follows a macro
% and a space following the macro is ignored. Therefore no added \space
% at the beginning of \silentnote and ignorespaces at the end of \anote
% and possibly also of \mnote.

\def\anote#1{%
  \ifvisible\null\fi
  \ifmarginalnotes\ignorespaces\mnote{#1}\fi
  \ifcontents\ifcase\number\clauselevel% 
    \contentsentry{#1}% \clauselevel=0
    \or\clcont{#1}%     \clauselevel=1
    \or\sclcont{#1}%    \clauselevel=2
    \or\ssclcont{#1}%   \clauselevel=3
    \or\sssclcont{#1}%  \clauselevel=4
    \or\inform{This (#1) will not appear in the table of contents}% =5
    \or\inform{This (#1) will not appear in the table of contents}% =6
    \fi\fi%
  \ifvisible#1\else\unskip\ignorespaces\fi
}%

% Now the macros to deal with \cl etc in contents

\def\clcont#1{%
  \xdef\next{\write\cont{\string\line{%
  \setbox0=\hbox{\clname\ \hbox to 20pt{\testit\hfil}}%
  \global\clnamelength=\wd0\copy0#1
  \string\leaderfill\noexpand\number\pageno}}}\next
  \inform{\testit\space#1}}%

\def\sclcont#1{%
  \xdef\next{\write\cont{\line{\hskip\clnamelength%
  \hbox to 25pt{\testit\hfil}#1
  \string\leaderfill\noexpand\number\pageno}}}\next%
  \inform{  \testit\space#1}}%

\def\ssclcont#1{%
  \xdef\next{\write\cont{\line{\hskip\clnamelength\hskip25pt%
  \hbox to 20pt{\testit\hfil}#1
  \string\leaderfill\noexpand\number\pageno}}}\next%
  \inform{      [ascii \testit] #1}} 

\def\sssclcont#1{%
  \xdef\next{\write\cont{\line{\hskip\clnamelength\hskip45pt%
  \hbox to 20pt{\testit\hfil}#1
  \string\leaderfill\noexpand\number\pageno}}}\next%
  \inform{      (\romannumeral\the\sssclno) #1}} 

\def\contentsentry#1{%
  \xdef\next{\write\cont{\line{#1
    \string\leaderfill\noexpand\number\pageno}}}\next%
  \inform{#1}} % Use this as eg \contentsentry{Parties}


% These are the cross-ref macros by S v. B (adapted)

% First, do we have xrefs?

\def\checkoldxrf{%
  \ifoldxrffile\let\next\relax\else\let\next\getxrefs\fi\next}

\gdef\getxrefs{%
  \null\global\oldxrffiletrue\inform{Opening xrf file }%
  \immediate\openin\xrf=\xreffile\relax
  \ifeof\xrf
   \xrfmissingtrue
   \inform{}%
   \inform{WARNING: \xreffile\space is empty, or does not exist.}%
   \inform{Re-run TeX on the file.}%
   \inform{}%
  \else\xrefstrue\fi
  \immediate\closein\xrf\relax
  \ifxrefs\input\xreffile\relax\fi
  \immediate\openout\xrf=\xreffile\relax
  }

\def\newxref #1#2#3#4#5#6{%
  \expandafter\gdef\csname CLREF-#1\endcsname{#2%
      \inform{    (Cross-reference to #2)}}%
  \expandafter\gdef\csname PAGEREF-#1\endcsname{#6%
      \inform{    (Cross-reference to #6)}}%
  \expandafter\gdef\csname NOTEREF-#1\endcsname{#3%
      \inform{    (Cross-reference to #3)}}%
  \expandafter\gdef\csname SCHEDREF-#1\endcsname{#4%
      \inform{    (Cross-reference to #4)}}%
  \expandafter\gdef\csname APPREF-#1\endcsname{#5%
      \inform{    (Cross-reference to #5)}}%
  }

\def\clref#1{%
  \checkoldxrf
  \expandafter
   \ifx\csname CLREF-#1\endcsname\relax\xrfwarn{#1}\unskip[Clause ???]\fi
  \csname CLREF-#1\endcsname
  }

\def\pararef#1{%
  \begingroup
   \def\clause{Paragraph}%
   \def\subclause{sub-paragraph}%
   \def\paragraph{sub-sub-paragraph}%
   \def\subparagraph{sub-sub-sub-paragraph}%
   \clref{#1}%
  \endgroup
  }

\def\pageref #1{%
  \checkoldxrf
  \ignorespaces
  \expandafter
   \ifx\csname PAGEREF-#1\endcsname\relax\xrfwarn{#1}\unskip[Page ???]\fi
  \csname PAGEREF-#1\endcsname
  }

\def\noteref #1{%
  \checkoldxrf
  \ignorespaces
  \expandafter
   \ifx\csname NOTEREF-#1\endcsname\relax\xrfwarn{#1}\unskip[Footnote ???]\fi
  \csname NOTEREF-#1\endcsname
  }

\def\schedref #1{%
  \checkaux
  \checkoldxrf
  \ignorespaces
  \ifmanyscheds
    \expandafter
    \ifx\csname SCHEDREF-#1\endcsname\relax\xrfwarn{#1}\unskip[Schedule ???]\fi
    \csname SCHEDREF-#1\endcsname
  \else\xrfwarn{#1} the Schedule %
  \fi
  }

\def\appref #1{%
  \checkauxref
  \checkoldxrf
  \ignorespaces
  \ifmanyappends
    \expandafter
    \ifx\csname APPREF-#1\endcsname\relax\xrfwarn{#1}\unskip[Appendix ???]\fi
    \csname APPREF-#1\endcsname
  \else\xrfwarn{#1} the Appendix %
  \fi
  }

\def\xrfwarn#1{%
   \xrfmissingtrue
   \warn{This cross-reference (#1) does not exist.}%
   \inform{Re-run TeX on the file.}%
   }

\def\writexref{\write\xrf}
\def\nsnbps{\noexpand\string\noexpand\bigpenalty\space}% shorthand
\def\nsn{\noexpand\string\noexpand}

\def\clause{Clause}
\def\subclause{sub-clause}
\def\paragraph{paragraph}
\def\subparagraph{sub-paragraph}

\def\xref#1{%
  \checkoldxrf
  \ignorespaces 
  \xdef\fct{\the\footmarkcount@}%
  \xdef\schct{\fullnumbers{\the\schedcount}}%
  \xdef\appct{\fullnumbers{\the\appendixcount}}%
  \edef\xreftemp{%
    \nsn\ignorespaces%
    \nsn\newxref%
    {#1}% becomes Parameter 1 to \newxref
    {\ifcase\number\clauselevel%
       \or \nsn\clause\nsnbps\the\clno%
       \or \nsn\subclause\nsnbps(\the\sclno)%
       \or \nsn\paragraph\nsnbps(\char\the\ssclno)%
       \or \nsn\subparagraph\nsnbps(\romannumeral\the\sssclno)%
     \fi}% becomes Parameter 2 to \newxref
    {Footnote\nsnbps\fct}% becomes Parameter 3 to \newxref
    {the \schct\nsnbps Schedule}% becomes Parameter 4 to \newxref
    {the \appct\nsnbps Appendix}% becomes Parameter 5 to \newxref
    }% End of \xreftemp
  \expandafter\expandafter\expandafter%
   \writexref\expandafter{%
    \xreftemp{%
      Page\noexpand\bigpenalty\the\pageno\noexpand\ignorespaces}% Param 6 to \newxref
    \string\unskip}%
    \unskip\ignorespaces}% Final unskip now unnec.

% Gulp


% Part 9 - Miscellaneous macros start here:

\def\hangit{\hangindent\clindent}

\def\per{\ca per\se}

\def\ruledtable{% Get TeXsis macros
  \input txsruled\relax
  \ruledtable}

\def\nofancystuff{% Get rid of fancy fonts, disliked by \write's
  \def\xo{}\def\xxo{}\def\xxxo{}%
  \def\ul{}\def\uul{}\def\uuul{}%
  \def\setamendcount##1{}%
  \def\ignorespaces{}%
  \def\bigpenalty{ }}

\def\inform#1{{\nofancystuff\immediate\write16{#1}}}
\def\warn#1{{\nofancystuff\immediate\write16{}\immediate\write16{WARNING: #1}
  \immediate\write16{}}}

% Manmac macros for verbatim scanning
\chardef\other=12
\def\ttverbatim{\begingroup
  \catcode`\\=\other
  \catcode`\{=\other
  \catcode`\}=\other
  \catcode`\$=\other
  \catcode`\&=\other
  \catcode`\#=\other
  \catcode`\%=\other
  \catcode`\~=\other
  \catcode`\_=\other
  \catcode`\^=\other
  \catcode`\*=\other
  \obeyspaces \obeylines \tt}

\outer\def\begintt{$$\let\par=\endgraf \ttverbatim \parskip=\z@
  \catcode`\|=0 \rightskip-5pc \ttfinish}
{\catcode`\|=0 |catcode`|\=\other % | is temporary escape character
  |obeylines % end of line is active
  |gdef|ttfinish#1^^M#2\endtt{#1|vbox{#2}|endgroup$$}}
\catcode`\|=\active
{\catcode`\^=7
\obeylines \gdef|{\ttverbatim \spaceskip\ttglue \let^^M=\  \let|=\endgroup}}

% macros to demarcate lines quoted from TeX source files
\def\beginlines{\par\begingroup\nobreak\medskip\parindent\z@ \obeylines
  \hrule\kern1pt\nobreak \everypar{\strut}}
\def\nrbeginlines{\par\begingroup\nobreak\medskip\parindent\z@ \obeylines
  \kern1pt\nobreak \everypar{\strut}}
\def\endlines{\kern1pt\hrule\endgroup\medbreak\noindent}
\def\weakendlines{\kern1pt\hrule\endgroup\medskip\noindent}
\def\finalendlines{\kern1pt\hrule\endgroup\medbreak}
\def\nrendlines{\kern1pt\endgroup\smallskip\noindent}

\gdef\blank{\space\hglue\blankskip}%5 Oct 90

\def\noaddr{\phantom{11}\blank\phantom{Rail-}\blank
  \phantom{way}\blank\phantom{Cutt-}\blank\phantom{ings}
  \blank\phantom{Cheam}\blank
  \phantom{Lon-}\blank\phantom{don}\blank\phantom{SW12}
  \blank}

\gdef\noday{\phantom{31st\ }\blank}
\gdef\nomonth{\phantom{January\ }\blank}
\gdef\noyear{\noday\ day of %
  \nomonth\ }
\gdef\nodate{\noyear\number\year\penalty-150\maybespace}

\def\noname{\phantom{Anthony}\blank\phantom{Aloy-}
  \blank\phantom{nsius }\blank\phantom{Hancock}
  \blank}

\def\nopounds{\pounds\phantom{50,000}\maybespace}

\gdef\initials#1{\xdef\inits{#1}} 
  \initials{}
\def\exhibit{\advance\exno by1 ``\hbox{\ifx\inits{}
  \else\inits\,\ignorespaces\fi\the\exno}''}

\def\exhibited{produced and shown to me marked \exhibit\maybespace}

\def\bundled{produced and shown to me bundled together %
  and marked \exhibit\maybespace} % note maybespace

\newif\ifversion
\gdef\version#1{%
 \versiontrue
 \edef\versno{#1}
 \footline={\llap{\fiverm\versno}\hss\tenrm\folio\hss}}

% Amstex oldnos macros:
\def\oldnos#1{\ifmmode{\mathcode`\,="013B \fam\@ne#1}\else
  \leavevmode\hbox{$\mathcode`\,="013B \fam\@ne#1$}\fi}

% minor macros from manmac
\def\bull{\vrule height .9ex width .8ex depth -.1ex } % square bullet
\def\|{\leavevmode\hbox{\tt\char`\|}} % vertical line
\def\]{\leavevmode\hbox{\tt\char`\ }} % visible space

\def\Filbreak{\par\vskip\bigskipamount % used in \ssd etc.
 \vfil\penalty-200\vfilneg} % Adapted from \filbreak

% \today etc

\def\st{st}
\def\nd{nd}
\def\rd{rd}
\def\th{th}

\def\addsuffix#1{#1\ignorespaces\ifcase#1%
  \or\st\or\nd\or\rd\or\th\or\th\or\th\or\th\or\th\or\th\or\th
  \or\th\or\th\or\th\or\th\or\th\or\th\or\th\or\th\or\th\or\th
  \or\st\or\nd\or\rd\or\th\or\th\or\th\or\th\or\th\or\th\or\th\or\st\fi}

\def\today{%
  \addsuffix{\number\day}%
  \space
  \ifcase\month\or January\or February\or March\or April\or May\or
  June\or July\or August\or September\or October\or November\or December\fi
  \ifnocommaindate\space\else,\space\fi
  \number\year}

\def\longtoday{%
  \addsuffix{\number\day}%
  \space
  day of\space
  \ifcase\month\or January\or February\or March\or April\or May\or
  June\or July\or August\or September\or October\or November\or December\fi
  \ifnocommaindate\space\else,\space\fi
  \number\year}
  
\newif\ifwrongmonth
\newcount\feb

\def\leapcheck{%
 \count0=\number\year
 \advance\count0 by-1900
 \count1=\the\count0
 \divide\count0 by4
 \multiply\count0 by4
 \ifnum\count0=\number\count1
  \feb=29%
  \else\feb=28%
 \fi}

\def\increasedays{%
  \ifcase\month% month 0
   \or\daysinmonth{31}% jan
   \or\leapcheck\daysinmonth{\feb}% feb. Not a leap year
   \or\daysinmonth{31}% mar
   \or\daysinmonth{30}% apr
   \or\daysinmonth{31}% may
   \or\daysinmonth{30}% jun
   \or\daysinmonth{31}% jul
   \or\daysinmonth{31}% aug
   \or\daysinmonth{30}% sep
   \or\daysinmonth{31}% oct
   \or\daysinmonth{30}% nov
   \or\daysinmonth{31}% dec
  \fi}

\def\reducedays{%
  \ifcase\month% month 0
   \or\daysinlastmonth{31}% dec
   \or\daysinlastmonth{31}% jan
   \or\leapcheck\daysinlastmonth{\feb}% feb. Not a leap year
   \or\daysinlastmonth{31}% mar
   \or\daysinlastmonth{30}% apr
   \or\daysinlastmonth{31}% may
   \or\daysinlastmonth{30}% jun
   \or\daysinlastmonth{31}% jul
   \or\daysinlastmonth{31}% aug
   \or\daysinlastmonth{30}% sep
   \or\daysinlastmonth{31}% oct
   \or\daysinlastmonth{30}% nov
  \fi}

\def\daysinmonth#1{%
 \ifnum\day>#1 \wrongmonthtrue
  \advance\day by-#1 
  \advance\month by1
  \ifnum\month=13 \month=1
   \advance\year by1
  \fi
 \fi}

\def\daysinlastmonth#1{%
 \ifnum\day<1 \wrongmonthtrue
  \advance\day by#1 
  \advance\month by-1
  \ifnum\month=0 \month=12
   \advance\year by-1
  \fi
 \fi}

\def\futureday#1{%
 {\advance\day by#1
  \loop
  \wrongmonthfalse
   \begingroup
     \ifnum#1<0 
      \aftergroup\reducedays
     \else 
      \aftergroup\increasedays
     \fi
   \endgroup
 \ifwrongmonth
  \repeat
 \today
 }}

\def\tomorrow{%
  \futureday{1}}

\def\yesterday{%
  \futureday{-1}}

% Taken from the LaTeX extensions.sty
\def\@dow{\count2 }                        % gets day of the week
\def\@leap{\count5 }                       % leap year fingaler
\def\@x{\count6 }                          % temp register
\def\@y{\count7 }                          % another temp register


\def\dayofweek{{%
%            leap = year + (month - 14)/12;
  \@leap=\month \advance\@leap by -14 \divide\@leap by 12
  \advance\@leap by \year
%            dow = (13 * (month + 10 - (month + 10)/13*12) - 1)/5
  \@dow=\month \advance\@dow by 10
  \@y=\@dow \divide\@y by 13 \multiply\@y by 12
  \advance\@dow by -\@y \multiply\@dow by 13 \advance\@dow by -1 \divide\@dow by 5
%            dow += day + 77 + 5 * (leap % 100)/4
  \advance\@dow by \day \advance\@dow by 77
  \@x=\@leap \@y=\@x \divide\@y by 100 \multiply\@y by 100 \advance\@x by -\@y
  \multiply\@x by 5 \divide\@x by 4 \advance\@dow by \@x
%            dow += leap / 400
  \@x=\@leap \divide\@x by 400 \advance\@dow by \@x
%            dow -= leap / 100 * 2;
%            dow = (dow % 7)
  \@x=\@leap \divide\@x by 100 \multiply\@x by 2 \advance\@dow by -\@x
  \@x=\@dow \divide\@x by 7 \multiply\@x by 7 \advance\@dow by -\@x
  \ifcase\@dow Sunday\or Monday\or Tuesday\or Wednesday\or
      Thursday\or Friday\or Saturday\fi}}


% The signature macros. These have been simplified & extended.

\edef\lincoln{\hbox{Lincoln's Inn}}
\def\grays{\hbox{Gray's Inn}}
\def\temple{\hbox{\Temple}}
\def\middletemple{\hbox{Middle Temple}}
\def\innertemple{\hbox{Inner Temple}}
\let\inn=\lincoln

\def\signed{%
  \par\nobreak
  \vfill
  \hbox{\hskip\signindent\vtop{%
  \parindent0pt
  \inn
  \hbox{\today}}}
  \vfill\vfill}

\def\csettled#1{%
  \par\nobreak
  \vfill
  \hbox{\hskip\signindent\vtop{%
  \advance\hsize by-\signindent
  \parindent0pt
  \raggedright\tolerance=1000
  Settled, \ignorespaces#1
  \vskip\settledgap
  \inn
  \hbox{\today}}}
  \vfill\vfill}

\def\cresettled#1{% Note the \par
  \par\nobreak
  \vfill
  \hbox{\hskip\signindent\vtop{%
  \advance\hsize by-\signindent
  \parindent0pt
  \raggedright\tolerance=1000
  Re-Settled, \ignorespaces#1
  \vskip\settledgap
  \inn
  \hbox{\today}}}
  \vfill\vfill}

\gdef\settled{%
  \csettled{}}

\def\resettled{%
  \cresettled{}}

\def\jointsettled{%
  \multiply\settledgap by2
  \csettled{}}


% Part 10

% The signed sealed and delivered macros

% First, adapt \cases from plain
\def\rcases#1{\left.\vcenter{\normalbaselines\m@th
  \ialign{$##\hfil$&\quad##\hfil\crcr#1\crcr}}\,\right\}}

\def\rbracket#1{\noindent$\rcases{% Put a large bracket at R.
  \tolerance=3000\pretolerance=3000\parskip=0pt\hfuzz=1.75pt
  \hbadness=9999
  \doublehyphendemerits=200
  \finalhyphendemerits=200
  \adjdemerits=200
  \vbox{\hsize=\rbracketsize{#1}}}$}

\def\lbracket#1{\noindent $\cases{% Put a large bracket at L.
  \tolerance=2000\pretolerance=2000\parskip=0pt\hfuzz=1.75pt
  \hbadness=9999
  \doublehyphendemerits=500
  \finalhyphendemerits=200
  \adjdemerits=200
  \vbox{\hsize=\lbracketsize{#1}}}$}

\def\ssgen#1{\clauselevel=0%
  {\raggedright\rbracket{% As \rbracket, but space below text
  #1\hfil\break\vtop to\brackdepth{}}}}

% Text for use in contents macros
\def\attestationtext{Attestation}
\def\electiontext{Fiscal Election}
\def\testimoniumtext{Testimonium}
\def\stampdutytext{Stamp Duty Certificate}


\def\ssd#1{%
  \clauselevel=0%
  \ifnum\ssdcount>0\Filbreak
  \else
   \par\nobreak\bigskip\bigskip^^{\attestationtext}%
  \fi
  \advance\ssdcount by1
  \ssgen{\hbox{SIGNED AS A DEED} by %
  #1 in the presence of---}%
  \par}

\def\ssc#1{%
  \clauselevel=0%
  \ifnum\ssdcount>0\Filbreak
  \else
   \par\nobreak\bigskip\bigskip^^{\attestationtext}%
  \fi
  \advance\ssdcount by1
  \ssgen{\hbox{THE COMMON SEAL of }%
  #1 was affixed hereunto in the presence of---}%
  \par}

\def\ssw#1{%
  \par\nobreak\bigskip\bigskip^^{\attestationtext}%
  \ssgen{\brackdepth=1in SIGNED by #1 %
  the Testator as and for his last Will
  and Testament in our presence and by us in his---}%
  \par}
%
\def\witness{%
  \par\clauselevel=0
  \nobreak\vbox{\bigskip IN WITNESS whereof the parties hereto have signed
  this instrument as a deed in the presence of the persons mentioned
  below}^^{\testimoniumtext}%
  \par}

\def\singlewitness{%
  \par\clauselevel=0
  \nobreak
  \vbox{\bigskip IN WITNESS whereof this instrument has been signed as
    a deed in the presence of the person mentioned
    below}^^{\testimoniumtext}%
  \par}

\def\sworn{%
  \clauselevel=0^^{\attestationtext}%
  \par\nobreak\vskip3\clskip
  \vtop{\rbracket{%
    SWORN at\hfil\break
    \vtop to\normalbaselineskip{}\hfil\break
    in the County of\hfil\break
    this \nodate\break
    before me---\hfil\break
   \vtop to\brackdepth{}\hfil\break
   \hbox{A Solicitor empowered to take Oaths}\hfil}\par}}

\def\whereas{\medskip\clauselevel=0 WHEREAS---}
\def\now{\medbreak\clauselevel=0 NOW THIS DEED WITNESSETH as follows---}
\def\wwhereas{\medskip\clauselevel=0 WHEREAS }
\def\nnow{\medbreak\clauselevel=0 NOW THIS DEED WITNESSETH }

\def\witnessetc{\clauselevel=0 \par
  \nobreak\vbox{\bigskip IN WITNESS, \etc^^{\testimoniumtext}}
  }

\def\swornetc{\clauselevel=0 \par
  \nobreak\vbox{\bigskip SWORN, \etc^^{\testimoniumtext}}
  }

\def\election{\par\cl^^{\electiontext}%
  \unskip\ignorespaces
  The parties hereto hereby elect %
  that the provisions of Section~49~(6) of the %
  Capital Gains Tax Act~1979 %
  and Section~142~(1) of the Inheritance Tax Act~1984 %
  shall apply to the variation hereby made\par}

\def\sdcert#1{\par
  \cl^^{\stampdutytext}It is hereby certified %
   that this instrument %
   falls within category #1 in the Schedule to the %
   Stamp Duty (Exempt Instruments) Regulations~1987\par}

\def\dovcert{\sdcert{L}}
\def\giftcert{\sdcert{M}}

% Somewhat complicated macros to produce automatically
% numbered Schedules and Appendixes

\newcount\appendixcount
\gdef\appendix{%
  \checkaux
  \ifnum\appendixcount=1
    \write\aux{\noexpand\manyappendstrue}%
  \fi
  \clauselevel=0
  \clearclno
  \ifnum\appendixcount>0
    \bigbreak
  \else
    \par\nobreak\bigskip
  \fi
  \advance\appendixcount by1
  \ifmanyappends
    \centerline{^{THE \ucfullnumbers{\the\appendixcount}
      \unskip\space APPENDIX}}
  \else
    \centerline{^{THE APPENDIX}}
  \fi
  \nobreak
  \smallskip}

\gdef\schedule{%
  \checkaux
  \ifnum\schedcount=2
    \write\aux{\string\manyschedstrue}%
  \fi
  \clauselevel=0
  \clearclno
  \ifnum\schedcount>0
    \bigbreak
  \else
    \par\nobreak\bigskip
  \fi
  \advance\schedcount by1
  \ifmanyscheds
    \centerline{^{THE \ucfullnumbers{\the\schedcount}
     \unskip\space SCHEDULE}}
  \else
    \centerline{^{THE SCHEDULE}}
  \fi
  \nobreak
  \smallskip}
  
\def\fullnumbers#1{%
  \ifcase#1% = zeroth
  \or First%
  \or Second%
  \or Third%
  \or Fourth%
  \or Fifth%
  \or Sixth%
  \or Seventh%
  \or Eighth%
  \or Ninth%
  \or Tenth%
  \else \blank
  \fi}

 \def\ucfullnumbers#1{%
   \expandafter\expandafter\expandafter\uppercase%
     \expandafter{\fullnumbers{#1}}
   }

\newif\ifmanyappends
\newif\ifmanyscheds
\newif\ifauxmissing
\newif\ifauxfile
\newif\ifaux

\def\auxfile{\jobname.aux}

\newread\aux
\newwrite\aux

\def\checkaux{%
 \ifauxfile\let\next\relax\else\let\next\getaux\fi\next}

\gdef\getaux{%
  \null\global\auxfiletrue\inform{Opening aux file }%
  \immediate\openin\aux=\auxfile\relax% 
  \ifeof\aux%
   \auxmissingtrue%
   \inform{}%
   \inform{WARNING: \auxfile\space is empty, or does not exist.}%
   \inform{It may be necessary to re-run TeX on the file.}%
   \inform{}%
  \else\auxtrue
  \fi%
  \immediate\closein\aux\relax%
  \ifaux\input\auxfile\relax\fi%
  \immediate\openout\aux=\auxfile\relax%
  }

\def\part#1{% note no \par
  \ifnum\partcount>0\filbreak\else
  \par\nobreak\bigskip\fi
  \advance\partcount by1
  \centerline{^{Part #1}}\smallskip\nobreak}

\def\centertext#1{{\skip0=0pt plus.25\hsize
  \advance \leftskip by \skip0 \advance \rightskip by \skip0 
  \parfillskip=0pt \spaceskip=.3333em \xspaceskip=.5em 
  \pretolerance=9999 \tolerance=9999
  \hyphenpenalty=9999 \exhyphenpenalty=9999 #1\par}}

\def\maybespace{%
  \futurelet\next\testforother}

\def\testforother{% \noexpand is required to avoid \ref being expanded
  \if\noexpand\next[\let\next=\space % if [  add space
  \else\if\noexpand\next(\let\next=\space % if (  add space
  \else\ifcat\noexpand\next.\let\next=\empty % if . no space
%\else\ifcat\noexpand\next\noexpand\\next=\empty  % if \ no space
% Don't use. It could cause problems if \space followed \ok or \se
% It is not required for \ref
  \else\let\next=\space
%\fi % relates to \ifcat\\
  \fi\fi\fi\next}% Note that \ref still generates a space-then eats it

\def\ca{%
  \begingroup\it\frenchspacing % This deals with, eg. Ltd. and v.
  }
\def\v{\unskip\/\ {\rm v}\maybespace}% taken out of \ca
\def\se{\unskip\/\endgroup\maybespace}% mod aftergroup

\def\bo{\def\on{\unskip\/\ {\rm on }}\begingroup\sl\frenchspacing}
\def\ok{\unskip\/\endgroup\maybespace}

% U.C. hyphens
\def\uc-{\discretionary{\raise.25ex\hbox{-}}{}{\raise.25ex\hbox{-}}}
\def\duc-{\discretionary{\raise.25ex\hbox{-}}{}{}}

% Quotation macros
\def\beginquote{\vskip\the\parskip \vskip-\quoteparskip
  \begingroup\tenpoint
  \parskip=\quoteparskip \parindent=\quoteparindent
  \clskip=\smallskipamount
  \advance\leftskip by \quoteindent \relax
  \par\ifq\leavevmode\llap{``}\fi
  \prevgraf=1
  \DeleteOptionalSpacesandPars{\noindent\ignorespaces}}

\def\endquote{\ignorespaces\ifq\rlap{''}\fi\par\endgroup}
\def\beginsclquote{\beginquote\advance\leftskip by-\clindent}
\def\beginssclquote{\beginquote\advance\leftskip by-\sclindent}
\def\beginsssclquote{\beginquote\advance\leftskip by-\ssclindent}

\newcount\quoteparacount \quoteparacount=0

\long\def\OldQuotes#1\par{%
  \advance\quoteparacount by1%
  {\setbox0=\hbox{``}%
   \setbox1=\vbox{%
   \storeparindent=\the\parindent
   \ifnum\quoteparacount=1 \parindent=0pt\fi 
     \advance\hsize by -1.5\wd0%
     \advance\hsize-\the\leftskip
     \leftskip=0pt%
     \leavevmode
     \llap{\hbox to 1.5\wd0{%
       \strut``\hfill}}\unskip#1\unskip\nobreak
       \parindent=\the\storeparindent}%
   \vfuzz=10pt                % suppress overfull warnings
   \splittopskip=0pt          % no skip at top of bix 1
   \count1=0                  % initialise line count
   \par\noindent              % start new paragraph
   \def\rebox{%
     \advance\count1 by1
     \ifnum\count1=1\hbox to1.5\wd0{\strut\hfill}\else
     \ifnum\count1>1\hbox to1.5\wd0{\strut``\hfill}\fi\fi
     \nobreak
     \setbox2=\vsplit 1 to6.1pt
       \vbox{\unvbox2\unskip}%
       \hskip 0pt plus 0pt\relax}%
     \loop
       \rebox                  % do one line at a time
       \ifdim \ht1>0pt         % test if more lines
     \repeat
     \par}}

\def\EndOldQuotes{\unskip\nobreak\hbox to 1.5\wd0{\hfill\strut''}}

\newif\ifosq
\def\newquotes{\osqfalse}
\def\oldquotes{\osqtrue \begindoublequotes}

% Set " to produce `` and '' and for use in \oldquotes
\catcode`\"=\active% Make " an active character

\gdef\begindoublequotes{%% \begindoublequotes enables "
    \global\catcode`\"=\active% Make " an active character
    \global\chardef\dq=`\"% Double-quote char. via \dq
    \global\let\dblqu@te=L% Always start with a left double-quote
    }% End of macro
\let\xxx=\spacefactor% Save the \spacefactor
\let\dblqu@te=L%
\gdef"{%
  \ifinner\else\ifvmode\let\dblqu@te=L\fi\fi
  \if L\dblqu@te\ifosq\OldQuotes\else``\fi\global\let\dblqu@te=R%
  \else
   \let\xxx=\spacefactor% Save the \spacefactor
   \ifosq\EndOldQuotes\else''\fi\global\let\dblqu@te=L%% Insert '' and reset \dblqu@te
   \spacefactor\xxx% Reset the \spacefactor
  \fi% End of \if L\dblqu@te...
  }% End of " macro

\gdef\enddoublequotes{%
  \catcode`\"=12%Set " back to other
  }

% Spacing
\def\,{\hskip.2em\relax}

% top-lap and bottom-lap - previous name of \tlap was \vlap
\def\tlap#1{\vbox to 0pt{\vss#1}} % toplap - 14.12.88
\def\blap#1{\vtop to 0pt{\vss#1}} % bottomlap - 14.12.88

\def\frac#1/#2{\leavevmode\kern.1em
  \raise.5ex\hbox{\the\scriptfont0 #1}\kern-.1em
  /\kern-.15em\lower.25ex\hbox{\the\scriptfont0 #2}}

\def\vfrac#1/#2{\leavevmode$#1\over#2$\space}

% Whether these are miscellaneous is a moot point
% However, here is as good a place as any

\def\ifsinglepage{% This pair of macros needs amneding
  \edef\tempfootline{\the\footline}%
   \ifnum\pageno=1
    \ifnum\vbadness>9999
     \footline=\expandafter{\temptfootline}%
   \else\nopagenumbers\inform{No pagenumbers}\fi\fi}%
  \def\numberpages{\def\singlepage{}}

\def\printsp{%
 \ifsinglepage
  \vfill\supereject
  \backmatter\supereject
 \fi} % should it go here? 
 
\outer\def\bye{\par
 \signoff % This is the signature
  \vfil\supereject
  \backmatter\supereject
  \ifcontents
   \printcontents\contentsfalse\vfill\supereject
  \fi
  \ifxrefs
   \immediate\write\xrf{\noexpand\unskip}% check. Have all writes been written?
   \immediate\closeout\xrf
  \fi
  \ifxrfmissing
   \warn{\xreffile\space is missing or incomplete.}%
   \inform{Run TeX on the file again.}%
  \fi
  \ifaux
   \immediate\write\aux{\noexpand\relax}% check. Have all writes been written?
   \immediate\closeout\aux
  \fi
  \ifauxmissing
   \warn{\auxfile\space is missing or incomplete.}%
   \inform{Run TeX on the file again.}%
  \fi
  \supereject
  \iffax\printfaxsheet\fi
  \ifchit\chit\fi
  \end} 

% A fudged bit here to prevent multiple backsheets
% and additional pages containing rubbish.
% Will be corrected in next release

\newif\iflpwbs % if last page was backsheet...

\def\enddoc{\par
  \edef\tempfootline{\the\footline}%
  \iflpwbs\else\signoff\fi % signature/settled
  \vfill\supereject
  \iflpwbs\let\backmatter\empty\fi
  \ifnum\totalpages>1
    \backmatter\supereject\lpwbstrue
  \fi% No backsheet unless text!
  \footline=\expandafter{\tempfootline}%
  \ifcontents\printcontents\contentsfalse\fi
  \ifxrefs\immediate\write\xrf{\string\unskip}
  \fi
  \ifxrfmissing
   \inform{}%
   \inform{WARNING: \xreffile\space is missing or incomplete.}%
   \inform{}%
   \inform{Run TeX on the file again.}%
  \inform{}%
  \fi
  \ifaux\immediate\write\aux{\string\unskip}%
  \fi
  \ifauxmissing % is this necessary?
  \inform{}%
  \inform{WARNING: \auxfile\space is missing or incomplete.}%
  \inform{}%
  \inform{Run TeX on the file again.}%
  \inform{}%
  \fi
  \reset
  }

\def\counsel#1{\edef\counselname{#1}}

\def\formalcounselname{Mr.~\counselname}

\def\signature{\par\nobreak\vskip\the\clskip
 \hskip\signindent\ifx\counselname\undefined{[{\it Counsel's Name\/}]}%
 \else\counselname\fi
 \medskip}

% Other misc macros---
\def\etc{{\it \&c\/}.}

\newdimen\surround \surround=5pt
\def\Boxit#1#2{\vbox{\hrule\hbox{\vrule\kern#1
 \vbox{\kern#1#2\kern#1}\kern#1\vrule}\hrule}}


% Part 11 - backsheet macros

% Miscellaneous

\def\upperc#1{% This enable the first line to be UC
  \ifucfirstline\uppercase{#1} \gdef\upperc##1{##1}\else{#1}\fi}

\def\shift{% Full size or half size backsheets
  \iffullsize\null\else{\hskip1in\hskip.5\hsize}\fi} 
% The 1in \hskip in the previous line = the margin of the half size page

\def\xcenterline#1{\line{\shift\hss#1\hss}}
\def\centervers#1{\line{\llap{\fiverm\version}\shift\hss#1\hss}}

% Macros to extract names from files

\def\sols{} % Prevents error messages if undefined
\def\solname{} % ditto
\def\sname#1/#2\par{#1} % Used to extract solname from cref

\def\z:#1:#2\par{%
  \def\anyname{#1}\ifx\solname\anyname
  \afterassignment\endinput\def\sols{#2}\fi}

\gdef\getaddress{%
   \ifx\cref\empty
     \edef\solname{not given, and so}
   \else
     \edef\solname{\expandafter\sname\cref/\par}%
   \fi
   \ifx\sols\empty
     \ifx\cref\empty\else\input\addressfile\relax\fi
   \fi
   \ifx\sols\empty
      \warn{Reference \solname\space not found in file "\addressfile"}%
   \fi}

% Set up the parameters

\def\bsparams{%
 \tolerance=7500
 \doublehyphendemerits=0
 \finalhyphendemerits=10000
 \hyphenpenalty=100
 \parindent=0pt
 \normalbottom
 \pageno=0
 \nopagenumbers
  \advance\vsize\bstopincrease  \advance\vsize\bsbotincrease
  \advance\voffset-\bstopincrease
  \def\addressfile{solicitors}% name of input file
  \twelvebase=12pt\twelvepoint
  \inform{Backsheet for \ifdraft draft \fi\doctype}%
 }

% Backsheets for Opinions
\def\bsop{%
 \getworkdone
 \getbstitlewidth
 \begingroup
 \capacitytrue
 \bsparams
  \ifpleading% try adding \gettitle here and pleadingtrue elsewhere 
  \else\xcenterline{{\sl\today}}\vfil\fi
  \xcenterline{\vtop{\openup2\jot
    \halign{\hfil\vtop{\hsize=\bstitlewidth 
    \clindent=0pt % I am not sure why this is required. But it is.
    \centertext{##}}\hfil\cr
    \title\crcr}}}%
  \vfil
   \headerfont
   \xcenterline{%
    \setbox0\hbox{\doctype}%
    \ifdim \wd0<\bstitlewidth\copy0
     \else\vtop{\hsize=\bstitlewidth\centertext{\doctype}}\fi}%
  \rm
   \vfil\vfil
   \getaddress
   \halign{\def\temp{##}\xcenterline{\upperc{\temp}}\inform{::\temp::}\cr
  \sols\crcr}%
   \smallskip
   \xcenterline{\eightrm Solicitors' Reference: \sref}%
   \xcenterline{{\eightrm Counsel's Reference: \col/\cref}}%
 \supereject
 \endgroup}

% Not yet working
\def\bscopyop{%
 \getworkdone
 \getbstitlewidth
 \begingroup
 \capacitytrue
 \bsparams
  \ifpleading% try adding \gettitle here and pleadingtrue elsewhere 
  \else\xcenterline{{\sl\today}}\vfil\fi
  \xcenterline{\vtop{\openup2\jot
    \halign{\hfil\vtop{\hsize=\bstitlewidth 
    \clindent=0pt % I am not sure why this is required. But it is.
    \centertext{##}}\hfil\cr
    \title\crcr}}}%
\vfil
   \headerfont
   \xcenterline{%
    \setbox0\hbox{\doctype}%
    \ifdim \wd0<\bstitlewidth\vtop{%
         \hbox{\llap{\scaps[copy]}\phantom{\doctype}\strut}%
         \hbox{\doctype}}
     \else
      \vtop{\hsize=\bstitlewidth
        \centertext{\llap{\scaps[copy]}\break\doctype}}%
     \fi}%
  \rm
   \vfil\vfil
   \getaddress
   \halign{\def\temp{##}\xcenterline{\upperc{\temp}}%
     \inform{::\temp::}\cr
  \sols\crcr}%
   \smallskip
   \xcenterline{\eightrm Solicitors' Reference: \sref}%
   \xcenterline{{\eightrm Counsel's Reference: \col/\cref}}%
 \supereject
 \endgroup}

\let\doextras\empty

\def\bsdft{%
 \doextras
 \getworkdone
  \getbstitlewidth
 \begingroup
 \capacitytrue
  \bsparams
\ifendorsement\bsendorsement\global\endorsementfalse\fi 
 \ifpleading\null
   \else\xcenterline{\underbar{DATED\hskip2in \number\year}}%
   \bigskip
   \vfil\fi
  \xcenterline{\vtop{\openup2\jot
    \halign{\hfil\vtop{\hsize=\bstitlewidth 
    \clindent=0pt % I am not sure why this is required. But it is.
    \centertext{##}}\hfil\cr% Are the hfils nec?
    \title\crcr}}}%
  \vfil
  \tabskip=0pt
  \headerfont
  \xcenterline{\vtop{\openup2\jot
  \halign{\hfil##\hfil\cr
  \ifdraft \llap{\it draft/}\hfill\fi\cr
  \noalign{\smallskip}%
  \setbox0\hbox{\doctype}%
   \ifdim \wd0<\bstitlewidth\copy0
   \else\vtop{\hsize=\bstitlewidth\centertext{\doctype}}\fi\crcr}}}%
  \rm
  \smallskip
  \vfil\vfil
 \getaddress
 \halign{\def\temp{##}\xcenterline{\temp}\inform{::\temp::}\cr
   \ifx\sols\empty\else\sols\fi\crcr}%
 \smallskip
 \ifx\sref\empty
  \else\xcenterline{{\eightrm Solicitors' Reference: \sref}}\fi
 \ifx\cref\empty
  \else\xcenterline{{\eightrm Counsel's Reference: \col/\cref}}\fi
 \ifversion\leftline{\llap{\fiverm\versno}}\fi
 \supereject
 \endgroup
%\global\maxp@rtywidth=\the\maxpartywidth
\resetpleadingdefaults}


% Fee Chits

% Chit user macros

\def\solsref#1{\def\sref{#1}}
\def\colsref#1{\def\cref{#1}}
\def\timetaken#1{\def\timespent{#1}}
\def\casetype#1{\def\typeofcase{#1}}
\def\value#1{\def\amountatstake{#1}}
\def\difficulty#1{\def\howhard{#1}}
\def\proposedfee#1{\def\suggestedfee{#1}}
\def\legalaidno#1{\def\legalaid{#1}}
\def\comments#1{\def\remarks{#1}}

% Now the chit macros themselves
\def\chit{%
 \begingroup
  \parindent=0pt
  \inform{Fee Chit}%
  \pageno=1
  \nopagenumbers
  \def\\{ }
\maxp@rtywidth=.5\hsize
  \ifpleading\def\title{\chittitle\hfil}\fi
  \def\cr{\par}\def\noalign{}%
  \tenbase=12.5pt \tenpoint
\def\scriptsize{\let\rm\eightrm}%
  \def\chittext{%
   \parskip=0pt
  \raggedright \tolerance=10000
\hbadness=10000 
  \uchyph=0
   {\bf Date:} \today\quad {\bf cref:} \col/\cref\par
   {\bf sref:} \sref\par
   {\bf Title:} {\def\hfill{}\frenchspacing\title\strut}\par
   {\bf Legal Aid No:} \legalaid\par
   {\bf Work Done:} \workdone.\par
   {\bf Time Spent:} \ifx\timespent\empty\else\timespent\ hours\fi\par
   {\bf Value:} \pounds\amountatstake\par
   {\bf Difficulty:} \howhard\par
   {\bf Type of Case:} \typeofcase\par
   {\bf Suggested Fee:} \pounds\suggestedfee\par
   {\bf Filename:} {\tt\jobname}\par
   {\bf Remarks:} \remarks\par
  }% end of chittext
  %
  \leftline{{\it Clerk's Copy}\hfil}
  \chittext
  \vskip1in
  \leftline{{\it Counsel's Copy}\hfil}
  \chittext
  \vfil
  \supereject
 \endgroup}

\gdef\getworkdone{%
  {\nofancystuff
  \tempwd=\expandafter{\workdone}%
  \def\temppunct{\expandafter\if\the\tempwd\empty\else, \fi}%
  \xdef\workdone{\the\tempwd\temppunct
   \ifx\signoff\settled\ draft \fi\doctype
  \ifversion\space(\versno)\fi}}}


% Part 12---Advisory and non-litigious drafting

% The TUG macros (taken from tugboat.sty) which delete spaces etc
\def\if@baseis@next{\ifx\@basetoken\@nexttoken}

\long\def\@checknexttoken #1#2#3{%
  \futurelet\@basetoken\iffalse#1\fi
  \long\def\@next{%
    \if@baseis@next
      \long\def\@@next{#2}%
    \else\long\def\@@next{#3}\fi
    \@@next}%
  \futurelet\@nexttoken\@next}

% execute #2 after ignoring (possibly) one occurrence of #1
\long\def\@ignoreone#1#2{%
  \def\@ignoreform#1{#2}%
  \@checknexttoken{#1}{\@ignoreform}{#2}%
  }

% execute #2 after ignoring all occurrences of #1
\long\def\@ignoreall#1#2{%
  \def\@ignoreform#1{\@ignoretest}%
  \def\@ignoretest{\@checknexttoken{#1}{\@ignoreform}{#2}}%
  \@ignoretest
  }

% execute #1 after ignoring spaces
\def\DeleteOptionalSpaces#1{%
  \@ignoreall{ }{#1}%
  }

% execute #1 after ignoring spaces and \pars
\def\DeleteOptionalSpacesandPars#1{%
  \@ignoreall{ }{\@ignoreall{\par}{#1}}%
  }

%  Checking and reading options.
%  To check for the next optional argument, the macros must look
%  ahead to the next character.  If the next character is a `[',
%  the option-reading mechanism is invoked.  This check may be suppressed if
%  the user has executed the \lastoption option.  If \@lastoption is
%  "true" or if the [ is NOT next, the macro goes on to reading any
%  arguments and executing appropriately.

\def\@checkoptions{%
  \if@lastoption
    \def\@next{\@executetoend}%
  \else
    \def\@next{\@checknexttoken {[}{\@readoptions}{\@executetoend}}%
  \fi
  \@next
  }

% The default parameters used in advisory work

\def\pageparameters{%
  \widowpenalty=7500
  \def\footnoterule{}%
  \parindent=20pt
  \quoteindent=20pt
  \twelvepoint
  }

\def\advising#1{%
  \enddoc
  \ifpleading\gettitle\fi
  \pageparameters
  \inform{#1}%
  \chittrue % print a fee chit
  \def\doctype{#1}%
   \let\backmatter=\bsop
   \let\signoff=\signed
  \clindfalse
  \centerline{\headerfont #1}
  \nobreak\vskip10pt
  \DeleteOptionalSpacesandPars{\noindent\ignorespaces}}


\def\opinion{%
  \advising{Opinion}}
\def\note{%
  \advising{Note}}
\def\advice{%
  \advising{Advice}}
\def\jopinion{%
  \let\signed\jsigned
  \advising{Joint Opinion}}
\def\nopinion{%
  \advising{}}
\def\jnote{%
  \let\signed\jsigned
  \advising{Joint Note}}

\def\draftparameters{%
  \widowpenalty=7500
  \def\footnoterule{}%
  \parindent=0pt
  \quoteindent=\the\clindent
  \twelvepoint
}

\gdef\draft#1{%
  \ifended\endedfalse
  \else\enddoc
  \fi
  \begingroup
   \amendtextfalse
   \gdef\doctype{#1}%
   \inform{\ifdraft draft \fi#1}%
  \endgroup
   \draftparameters
   \chittrue
   \let\backmatter=\bsdft
   \ifdraft\let\signoff\settled % see \chit
    \else\let\signoff\empty\fi
   \clindtrue
   \lpwbsfalse}%

\def\conference{%
  \inform{Conference}%
  \chittrue
  \def\doctype{Conference}%
  \getworkdone}% normally set by backsheet

\def\telcon{%
  \inform{Telephone Conference}%
  \chittrue
  \def\doctype{Telephone Conference}%
  \getworkdone}


% Part 13---Pleadings
 
% Note: The pleadings macros are in the process of being rewritten. 
% As a result they contain a blend of stuff from the old and new 
% systems and some macros have been left in order to provide continuity.
% In other words, they are a mess at the moment.

% First a whole block of defs, some of which are no longer needed
\newdimen\storeparindent

\def\solicitors{Solicitors} % change to single for sole practitioner
\def\plaintiffs{} % List macro (tb 378), names of plaintiffs
\def\defendants{} % ditto, defendants
\def\thirdparties{} % ditto
\def\plaintiffsaddrs{} % ditto; addresses
\def\defendantsaddrs{}
\def\thirdpartiesaddrs{}
\def\matters{}  % List macro
\def\partyname{} % Temporary storage of individual party's name.
\def\outofrange{\noaddr} % If too few \of's, use blank address.
\def\courtname{\phantom{BORCHESTER}}%
\def\issuer{}
\def\chambers{\blank in \blank,} % Is this necessary?
\def\depsname{\blank} % name of deponent in aff endorse.
\def\shortname#1{\def\depsname{#1}}
\def\capacity#1{\ifcapacity ({\it #1\/})\else\unskip\fi}

\def\firm{\capacity{a firm}}
\def\widow{\capacity{Widow}\female}
\def\minor{\capacity{a Minor}}
\def\patient{\capacity{a Patient}}
\def\mw{\capacity{Married Woman}\female}
\def\co{\capacity{a Company}}
\def\tradingas#1{\capacity{Trading as #1}}
\def\as#1{\capacity{#1}}
\def\female{\unskip
 \ifplaintiff\femalepltrue\fi
 \ifdefendant\femaledeftrue\fi
 \ifthirdparty\femaletptrue\fi}
%\def\re{}
%\def\res{}
\def\theirsols{\noname} % redefine if necessary
\def\theirsolsaddr{\noaddr} % ditto
\def\doctype{}
\def\appellant{\global\appealtrue \plaintiff}
\def\applicant{\global\applicationtrue \plaintiff}
\def\respondent{\defendant}
\def\petitioner{}
\def\petitioner#1{\global\petitiontrue \def\petitioner{#1}}
\def\amend{}
\def\address#1{\def\address{#1}}
\def\petitionersaddress#1{\def\petitionersaddress{#1}}
\def\xheading#1{\removelastskip\medskip\goodbreak
  \noindent{\bf #1}\nobreak}

\newif\ifappeal
\newif\ifcountycourt
\newif\ifcourtofappeal
\newif\ifpetition
\newif\ifapplication

\newif\ifplaintiff
\newif\ifdefendant
\newif\ifthirdparty
\newif\iffourthparty
\newif\ifappellant
\newif\ifrespondent
\newif\ifapplicant

\newif\ifpluralplaintiff
\newif\ifpluraldefendant
\newif\ifpluralthirdparty
\newif\ifpluralfourthparty
\newif\ifpluralappellant
\newif\ifpluralrespondent
\newif\ifpluralapplicant

\newif\ifclientpl
\newif\ifnoparties
\newif\ifcapacity
\newif\ifintendedaction
\newif\ifaffidavit % check this
\newif\iffemalepl
\newif\iffemaledef
\newif\iffemaletp

\def\intendedparties{\global\intendedactiontrue}

\def\whenadded{\quad ~~/~~/91}
\def\added{(added\whenadded)}

\newcount\plcount % total number of plaintiffs
\newcount\dfcount % total number of defendants
\newcount\tpcount % total number of third parties
\newcount\partyno % This party - temporary storage
\newcount\testone % Temporary storage
\newcount\testtwo % Temporary storage
\newcount\mattercount % No. of Matters.

\def\claims{%
   \vskip\the\clskip
   \clearclno
   {\scaps And the \plaintfs}\ \wants---}
\def\claim{\claims}

% List macros, taken from the T.B. page 378 ff.

\toksdef\ta=0 \toksdef\tb=2 % token list registers for temp use
\newcount\cardcount

\def\rightappenditem#1\to#2{\ta={\\{#1}}\tb=\expandafter{#2}%
 \edef#2{\the\tb\the\ta}}%
\def\select#1\of#2\to#3{\def#3{\outofrange}%
 \long\def\\##1{\advance#1-1 \ifnum#1=0 \def#3{\relax##1}\fi}#2}%
\def\cardinality#1\to#2{#2=0 \long\def\\##1{\advance#2 by 1 }#1}


% Some dimensions to help with formatting of parties

\newdimen\plwidth \plwidth=0pt
\newdimen\dfwidth \dfwidth=0pt
\newdimen\tpwidth \tpwidth=0pt
\newdimen\allwidths \allwidths=0pt
\newdimen\maxp@rtywidth \maxp@rtywidth=4.5in
\newdimen\partyhang \partyhang=0pt

% Macros that add plaintiff's name etc to the list
% These macros are quite complicated since they use \csname
% and \endcsname, sometimes to excess

\def\plaintiffsstuff{}
\def\defendantsstuff{}
\def\thirdpartiesstuff{}
\def\currentpartyaddrs{}

\newcount\andcount
\newcount\testthree
\newcount\testfour

\newtoks\tc 
\newtoks\tx
\newtoks\cpatoks
\newtoks\cpstoks
\newtoks\cpsctoks
\newtoks\cpfctoks
\newtoks\cpntoks
\newtoks\cpwtoks

\def\upit{\global\advance\testtwo by-1
  \global\advance\testthree by-1}

\def\uupit{\global\advance\testtwo by0
  \global\advance\testthree by-2}

\def\downit{\unskip}

\def\of#1{% Address of party
  \advance\andcount by1
  \edef\abode{%
   \ifcase\andcount%
    \or{of}
    \or{both of}
   \else{all of}
   \fi}
  \ta={\\} \tb=\expandafter{\currentpartyaddrs}%
  \tc=\expandafter{\abode#1\, }%
  \expandafter\edef\csname\expandafter
   \gobble\the\cpatoks\endcsname{\the\tb\the\ta{\the\tc}}%
  \ta={\\} \tb=\expandafter{\currentpartystuff}%
   \tc=\expandafter{\downit}%
  \expandafter\edef\csname\expandafter\gobble\the\cpstoks
   \endcsname{\the\tb\the\ta{\the\tc}}%
  \andcount=0
  }

\def\and{% For use where two parties have same address
  \advance\andcount by1
  \ta={\\} \tb=\expandafter{\currentpartyaddrs}% 
  \tc=\expandafter{and}%
  \expandafter\edef\csname\expandafter\gobble\the\cpatoks
   \endcsname{\the\tb\the\ta{\the\tc}}%
  \ta={\\} \tb=\expandafter{\currentpartystuff}%
   \tc=\expandafter{\upit}%
  \expandafter\edef\csname\expandafter\gobble\the\cpstoks
   \endcsname{\the\tb\the\ta{\the\tc}}%
  \expandafter\advance\csname\expandafter\gobble\the\cpsctoks
   \endcsname by-1
  }

% The \, in \tc may not be working
\def\nand{% For use where more than two parties have same address
  \advance\andcount by1
  \ta={\\} \tb=\expandafter{\currentpartyaddrs}%
   \tc=\expandafter{\, }%
  \expandafter\edef\csname\expandafter\gobble\the\cpatoks
   \endcsname{\the\tb\the\ta{\the\tc}}%
  \ta={\\} \tb=\expandafter{\currentpartystuff}% 
  \tc=\expandafter{\upit}% Formerly \uupit
  \expandafter\edef\csname\expandafter\gobble\the\cpstoks
    \endcsname{\the\tb\the\ta{\the\tc}}%
  \expandafter\advance\csname\expandafter\gobble\the\cpsctoks
    \endcsname by-1
  }

\def\converttc#1#2{% let <control word> = other word...
 \expandafter\expandafter\let\expandafter#1%
  \csname\expandafter\gobble\the#2\endcsname
 }

% If this macro is called eg with the parameter \plaintiff
% it lets eg \currentpartyshortcount=\plaintiffshortcount

\def\converttokens#1{% A general purpose macro...
  \cpsctoks=\expandafter{\string#1shortcount}%
  \converttc{\currentpartyshortcount}{\cpsctoks}%
  \cpfctoks=\expandafter{\string#1fullcount}%
  \converttc{\currentpartyfullcount}{\cpfctoks}%
  \cpatoks=\expandafter{\string#1addrs}%
  \converttc{\currentpartyaddrs}{\cpatoks}%
  \cpstoks=\expandafter{\string#1stuff}%
  \converttc{\currentpartystuff}{\cpstoks}%
  \cpntoks=\expandafter{\string#1}%
  \converttc{\currentpartynames}{\cpntoks}%
  \cpwtoks=\expandafter{\string#1width}%
  \converttc{\currentpartywidth}{\cpwtoks}%
  }

% This macro is calld by eg \plaintiff
% In that case #1 is \plaintiff and #2 the actual name of the
% Plaintiff in question (eg JOHN SMITH)
% In the next edition it will do rather more than it does now.

\def\party#1#2{%#1=party, #2=name
  \converttokens{#1}%
  \unskip
  \cardinality\currentpartyaddrs\to\cardcount
  \ifnum\currentpartyfullcount>\the\cardcount
   \of{\noaddr}%
  \fi
  \global\expandafter\advance\csname\expandafter\gobble\the\cpfctoks
   \endcsname by1
  \global\expandafter\advance\csname\expandafter\gobble\the\cpsctoks
   \endcsname by1
  \setbox0=\hbox{#2}%
  \ifdim\wd0>\the\maxp@rtywidth
    \global\csname\expandafter\gobble\the\cpwtoks
     \endcsname=\the\maxp@rtywidth
  \else\ifdim\currentpartywidth<\wd0%
    \csname\expandafter\gobble\the\cpwtoks\endcsname=\wd0
  \fi\fi
  \converttc{\currentpartywidth}{\cpwtoks}% Reset
  \unskip
  \ifdim\allwidths<\currentpartywidth 
   \allwidths=\the\currentpartywidth\fi
  \ta={\\} \tb=\expandafter{\currentpartynames}% 
  \tc=\expandafter{#2}%
  \expandafter\edef\csname\expandafter\gobble\the\cpntoks
   \endcsname{\the\tb\the\ta{\the\tc}}%
  \ifnum\currentpartyfullcount=1 \andcount=0\fi
  }


% This macro recovers the parties so that their names can be formatted
% The logic in it is still far from perfect
% It is intended to put "and" in the right place, but sometimes fails...

\newif\ifnoandneeded
\edef\testand{\relax and}

\def\getparties#1#2{% #1=partylist,#2=partytext
  \converttokens{#1}%
  \unskip%
  \testone=0\testtwo=0%
  \testthree=\the\currentpartyfullcount%
  \testfour=\the\currentpartyshortcount%
  \ifnum\currentpartyfullcount>\the\cardcount%
   \advance\andcount by1%
   \edef\abode{% Print addresses
    \ifcase\andcount%
     \or{of}%
     \or{both of}%
    \else{all of}%
    \fi}%
   \rightappenditem\abode\to\currentpartyaddrs%
   \rightappenditem{}\to\currentpartystuff%
  \fi%
  \unskip
  \loop
   \begingroup
    \global\advance\testone by1%
    \global\advance\testtwo by1%
    \partyno=\the\testone%
    \select\partyno\of\currentpartynames\to\partyname%
     \partyno=\the\testone% reset the counter%
    \select\partyno\of\currentpartyaddrs\to\partyaddress%
     \partyno=\the\testone% reset the counter
    \select\partyno\of\currentpartystuff\to\partystuff%
    \partystuff\unskip\relax%
      \ifnum\testone>1
         {\ifnum\testtwo=\the\currentpartyshortcount
           {\ifnoandneeded
             \else\unskip\ and%
            \fi
           }%
           \global\advance\testtwo by1
          \fi
         }%
      \fi
    \ifx\partyaddress\testand \global\noandneededtrue
     \else\global\noandneededfalse
    \fi
    \ifx\partyaddress\empty\let\partyaddress\noaddr\fi%fudge
    \unskip\ \partyname\ \partyaddress%
   \endgroup
   \ifnum\testone<\the\currentpartyfullcount%
  \repeat%
  #2}

% A number of these are not yet used
% (and may never be used)

\def\getpls{\getparties{\plaintiffs}{\pltext}}
\def\getdefs{\getparties{\defendants}{\dftext}}
\def\gettps{\getparties{\thirdparties}{\tptext}}
\def\getfps{\getparties{\fourthparties}{\fptext}}
%\def\getaps{\getparties{\appellants}{\aptext}}
%\def\getresp{\getparties{\respondents}{\rptext}}
%\def\getapplics{\getparties{\applicants}{\altext}}

\newcount\plshortcount
\newcount\dfshortcount
\newcount\tpshortcount
\newcount\fpshortcount
%\newcount\apshortcount
%\newcount\rpshortcount
%\newcount\alshortcount

\newcount\plaintiffsshortcount
\newcount\defendantsshortcount
\newcount\thirdpartiesshortcount
\newcount\fourthpartiesshortcount
%\newcount\appellantsshortcount
%\newcount\respondentsshortcount
%\newcount\applicantsshortcount

\newcount\plaintiffsfullcount
\newcount\defendantsfullcount
\newcount\thirdpartiesfullcount
\newcount\fourthpartiesfullcount
%\newcount\appellantsfullcount
%\newcount\respondentsfullcount
%\newcount\applicantsfullcount

\newdimen\plaintiffswidth
\newdimen\defendantswidth
\newdimen\thirdpartieswidth
\newdimen\fourthpartieswidth
%\newdimen\appellantswidth
%\newdimen\respondentswidth
%\newdimen\applicantswidth

\def\unsetallparties{%
 \plaintifffalse
 \defendantfalse
 \thirdpartyfalse
 \fourthpartyfalse
 }

\def\plaintiff#1{\unsetallparties\plaintifftrue
 \party{\plaintiffs}{#1}}
\def\defendant#1{\unsetallparties\defendanttrue
 \party{\defendants}{#1}}
\def\thirdparty#1{\unsetallparties\thirdpartytrue
 \party{\thirdparties}{#1}}            
\def\fourthparty#1{\unsetallparties\fourthpartytrue
 \party{\fourthparties}{#1}}
%\def\appellant#1{\unsetallparties\appellanttrue
% \party{\appellants}{#1}}
%\def\respondent#1{\unsetallparties\respondenttrue
% \party{\respondents}{#1}}
%\def\applicant#1{\unsetallparties\applicanttrue
% \party{\applicants}{#1}}

\def\listpls{\listparties{\plaintiffs}}
\def\listdfs{\listparties{\defendants}}
\def\listtps{\listparties{\thirdparties}}
\def\listfps{\listparties{\fourthparties}}
%\def\listaps{\listparties{\appellants}}
%\def\listrps{\listparties{\respondents}}
%\def\listapplics{\listparties{\applicants}}

\def\slistpls{\slistparties{\plaintiffs}}
\def\slistdfs{\slistparties{\defendants}}
\def\slisttps{\slistparties{\thirdparties}}
\def\slistfps{\slistparties{\fourthparties}}
%\def\slistaps{\slistparties{\appellants}}
%\def\slistrps{\slistparties{\respondents}}
%\def\slistapplics{\slistparties{\applicants}}

\gdef\pluraltext{%
    \gdef\addressis{addresses are}%
    \gdef\seek{seek}%
    \gdef\wants{claim}%
    \gdef\respectively{respectively}%
    \gdef\them{them}%
    \gdef\do{do}%
    }

\gdef\singulartext{%
    \gdef\addressis{address is}%
    \gdef\seek{seeks}%
    \gdef\wants{claims}%
    \gdef\respectively{\unskip}%
    \gdef\do{does}%
    \gdef\them{him}%
    }

\gdef\pltext{%
  \ifnum\plaintiffsfullcount>1%
    \gdef\plaintfs{\Plaintiffs}%
    \pluraltext
  \else%
    \ifpluralplaintiff%
    \gdef\plaintfs{\Plaintiffs}%
    \pluraltext
  \else%
    \gdef\plaintfs{\Plaintiff}%
    \singulartext
  \fi\fi}

\gdef\dftext{%
  \ifnum\defendantsfullcount>1%
    \gdef\dfdants{\Defendants}%
    \pluraltext
  \else%
    \ifpluraldefendant%
    \pluraltext
  \else%
    \gdef\dfdants{\Defendant}%
    \singulartext
    \gdef\them{\iffemaledef her\else him\fi}%
  \fi\fi}%

\gdef\tptext{%
  \ifnum\thirdpartiesfullcount>1%
    \gdef\thirdparts{Third Parties}%
    \pluraltext
  \else%
    \ifpluralthirdparty%
    \gdef\thirdparts{Third Parties}%
    \pluraltext
  \else%
    \gdef\thirdparts{Third Party}%
    \singulartext
  \fi\fi}

\gdef\fptext{%
  \ifnum\fourthpartiesfullcount>1%
    \gdef\fourthparts{Fourth Parties}%
    \pluraltext
  \else%
    \ifpluralfourthparty%
    \gdef\fourthparts{Fourth Parties}%
    \pluraltext
  \else%
    \gdef\fourthparts{Fourth Party}%
    \singulartext
  \fi\fi}

%\gdef\aptext{%
%  \ifnum\appellantsfullcount>1%
%    \gdef\plaintfs{Appellants}%
%    \pluraltext
%  \else%
%    \ifpluralappellant%
%    \gdef\plaintfs{Appellants}%
%    \pluraltext
%  \else%
%    \gdef\plaintfs{Appellant}%
%    \gdef\addressis{address is}%
%    \pluraltext
%  \fi\fi}
%%
%\gdef\rptext{%
%  \ifnum\respondentsfullcount>1%
%    \gdef\dfdants{Respondents}%
%    \pluraltext
%  \else%
%    \ifpluralrespondent%
%    \gdef\dfdants{Respondents}%
%    \pluraltext
%  \else%
%    \gdef\dfdants{Respondent}%
%    \singulartext
%  \fi\fi}%
%%
%\gdef\altext{%
%  \ifnum\applicantsfullcount>1%
%    \gdef\plaintfs{Applicants}%
%    \pluraltext
%  \else%
%    \ifpluralappellant%
%    \gdef\plaintfs{Applicants}%
%    \pluraltext
%  \else%
%    \gdef\plaintfs{Applicant}%
%    \singulartext
%  \fi\fi}
%%
% Phew. I reckon those need amending...

% This is one macro that will soon go, being replaced by
% \pleading and \spleading

\def\topofpleading#1#2{% doctype & ct
  \reset
  \storeparindent=\the\parindent
  \global\parindent=0pt
  \def\doctype{#1}
  \ct=#2
  \pleadingtrue
  \clientpltrue
  \gettitle
  \def\backsheet{\enddoc\bsdft}
  \heading
  \parties}

% So will this. It will be \let equal to \pleading

\def\generic#1{%
  \reset
  \def\doctype{\vtop{\centertext{#1}}}
  \heading
  \ifnoparties\else\parties\fi
  \centertext{#1}
  \medskip}

\def\am@nd{%
  \ifnum\amendcount>2{\uuul RE-}\fi
  \ifnum\amendcount>1{\uul RE-}\fi
  \ifnum\amendcount>0{\ul AMENDED }\fi
  }

\def\pleading#1{% doctype
  \storeparindent=\the\parindent
  \global\parindent=0pt
  \draft{\am@nd#1}
  \pleadingtrue
  \gettitle
  \heading
  \parties
  \ifdraft
   \def\signoff{\endofpleading\settled}%
  \else\let\signoff\endofpleading\fi
  \medbreak
  \leavevmode
  \centertext{\am@nd#1}%
  \nobreak
  \amendnote}

\def\spleading#1{% doctype
  \storeparindent=\the\parindent
  \global\parindent=0pt
  \draft{\am@nd#1}
  \pleadingtrue
  \gettitle
  \heading
  \sparties
  \ifdraft
   \def\signoff{\endofpleading\settled}%
  \else\let\signoff\endofpleading\fi
  \medbreak
  \centertext{\am@nd#1}%
  \nobreak
  \amendnote}

\def\gettitle{% This needs a lot of work
  \pltext\dftext\tptext % added to deal with ops on their own
  \getbstitlewidth
  \gdef\title{%
   \global\maxp@rtywidth=\the\bstitlewidth
    \centerline{\court}\cr
    \scaps
    \division\cr
    \regis\cr  
    \reference\cr
    \noalign{\bigskip}%
    \rm
    \centertext{\inthematter}\cr
    \noalign{\medskip}%
    \slistpls\cr
    \hfill\it\plaintfs\cr
    \against\cr
    \strut\cr
    \slistdfs\cr
    \hfill\it\dfdants\cr}%
   \global\maxp@rtywidth=\the\maxpartywidth}

\def\headingskip{\vskip-\lastskip\smallskip}

\gdef\heading{% Can this be broken down further?
  \vbox{\baselineskip=15pt
   \line{\court\hfil\reference}%
   \headingskip 
   \scaps % Turn on caps and smallcaps
    \apcourt
    \headingskip
    \division
    \headingskip
    \regis
    \headingskip
    \subdivision
    \headingskip
    \judgename
    \headingskip
    \rm % Back to roman
    \Writissued
    \headingskip
    \inthematter
    }% end of vbox
  \medskip}

\def\parties{%
  \capacitytrue
  \pltext% set up the alternative text for `his', `their', etc.
  \dftext
  \tptext
  {\noindent\leftline{BETWEEN\raise.15ex\hbox{---}}
  \bigskip
  % The next few lines box up the parties.
  \centerline{\hbox{\vtop{\baselineskip=15pt %Baselineskip in parties
    \halign{\hfill ##\hfill\cr
    \listpls\cr
  \relax\hidewidth\rightline{\hfil\it
    \ifintendedaction Intended\ \fi\plaintfs}
  \hidewidth\relax\cr
    \hfill \against\hfill\cr
    \strut\cr
  \listdfs\cr
  \relax\hidewidth\rightline{\it 
    \ifintendedaction Intended\ \fi\dfdants}
  \hidewidth\relax\cr
  \ifthirdparty
    \hfill \against\hfill\cr
    \strut\cr
  \listtps\cr
  \relax\hidewidth\rightline{\it 
    \ifintendedaction Intended\ \fi\thirdparts}
    \hidewidth\relax\cr\fi  
  }}}}}%
  \twelvepoint\bigskip
  \capacityfalse}

% Short version of parties for affy's, etc.

\def\sparties{%
  \capacitytrue
  \pltext % set up the alternative text for `his', `their', etc.
  \dftext
  \tptext
  {\noindent\leftline{BETWEEN\raise.15ex\hbox{---}}
  % The next few lines box up the parties.
  \centerline{\hbox{\vtop{\baselineskip=15pt
    \halign{\hfill ##\hfill\cr
    \slistpls\cr
  \relax\hidewidth\rightline{\hfill\it 
    \ifintendedaction Intended\ \fi\plaintfs}
    \hidewidth\relax\cr
    \hfill \against\hfill\cr
    \strut\cr
    \slistdfs\cr
   \relax\hidewidth\rightline{\hfill\it 
    \ifintendedaction Intended\ \fi\dfdants}
    \hidewidth\relax\cr
  \ifthirdparty
    \hfill \against \hfill\cr
    \strut\cr
    \slisttps\cr
  \relax\hidewidth\rightline{\hfill\it 
    \ifintendedaction Intended\ \fi\thirdparts}
    \hidewidth\relax\cr\fi}}%
  }}}%
  \bigskip
  \capacityfalse}%

\def\listparties#1{% #1=partylist (eg \plaintiffs)
  \converttokens{#1}%
  \testone=0\def\\##1{\relax##1\cr}%
  \tabskip=0pt
  \vtop{\hsize=\the\maxp@rtywidth
    \hyphenpenalty=10000\tolerance=2750
    \ifnum\currentpartyfullcount>1
      \halign{\global\advance\testone by1
      \hfil
      \llap{(\the\testone)\quad}
      \vtop{%
        \hsize=\the\currentpartywidth
        \hangafter1\hangindent\the\partyhang
        \strut##\strut}% end of \vtop
      \hfil\cr#1}% end of \halign
     \else
      \ifnum\currentpartyfullcount=1
      \partyno=1
      \select\partyno \of#1 \to\partyname
      \centertext{\partyname}%
     \fi\fi}}

\def\slistparties#1{% #1=\plaintiffs
  \converttokens{#1}%
  \partyno=1\def\\##1{\relax##1\cr}%
  \tabskip=0pt
  \select\partyno \of#1 \to\partyname
  \vtop{\hsize=\the\maxp@rtywidth
   \hyphenpenalty=10000\tolerance=2750
   \ifnum\currentpartyfullcount>2
     \centertext{\partyname{ \it \&~Ors.\/}}%
   \else\ifnum\currentpartyfullcount=2
     \centertext{\partyname{ \it \&~Anor.\/}}%
   \else\ifnum\currentpartyfullcount=1
     \centertext{\partyname}%
   \fi\fi\fi}}

% This is a default definition.
\long\def\bottomofpleading#1{%#1=text
  \def\addressfile{solicitors}
  \getaddress
  {\def\cr{ of \def\cr{, }}%
  \medskip
  #1}%
  \global\parindent=\the\storeparindent}

\def\inthematter{%
  \ifx\matters\empty
  \else\testone=0\def\\##1{\relax\global\advance\testone by1%
   \def\and{\ifnum\testone<2{}%
  \else{And\ }\fi}% Now do the work
  {\scaps \and}##1\strut\cr
  \ifnum\testone<\the\mattercount \noalign{\smallskip}\fi}%
  \halign{%
    \vtop{\twelvebase=15pt\twelvepoint
    \hangafter1 \hangindent\clindent ##\strut}\hfil\cr
    \matters\crcr}%
  \fi}

% Now some other pleading stuff, esp. amendments

\def\served#1{\getservicedate{#1}{\dateofservice}}
\def\reserved#1{\getservicedate{#1}{\dateofreservice}}
\def\rereserved#1{\getservicedate{#1}{\dateofrereservice}}
\def\rerereserved#1{\getservicedate{#1}{\dateofrerereservice}}

\def\writissued#1{%
  \getservicedate{#1}{\datewritissued}%
  \gdef\Writissued{Writ issued the \nodate}%
  }

\def\getservicedate#1#2{{%
   \def\sserved##1/##2/##3roger{%
     \def\day{##1}%
     \def\month{##2}%
     \def\year{\ifnum##3<100 19##3\else##3\fi}%
     \expandafter\xdef\csname\expandafter\gobble\string#2\endcsname{\longtoday}%
     }%
   \sserved#1roger
   }}

\newif\ifamendtext\amendtexttrue
\def\setamendcount#1{\global\amendcount=#1}

\newcount\amendcount
\newcount\aamct \aamct=0

\gdef\amended{%
  \enddoc
  \setamendcount{1}%
  \ifamendtext\amendstuff\fi}

\gdef\reamended{%
  \enddoc
  \setamendcount{2}
  \ifamendtext\amendstuff\fi}

\gdef\rereamended{%
  \setamendcount{3}%
  \ifamendtext\amendstuff\fi}

\def\amendstuff{%This overlong macro deals with amendment formal parts
  \gdef\amendnote{%
     \ifnum\amendcount<2% First amendment
       \tcl{\scaps Note:} Text inserted by this amendment to this 
       pleading is shown underlined, {\ul thus}; text deleted by 
       this amendment is shown crossed-out, {\xo thus}.
     \else % Second and subsequent amendments
       \tcl{\scaps Note 1:} Text inserted by the first amendment 
       is shown underlined, {\ul thus}; text deleted by the 
       first amendment is shown crossed-out, {\xo thus};
       \par
       \tcl{\scaps Note 2:} Text inserted by the second amendment 
       is shown underlined twice, {\uul thus}; text deleted by the 
       second amendment is shown crossed-out twice, {\xxo thus}.
     \fi
     \par
     \ifnum\amendcount=3% re-re-amendment
       \tcl{\scaps Note 3:} Text inserted by the third amendment 
       is shown underlined thrice, {\uuul thus}; text deleted by 
       the third amendment is shown crossed-out thrice, {\xxxo thus}.
     \fi
     }%
    \ifnum\ct=1\ccendofpleading\else\hcendofpleading\fi
  \global\amendtextfalse
  }

\def\hcendofpleading{% End of pleading for High Court
    \gdef\endofpleading{%
      \signature      
      {\ul \signature}
      \ifnum\amendcount>1{\uul \signature}\fi
      \ifnum\amendcount>2{\uuul \signature}\fi
      \bottomofpleading{%
        Served the \ifx\dateofservice\empty{\nodate}%
         \else{\dateofservice}\fi
      \unskip
      \ifnum\amendcount=1{\ul\ and }\fi% Amend
      \ifnum\amendcount>1{\ignorespaces\ul\unskip, }\fi
      {\ul re-served the \ifx\dateofreservice\empty{\nodate}%
         \else{\dateofreservice}\fi\unskip}
      \ifnum\amendcount=2{\ul\ and }\fi% Reamend
      \ifnum\amendcount>2{\ignorespaces\ul\unskip, }\fi
      \ifnum\amendcount>1% ie \amendcount is 2 or more
         {\uul re-re-served the 
           \ifx\dateofrereservice\empty{\nodate}%
           \else{\dateofrereservice}\fi\unskip}
           \fi
      \ifnum\amendcount=3{\ul\ and }\fi% Re-re-amend
        \ifnum\amendcount>2% ie \amendcount is 3 or more
           {\uuul re-re-re-served the 
            \ifx\dateofrerereservice\empty{\nodate}%
             \else{\dateofrerereservice}\fi}
         \fi
       by \ignorespaces\sols \solicitors\ for the\forwhom\par
         }%
     }%
    }

\def\ccendofpleading{% End of pleading for county court
    \gdef\endofpleading{%
      \medskip
      Dated the \ifx\dateofservice\empty{\nodate}%
       \else{\dateofservice}\fi
      \signature      
      {\ul Dated the \ifx\dateofreservice\empty{\nodate}%
       \else{\dateofreservice}\fi\unskip}
      {\ul \signature}
      \ifnum\amendcount>1
        {\uul Dated the \ifx\dateofrereservice\empty{\nodate}%
        \else{\dateofrereservice}\fi\unskip}
        {\uul \signature}
      \fi
      \ifnum\amendcount>2% ie \amendcount is 3 or more
        {\uuul Dated the \ifx\dateofrerereservice\empty{\nodate}%
        \else{\dateofrerereservice}\fi}
        {\uuul\signature}
      \fi
      \bottomofpleading{%
        \rightline{\vtop{\hsize=.6\hsize
          The \forwhom's \solicitors\ are \sols
          where they will accept service of proceedings 
          on behalf of the \forwhom.}}
        \bigskip
        \leftline{\vtop{\hsize=.6\hsize
          To the District Judge of the \courtname\ 
          COUNTY COURT and to the \notforwhom.}}
        }%
     }%
    }

% Clause numbering for use inside amendments

\def\acl{\clauselevel=1
 \advance\recno by1 \xcl{\hss\the\clno\char\the\recno.\enspace}}

\def\aacl{\clauselevel=1
 \advance\recno by1 \xcl{\hss\the\clno\char\the\recno\char
  \the\recno.\enspace}}

\def\aaacl{\clauselevel=1
 \advance\recno by1 \xcl{\hss\the\clno\char\the\recno\char\the\recno%
    \char\the\recno.\enspace}}

\def\ascl{\clauselevel=2
 \advance\recno by1 \xcl{\hss(\the\sclno\char\the\recno)\enspace}}

\def\aascl{\clauselevel=2
 \advance\recno by1 \xcl{\hss(\the\sclno\char\the\recno%
    \char\the\recno)\enspace}}

\def\aaascl{\clauselevel=2
 \advance\recno by1 \xcl{\hss(\the\sclno\char\the\recno\char\the\recno%
    \char\the\recno)\enspace}}

\let\dateofservice\empty
\let\dateofreservice\empty
\let\dateofrereservice\empty
\let\dateofrerereservice\empty
\let\datewritissued\empty

\def\resetpleadingdefaults{%
   \ifnum\ct=1
     \def\endofpleading{%
      \medskip
      Dated this \nodate\par\signature
      \bottomofpleading{%
        \rightline{\vtop{\hsize=.6\hsize
          The \forwhom's \solicitors\ are \sols 
          where they will accept service of proceedings 
          on behalf of the \forwhom.}}
        \bigskip
        \leftline{\vtop{\hsize=.6\hsize
          To the District Judge of the \courtname\ 
          COUNTY COURT and to the \notforwhom.}}
        }}%
   \else
    \def\endofpleading{%
      \signature
      \bottomofpleading{%
        Served the \nodate by \ignorespaces\sols \solicitors\ 
        for the \forwhom}}
   \fi
   \gdef\amendnote{}% Reset it.
   \let\dateofservice\empty
   \let\dateofreservice\empty
   \let\dateofrereservice\empty
   \let\datewritissued\empty
   \setamendcount{0}%
   \global\maxp@rtywidth=\the\maxpartywidth}

% These may change. They set up names.

\gdef\Plaintiffs{\ifappeal Appellants\else\ifapplication Applicants%
  \else Plaintiffs\fi\fi}
\gdef\Plaintiff{\ifappeal Appellant\else\ifapplication Applicant%
  \else Plaintiff\fi\fi}
\gdef\Defendants{\ifappeal Respondents\else\ifapplication Respondents%
  \else Defendants\fi\fi}
\gdef\Defendant{\ifappeal Respondent\else\ifapplication Respondent%
  \else Defendant\fi\fi}
\gdef\Thirdparty{Third Party}
\gdef\Thirdparties{Third Parties}

% examples of use

% This assumes that \clientpl has already been set true or false
\def\arrangement{%
 \def\endofpleading{}
  \spleading{ARRANGEMENT}}

\def\soc{%
  \ifx\Writissued\empty\def\Writissued{Writ issued the \nodate}\fi
  \clientpltrue
  \pleading{STATEMENT OF CLAIM}}

\def\defence{%
 \let\Writissued\empty
 \clientplfalse
 \pleading{DEFENCE}}

\def\dacc{%
 \gdef\counterclaim{%
   \vskip\the\clskip
   \centerline{COUNTERCLAIM}
   \nobreak}
 \let\Writissued\empty
 \clientplfalse
 \pleading{DEFENCE AND COUNTERCLAIM}
 \smallskip
 \centerline{DEFENCE}
 \nobreak}

\def\counterclaim{% Counterclaim on its own
 \let\Writissued\empty
 \clientplfalse
 \pleading{COUNTERCLAIM}}

\def\reply{% Reply on its own
 \let\Writissued\empty
 \clientpltrue
 \pleading{REPLY}}

\def\rdcc{% Reply and Defence to Counterclaim
 \let\Writissued\empty
 \clientpltrue
 \pleading{REPLY AND DEFENCE TO COUNTERCLAIM}}

% County Court. Note: These macros do not yet reproduce
% all (or indeed any) of the batty prescribed forms, although
% it would not be difficult to achieve this.
% Most macros are the same as the HC macros

\def\poc{%
 \let\Writissued\empty
 \clientpltrue
 \pleading{PARTICULARS OF CLAIM}}

% The Affidavit macros. These are fairly complicated
% First, some general bits and pieces

\newtoks\shortinitials \shortinitials={}
\newtoks\tempinitials \tempinitials={}
\newtoks\surname \surname={} 
\newif\ifsomeletters \somelettersfalse
\newif\ifspace \spacefalse
\newif \ifpunct
\newtoks\firstletter \firstletter={}
\newif\ifmac \macfalse
\newtoks\longinitials \longinitials={}

\newcount\lettercount
\newcount\surnamecount
\newcount\front

\def\affyno#1{%
 \def\affno{\addsuffix{#1}}}
\affyno{1}% set 1st as default

% Now some stuff to extract initials from fullnames

\def\itsaspace{% 
\dbhelp{It is a space}%
  \ifsomeletters% 
    \edef\tin{\the\shortinitials\the\firstletter.}%
    \shortinitials=\expandafter{\tin}%
    \somelettersfalse\fi%
  \lettercount=0\surnamecount=0\relax\unskip}

\def\itsaletter#1{%
\dbhelp{It is a letter-"#1"}%
  \advance\lettercount by1% #1 is a letter
  \advance\surnamecount by1\relax%
  \ifnum\lettercount=1 \firstletter={#1}
   \someletterstrue\fi
  \ifnum\surnamecount=1\surname=\expandafter{#1}%
    \tempinitials=\expandafter{#1}%
  \else\ifnum\surnamecount>1%
    \tempinitials=\expandafter{\the\tempinitials#1}
    \maccheck{#1}%
  \fi\fi}

\def\maccheck#1{%
\dbhelp{Doing MacCheck}%
  \ta={Mc}
  \edef\tone{\the\ta}%
  \edef\ttwo{\the\tempinitials}%
  \ifx\tone\ttwo
    \mactrue
    \surname=\expandafter{\the\tempinitials}%
  \else\ifpunct\punctfalse\surname=\expandafter{\the\surname#1}%
   \firstletter=\expandafter{\the\firstletter#1}%
  \else\ifmac\macfalse\surname=\expandafter{\the\surname#1}%
    \firstletter=\expandafter{\the\tempinitials}%
  \else\surname=\expandafter{\the\surname\lowercase{#1}}%
  \fi\fi\fi}

\def\itspunctuation#1{%
\dbhelp{It is punctuation-"#1"}%
%\def\temppunct#1{\if#1\noexpand~-\else#1\fi}%
  \somelettersfalse
  \edef\tin{\the\tempinitials#1}
  \tempinitials=\expandafter{\tin}%
  \surname=\expandafter{\the\surname#1}%
  \someletterstrue
  \if#1\space\firstletter=\expandafter{\the\firstletter.}\else
   \firstletter=\expandafter{\the\firstletter#1}\fi
  \advance\surnamecount by1\puncttrue\relax}

\gdef\length#1{\lettercount=0\surnamecount=0
\unskip\ignorespaces\getlength#1!}

\gdef\getlength#1{%
\dbhelp{Character="#1"}
  \unskip\ignorespaces
  \if#1!
    \let\next=\relax
    \edef\tin{\the\shortinitials\the\firstletter.}%
    \longinitials=\expandafter{\tin}%
  \else% ie if not end of name
    \edef\fullname{\fullname#1}%
    \dbhelp{Fullname="\fullname"}%
    \ifcat\noexpand#1\noexpand~  \itsaspace\fi% 
    \if#1\noexpand_\itspunctuation{ }\else
     \ifcat#1-\itspunctuation{#1}\fi\fi%
    \ifcat#1a \itsaletter{#1}\fi%
    \let\next=\getlength%
 \fi% it is an exclamation mark
 \unskip\next}

\gdef\deponent{%
 \enddoc \endedtrue
 \def\clearexno{\exno=0 \front=0}%Use \setexno{n} to reset to other number.
 \shortinitials={}%reset the lot
 \surname={}
 \longinitials={}
  \def\of##1{\def\hisaddr{##1}%
  \ifx\hisaddr\empty\def\hisaddr{[{\it address\/}]}\fi}%
  \def\occupation##1{\def\hisoccupation{##1}%
  \ifx\hisoccupation\empty
    \def\hisoccupation{[{\it occupation\/}]}\fi
    \def\comma{, }}%
  \of{}\occupation{}% set up the defaults
  \def\nooccupation{\def\hisoccupation{}%
    \def\comma{}}%
  \catcode`\ =\active % Make spaces active ftb.
  \global\catcode`\_=\other % Make underlines into letters
  \let\tempt=~ \catcode`\~=\other \let\tilde=~ % check tilde
  \let\tempb=\blank \let\blank=\space
  \whatsnext}

\def\whatsnext#1{%
  \ifx#1\noname
   \shortinitials={\blank}%
   \surname={\blank\blank}%
   \longinitials={\blank\blank}%
   \def\fullname{\noname}%
  \else
   \edef\fullname{}%
   \length{#1}%
  \fi
  \def\depsname{\hbox{\ignorespaces%
    \the\shortinitials\space\the\surname}}%
  \xdef\inits{\the\longinitials}%
  \catcode`\ =10% reset the catcodes
  \catcode`\~=\active
  \catcode`\_=8
  \let~=\tempt
  \let\blank=\tempb
  \gdef\deplname{I, \fullname, of \hisaddr\comma 
   \hisoccupation, make oath and say as follows---}}

\def\affidavit{\par% Note: This does NOT set \clientpl
  \clearexno
  \draft{AFFIDAVIT}% This has been moved
  \gettitle
  \pleadingtrue
  \endorsementtrue
  \ifdraft
   \def\signoff{\endofpleading\settled}%
  \else\let\signoff\endofpleading\fi
  \def\endofpleading{%
    \bottomofpleading{\sworn}}%
  \ifdraft\else
    \def\doextras{\getfrontsheets\let\doextras\empty}
  \fi
  \endorsement
  \heading
  \sparties
  \deplname % produces I, etc, make oath, etc.
  \medskip}

\def\endorsement{\tlap{\rightline{%
 \baselineskip=13pt\tenbf\getendorsement}\medskip}}

\def\bsendorsement{\tlap{\xcenterline{%
 \baselineskip=10pt\ninebf\getendorsement}}}

\def\getendorsement{%
 \setbox0\hbox{Deponent}\dimen1=.4\wd0
 \setbox0\hbox{Party\hskip\dimen1\forwhom}\dimen2=\wd0
 \setbox0\hbox{Deponent\hskip\dimen1\depsname}%
  \ifdim\wd0>\dimen2 \dimen2=\wd0\fi
 \setbox0\hbox{No.\ of Affidavit\hskip\dimen1\affno}%
  \ifdim\wd0 >\dimen2 \dimen2=\wd0\fi
 \setbox0\hbox{Date Sworn\hskip\dimen1\whensworn}%
  \ifdim\wd0>\dimen2 \dimen2=\wd0\fi
 \vbox{%
  \hbox to \dimen2{Party\dotfill\ignorespaces\forwhom}%
  \hbox to \dimen2{Deponent\dotfill\ignorespaces\depsname}
  \hbox to \dimen2{No.\ of Affidavit\dotfill%
    \hbox{\ignorespaces\affno}}%
  \hbox to \dimen2{Date Sworn\dotfill\whensworn}%
 }}

\def\frontsheet#1{% Produces frontsheets for exhibits
  \vfil\eject
  \endorsement
  \heading
  \sparties
  \pageno=0
  \nopagenumbers
  \inform{Frontsheet for Exhibit "\inits \number#1"}%
  \vtop{\raggedright\uchyph=0
   This is the Exhibit marked ``\inits\,\number#1'' referred to 
   in the Affidavit of \fullname\ sworn before me this \nodate
   \vskip1.5in
   \hskip.6\hsize\nobreak Solicitor }%
  \vfil\eject}

\def\getfrontsheets{%
 \ifnum\exno=0
 \else
  \loop
  \advance\front by1
  \frontsheet{\number\front}%
  \ifnum\exno>\number\front\repeat
 \fi}

% End of affidavit macros


% Originating Summons - long form

%\gdef\os{%
% \topofpleading{ORIGINATING SUMMONS}{0}
% \def\endos{\bottomofpleading{\endostext}}
% \ostext}
%
% Originating Summons - short form 
%
% Minutes of Order
%
%\def\minutes{%
%  \topofpleading{MINUTES OF ORDER}{0}
%  \medskip
%  \centerline{MINUTES OF ORDER}
%  \medskip
%   {\scaps This Application}, \etc\par
%   {\scaps And Upon Hearing}, \etc\par
%   {\scaps And Upon Reading}, \etc\par}
%
\def\order{%
  \topofpleading{ORDER}{0}
  \medskip
  \centerline{ORDER}
  \medskip}

% Other macros take the same form. (More will be added.)

\def\statementofclaim{%
  \topofpleading{\amend STATEMENT OF CLAIM}{0}
  \medskip
  \centerline{\amend STATEMENT OF CLAIM}
 \par\nobreak\medskip}

\def\endwrittext{%
    {\scaps This Writ} was issued by \ignorespaces\sols \solicitors\ for 
    the said \plaintfs\ whose \addressis\ as stated above}

\def\endgenwrit{% This can be removed
%  \signature
   \bottomofpleading{%
    {\scaps This Writ} was issued by \ignorespaces\sols \solicitors\ for 
    the said \plaintfs\ whose \addressis\ as stated above}}

\def\sjsummons{% O.14. It may be necessary to set \clientpl
  \origprocess{SUMMONS}{\summarytext}{}{}{\endsummarytext}%
  }

\def\spsummons{% O.86. It may be necessary to set \clientpl
 \topofpleading{SUMMONS}{0}
 \specifictext}

\def\summons{% This is an ordinary summons
  \topofpleading{SUMMONS}{0}
  \summonstext}
 
\def\endsummons{%
  {\scaps Dated} \nodate
  \bottomofpleading{This Summons was taken out by\sols \solicitors\ for 
  the above-named \forwhom\par
  \medskip
  To the \notforwhom\ and to \theirsols, of \theirsolsaddr, Solicitors 
  for the above-named \notforwhom.}}

\def\defenceandcounterclaim{%
  \reset
  \def\doctype{DEFENCE AND COUNTERCLAIM}
  \pleadingtrue
  \clientplfalse
  \draftparameters
  \gettitle
  \def\backsheet{\enddoc\bsdft}
  \heading
  \parties
  \centerline{\amend DEFENCE}
  \medskip}

\def\reply{%
  \reset
  \def\doctype{\amend REPLY}
  \clientpltrue
  \heading
  \ifnoparties\else\parties\fi
  \centerline{\amend REPLY}
  \medskip}

\def\replyanddefencetocounterclaim{%
  \reset
  \def\doctype{\vtop{\hsize=2.5in
    \centertext{\amend REPLY AND DEFENCE 
    TO COUNTERCLAIM}}}
  \clientpltrue
  \heading
  \ifnoparties\else\parties\fi
  \centerline{\amend REPLY AND DEFENCE TO COUNTERCLAIM}
  \medskip
  \centerline{\amend REPLY}
  \medskip}

\def\counterclaim{% This is for use in a Defence & Counterclaim
  \bigbreak\centerline{\amend COUNTERCLAIM}\nobreak\medskip}

\def\particulars{\clno=0
  \par\smallskip\centerline{PARTICULARS}\par}

\def\served{%
  \bottomofpleading{%
  Served the \nodate by \ignorespaces\sols \solicitors\ 
  for the \dfdants}}

% backsheet macros

% Misc

\edef\workdone{}
\newtoks\tempwd \tempwd={}
\newdimen\bstopincrease \bstopincrease=.5in
\newdimen\bsbotincrease \bsbotincrease=.5in
\def\chittitle{%
  \slistpls\cr
  \ v.\cr
  \slistdfs\cr}
\newdimen\storeparindent

\def\osinhtext{LET\ignorespaces\getdefs\ attend 
  before Master \nomonth at Chancery Chambers, 
  Room No.\noday, Royal Courts of Justice, Strand, 
  London, WC2A2LL on a day to be fixed on the hearing 
  by the \plaintfs \getpls for the following relief, 
  that is to say---\par
\medskip}

\def\endosinhtext{And let the \dfdants\ within [14 days] 
  after service of this summons on \them\ counting the 
  day of service, return the accompanying Acknowledgment 
  of Service to the appropriate Court Office.\par
  \nobreak\smallskip
  Dated the \nodate

  {\bf Note---}This summons may not be served later than 12 
  calendar months beginning with the above date unless 
  renewed by order of the Court.\par
  \medskip
  This summons was taken out by \ignorespaces\sols \solicitors\ 
  for the said \plaintfs\ whose \addressis\ as stated above
  \medskip

  {\bf Note---}If a defendant does not attend personally 
  or by his counsel or solicitor at the time and place 
  above-mentioned such order will be made as the Court may 
  think fit just and expedient.\par
  \medskip
  A defendant who is a personal representative must, 
  within 21 days after service of this summons on him, 
  counting the day of service, lodge with the court an 
  affidavit in answer, stating the particulars required by 
  Order 99, rule 5 of the Rules of the Supreme Court.\par
  \medskip
  \centerline{\bf IMPORTANT}\par\nobreak
  Directions for Acknowledgment of Service are given with the 
  accompanying form.\par
  }

\def\summarytext{% Spacing reduced to get it on one page
  \twelvebase=17pt\twelvepoint
  \smallskip
  {\scaps Let all parties} concerned attend \chambers\ 
  Royal Courts of Justice, Strand, London WC2A 2LL, 
  on  \phantom{[Mon]}day the \nodate\ at \noname on 
  the hearing of an application on the part of the \plaintfs\ 
  for the  relief claimed in the Statement of Claim
  \smallskip
  {\scaps Take Notice} that a party intending to oppose 
  this application or to apply for a stay of execution 
  should send to the opposite party or his Solicitor to 
  reach him not less than three days before the date 
  above mentioned a copy of any affidavit intended to be used.}

\def\endsummarytext{%
  {\scaps Dated} \nodate
  \smallskip
  This summons was taken out by \ignorespaces\sols \solicitors\ 
  for the \plaintfs.
  \smallskip
  TO \noname, of \noaddr, \solicitors\ for the \dfdants.\par}

\def\specifictext{%
  \smallskip
  {\scaps Let all parties} concerned attend before Master
  \if\mast\empty\blank\blank\else\mast\ \fi
  at the Chambers of the Judge, Room No.~\phantom{100}, Royal
  Courts of Justice, Strand, London WC2A 2LL, on
  \phantom{Wednesday} the \nodate\ at \phantom{12}~o'clock in
  the \phantom{after}noon on the hearing of an application on
  the part of the \plaintfs\ for the following relief---

  \cl An order pursuant to Order 86 of the Rules of the Supreme Court 
  for specific performance of the agreement in the Writ in this action 
  mentioned in the terms of the Minutes set out in the Schedule hereto

  \cl All necessary and further inquiries and accounts

  \cl In the alternative Directions as to the pleading in and further 
  conduct of this action
  \schedule\par}

\def\summonstext{%
  {\scaps Let all parties} concerned attend before Master \blank
  at the Chambers of the Judge, Room No.~\phantom{100}, Royal
  Courts of Justice, Strand, London WC2A 2LL, on
  \phantom{Wednesday} the \nodate\ at \phantom{12}~o'clock in
  the \phantom{after}noon on the hearing of an application on
  the part of the \plaintfs\ for the following
  relief---\par\nobreak\medskip} 

\def\ostext{%
  TO\ignorespaces\getdefs
  \smallskip
  {\scaps Let The \expandafter{\dfdants}}\ within [14] days after 
  service of this summons on \them\ \respectively, counting the day 
  of service, return the accompanying Acknowledgment of Service 
  to the appropriate Court Office
  \smallskip
  {\scaps By This Summons}, which is issued on the application of the
  \plaintfs\unskip\space\getpls\unskip\space the \plaintfs\ \seek\ the 
  following relief, that is to say---\hfil\par}

\def\endostext{%
  If the \dfdants\ \do\ not acknowledge service, such judgment may 
  be given or order made against or in relation to \them\ as the 
  Court may think just and expedient
  \medskip
  Dated the \nodate
  \medskip
  {\bf Note}---This summons may not be served later than 4~calendar 
  months beginning with the above date unless renewed by order of 
  the Court.
  \medskip
  This summons was taken out by \ignorespaces\sols \solicitors\ 
  for the said \plaintfs\ whose \addressis\ as stated above
  \medskip
  \centerline{\bf IMPORTANT}\par\nobreak
  Directions for Acknowledgment of Service are given with the 
  accompanying form.\par
  }

\def\subjectmatter#1#2{%#1=matter,#2=text
  \global\advance\mattercount by1
  \rightappenditem{\scaps#1 \rm of} #2\to\matters}

\def\matter#1{\subjectmatter{In the Matter}{#1}}
\def\estate#1{\subjectmatter{In the Estate}{#1}}

\def\re#1{\nopartiestrue\def\res{\vbox{\hsize=2.8in
  \centertext{#1}}}}

% Set up the parties

\def\forwhom{\pltext\dftext%\unskip
  \ifclientpl\plaintfs\else\dfdants\fi}

\def\notforwhom{\pltext\dftext%\unskip
  \ifclientpl\dfdants\else\plaintfs\fi}

\newcount\ct % courts
\def\court{\ifcase\ct IN THE HIGH COURT OF JUSTICE
  \or IN THE \courtname\ COUNTY COURT
  \or IN THE COURT OF APPEAL
  \or IN THE HOUSE OF LORDS
  \else IN THE HIGH COURT OF JUSTICE
  \fi}

\def\highcourt{\ct=0}

\def\countycourt{%\ct=1 \div=0 \dref=0
  \morecountycourtdefaults\countycourtstuff\getcourtname}

\def\getcourtname{% adapted from \setupccrefs below
 \begingroup\obeylines
 \aftergroup\getnameofcase\casereferences}

\def\getnameofcase{%
 \def\dateref{}%
 \def\caseref{}%
 \def\courtname{\argument1}%
 }


\def\courtofappeal{\ct=2\def\appealtext{\courtofappealtrue}}
\def\houseoflords{\ct=3}

\newcount\div
\newcount\dref

\def\chancery{\div=1 \dref=1
  \def\divref{CH\ }
  \def\issuer{Chancery Chambers}
  \def\chambers{Master
  \if\mast\empty \blank
    \else\mast\ \fi in Chancery
  Chambers, Room No.\noday, }}

\def\queensbench{\div=2 \dref=2
  \def\divref{QB\ }
  \def\issuer{Central Office}
    \def\chambers{the Master in Chambers in Room No.\noday, 
  Central Office, }}

\def\familydivision{\div=3 \dref=3
  \def\divref{No.\ }
  \def\issuer{The Principal [{\it or\/} 
  \blank District Probate] Registry}
    \def\chambers{}}

\newcount\subdiv
\def\subdivision{\ifcase\subdiv 
  \or Companies Court
  \or Commercial Court
  \or Official Referee's Court
  \or The Principal [{\it or\/} \blank District Probate] 
    Registry
  \fi}
\def\companiescourt{\subdiv=1}
\def\commercialcourt{\subdiv=2}
\def\OR{\subdiv=3}
\def\probateregistry{\subdiv=4}

\def\mrjustice{}
\def\judge#1{\def\mrjustice{#1}}
\def\judgename{\if\mrjustice\empty\else Mr Justice \mrjustice\fi}

\def\mast{}
\def\master#1{\def\mast{#1}}
\def\mastername{\if\mast\empty\else Master \mast\fi}

\def\divref{\ifcase\dref 
  \or CH\
  \or QB\
  \or Fam.\
  \fi}

\def\dateref{\ifcountycourt\else\number\year\fi}
\def\caseref{\ifcountycourt\else --\phantom{A}--\fi}
\def\casenumber{No.~\phantom{1234}}
\def\issued{}
\def\writissued{}
\def\issued#1 #2 #3 {\def\writissued{%
  Writ issued the #1 day of #2 #3}}

\def\no#1 {\def\casenumber{No.\ #1}
  \def\dateref{}
  \def\caseref{}}

\def\reference{\divref\dateref\caseref\casenumber}

% Can't remember what these did...
%\def\sref#1{\def\sref{#1}}
%\def\cref#1{\creftrue\def\cref{#1}}

\def\attention#1{\def\attentionof{#1}}
\attention{}
\long\def\comment#1{\def\faxtext{\if#1\empty
 \else\medskip#1\fi}}
\comment{}

\def\backsheet{\enddoc\bsdft}% default
\let\beginos\os

% Here are all the default parameters set by LeXTeX---

\greektrue % Used in \sssscl
\cardtrue % Used in \ssssscl
\clindtrue % hanging indentation in clauses
\nocommaindatefalse % Comma in the date
\qfalse %  No quotes in quotations

\footindent=10pt % Indentation of footnotes
\clindent=23pt % Indentation of clauses
\sclindent=46pt % Indentation of sub-clauses
\ssclindent=69pt % Indentation of sub-sub-clauses
\sssclindent=92pt % Indentation of sub-sub-sub-clauses
\ssssclindent=115pt % Etc
\sssssclindent=138pt % Etc
\cnindent=65pt % indentation of "computer-numbered" clauses

\hclindent=0pt % Indentation of clauses if clindfalse
\hsclindent=\clindent % Ditto of sub-clauses
\hssclindent=\sclindent % Etc
\hsssclindent=\ssclindent
\hssssclindent=\sssclindent
\hsssssclindent=\ssssclindent

\parindent=20pt % indentation of paragraphs
\quoteindent=20pt % indentation of quotations
\quoteparindent=20pt % \parindent in a quotation
\rbracketsize=2.85in % The width of the \vbox used for \ssd etc
\lbracketsize=2.225in % The width of a left bracket \vbox
\brackdepth=.5in % The space left under "in the presence of---"
\hfuzz=1.5pt
\hsize=5.35in
\vsize=8.5in
\hoffset0.5in
\voffset.5in
\parskip=3pt plus .75pt minus .75pt
\def\footnoterule{}

\quoteparskip=1.5pt plus 1pt % The amount of \parskip in quotes
\blankskip=10pt plus20pt minus 0pt % Used in \noaddr etc
\signindent=3.5in % Indentation of signature 

\settledgap=1in plus.3fill minus.5in % v. space Settled, \inn
\clskip=\medskipamount % amount of skip before a clause
\sclskip=\smallskipamount % amount of skip before a \scl
\ssclskip=0pt plus1pt minus0pt % amount of skip before a \sscl
\sssclskip=0pt plus.5pt minus0pt % ditto before a \ssscl

\twelvebase=18pt % \normalbaselines in \twelvepoint
\tenbase=15pt    % \normalbaselines in \tenpoint
\ninebase=11pt   % \normalbaselines in \ninepoint

\twelvesmallskipamount=4.5pt plus1pt minus1pt
\twelvemedskipamount=9pt plus2pt minus2pt
\twelvebigskipamount=18pt plus4pt minus4pt
% The next three are set by PLAIN
%\tensmallskipamount=3pt plus1pt minus1pt
%\tenmedskipamount=6pt plus2pt minus 1pt
%\tenbigskipamount=12pt plus4pt minus4pt
\ninesmallskipamount=2pt plus.5pt minus.5pt
\ninemedskipamount=4pt plus1pt minus 1pt
\ninebigskipamount=8pt plus2pt minus 2pt

% The next three are used by xref/contents macros
\notespace=0.2in % space marginal notes--text
\maxnote=1.0in % width of note
\clnamelength=0pt % Default width in table of contents
\pagewidth=\hsize % used by the index macros
\pageheight=\vsize 

\def\against{and} % the "and" between parties in pleadings

\tolerance=750

\def\engrossment{%
 \draftfalse
 \def\csettled##1{}
 \def\cresettled##1{}}

\def\setexno#1{\def\clearexno{\exno=#1 \front=#1}\clearexno}

\countdef\totaldocuments=1 \totaldocuments=0
\countdef\totalpages=2 \totalpages=1

\def\advancepageno{\ifnum\pageno<\z@ \global\advance\pageno\m@ne
  \else\global\advance\pageno\@ne\fi
  \global\advance\totalpages\@ne}
  \output{\plainoutput}

\def\plainoutput{\ifnum\pageno=1 \global\advance\totaldocuments\@ne\fi
  \message{Shipping out page}
  \shipout\vbox{\makeheadline\pagebody\makefootline}%
  \inform{(\ifnum\pageno=0 Unnumbered page\else Page \the\pageno\fi
    \space of Document \the\totaldocuments, 
    Total of \the\totalpages\space\ifnum\totalpages=1 page\else pages\fi\space so far)}%  
  \inform{}%
  \advancepageno
  \ifnum\outputpenalty>-\@MM \else\dosupereject\fi}

\let\backmatter=\empty
\let\signoff=\empty

\def\bstitle#1{%
 \getbstitlewidth
 \def\title{\setbox0\hbox{#1}
  \ifdim\wd0<\bstitlewidth\copy0
   \else\vtop{\hsize=\bstitlewidth\centertext{#1}}\fi
 }} % used for backsheets

\newdimen\maxpartywidth 

% These slightly complicated macros were derived from some suggestions made
% by Amy Hendrickson in TUGboat Vol 11, No 3, p359.
% \default defines eg \argument1 to be parameter 2.
% Unfortunately it would not be possible to call \argument1 directly.
% It would be necessary to use \csname argument1\endcsname[parameter 2]
% The macro \argument gets round this difficulty; \argument{1} (or \argument1
% if there is only one token to be used) converts to \argument1 (all one word).
% So \argument12 converts to \argument1{2}. Clear?
          
\def\default#1#2{\expandafter\def\csname argument#1\endcsname{#2}}
\def\argument#1{\csname argument#1\endcsname}

\def\highcourtdefaults{%
 \resetpleadingdefaults
 \ct=0% I think this should be elsewhere
 \default1{\number\year}
 \default2{\phantom{W}}
 \default3{\phantom{4321}}
 \def\divref{CH~}
 }

% get rid of old defs
\def\dateref{}
\def\caseref{}
\def\casenumber{}

\def\probatedefaults{%
 \resetpleadingdefaults
 \default1{}
 \default2{}
 \default3{}
 \def\divref{File No.~}
 \def\sparties{}}

\def\countycourtdefaults{%
 \resetpleadingdefaults
 \default1{\phantom{1234}}
 \def\divref{}
 }

\def\morecountycourtdefaults{%
 \resetpleadingdefaults
 \default1{\phantom{BORCHESTER}}
 \def\divref{}
 }

\def\division{\ifcase\div% \blank Division
  \or Chancery Division%            1
  \or Queen's Bench Division%       2
  \or Family Division%              3
  \or\or\or\or\or\or\or%           10
  \or Chancery Division (Probate)% 11
  \else \blank Division
  \fi}

\def\chanceryp{\div=11 \dref=1
  \def\divref{CH\ }
  \def\issuer{Chancery Chambers}
  \def\chambers{Master
  \if\mast\empty \blank
    \else\mast\ \fi in Chancery
  Chambers, Room No.\noday, }}

\def\countycourtstuff{%
 \ct=1 \div=0 \dref=0
 \countycourttrue
 }%

\gdef\ch{%
  \pleadingtrue\highcourtdefaults
  \chancery\setuphcrefs}
\gdef\qb{%
  \pleadingtrue\highcourtdefaults
  \queensbench\setuphcrefs}
\gdef\family{%
  \pleadingtrue\highcourtdefaults
  \familydivision\setupfamrefs}
\gdef\case{%
  \pleadingtrue\countycourtdefaults
  \countycourtstuff\setupccrefs}
\gdef\chp{%
  \pleadingtrue\highcourtdefaults
  \chanceryp\setuphcrefs}
\def\probate{%
  \pleadingtrue\probatedefaults
  \familydivision\begingroup}

\def\setuphcrefs{% The \endgroup is given by \lookatarg
 \begingroup\obeylines
 \aftergroup\setuphighcourt\casereferences}

\def\setupfamrefs{% The \endgroup is given by \lookatarg
 \begingroup\obeylines
 \aftergroup\setupfamcourt\casereferences}

\def\setupccrefs{%
% \countycourtdefaults
 \begingroup\obeylines
 \aftergroup\setupcountycourt\casereferences}

\def\setuphighcourt{%
 \def\dateref{\argument1}%
 \def\caseref{---\argument2---}%
 \def\casenumber{No.~\argument3}%
 }

\def\setupfamcourt{%
 \def\dateref{\argument1}%
 \def\caseref{ of~\argument2}%
 \def\casenumber{}%
 }

\def\setupcountycourt{%
 \def\dateref{}%
 \def\caseref{}%
 \def\casenumber{Case No.~\argument1}%
 }

% Note: Do not concatenate the next two lines
% The end of line is the delimiter of #1 of \casereferences.
% roger is the delimiter of #1 of \lookatarg. See Amy Hendrickson's
% Article in TUGboat for an explanation.
 
{\obeylines\gdef\casereferences#1
{\expandafter\lookatarg#1 roger }}

\newcount\argcount \argcount=0
\def\endofargs{roger}

\def\lookatarg#1 {\def\thisarg{#1}
  \ifx\thisarg\empty \let\go\lookatarg\else
  \ifx\thisarg\endofargs\let\go\endgroup
  \else\unskip\advance\argcount by1
   \expandafter\xdef\csname argument\the\argcount\endcsname{\thisarg} 
  \let\go=\lookatarg
  \fi\fi
  \go}

\def\registry#1{%
  \gdef\regis{#1 Registry}}
\let\regis\empty


% Move the next def
\def\appealcourt{\def\apcourt{ON APPEAL FROM
                  \headingskip
                  \courtappealled}}
\let\apcourt\empty 

\newdimen\bstitlewidth 
\def\getbstitlewidth{\iffullsize\bstitlewidth=\hsize
 \else\bstitlewidth=.5\hsize\fi}

% add to counter too many backsheet in multiple affys
\newif\ifended

\def\datesworn#1{\def\whensworn{#1}}
\datesworn{~~/~~/\number\year}

\def\origprocess#1#2#3#4#5{%#1=text for \draft, #2=intro text,
% #3=heading of document, #4=signature (if used), #5=end text
  \enddoc
  \storeparindent=\the\parindent
  \global\parindent=0pt
  \draft{#1}
  \pleadingtrue
  \gettitle
  \heading
  \parties
  \def\endofpleading{#4\bottomofpleading{#5}}
  \ifdraft
   \def\signoff{\endofpleading\settled} % see \chit
  \else\let\signoff\endofpleading\fi
  \medbreak
  \leavevmode
  #2\par
  \centertext{#3}
  \nobreak
  \amendnote}

\gdef\os{%
  \origprocess{ORIGINATING SUMMONS}%
    {\ostext}{}{}{\endostext}}
  
\def\osinheritance{%
  \origprocess{ORIGINATING SUMMONS}%
    {\osinhtext}{}{}{\endosinhtext}}

\def\specialwrit{%
   \clientpltrue
   \origprocess{WRIT OF SUMMONS\break(SPECIALLY ENDORSED)}%
    {\writtext}{STATEMENT OF CLAIM}{\signature}{\endwrittext}}

\def\generalwrit{% No Statement of Claim
   \origprocess{WRIT OF SUMMONS\break(GENERALLY ENDORSED)}%
    {\writtext}{}{\signature}{\endwrittext}}

\def\writ{\specialwrit}

\def\pageparameters{
  \def\footnoterule{}
  \parindent=10pt
  \quoteindent=20pt
  \quoteparindent=10pt
  \twelvepoint
}

% These should be redefined in RHlocal
\def\myaddress{\ouraddress}
\def\ouraddress{}

\newif\iffax
\def\faxsheet{\faxtrue}

\def\printfaxsheet{%
  \amendtextfalse
  \gdef\doctype{Sent by Fax}
  \inform{\doctype}
  \draftparameters
  \draftfalse
  \getworkdone
  \let\backmatter\empty
  \let\signoff\empty
  \clindfalse
%  \begingroup
   \pageno=1
   \nopagenumbers
   \parindent=0pt
   \centerline{\caps Fax from \counselname}
   \centerline{\vtop{\baselineskip=13pt\halign{\hfil##\hfil\cr
      \myaddress\crcr}}\strut}
   \bigskip
   \leftline{\vtop{\tenpoint\halign{##\hfil\cr
      \today\cr
      \noalign{\medskip}
      Solicitors' Reference---\sref\cr
      Counsel's Reference---\cref\cr
      \if\attentionof\empty\else
       \noalign{\medskip}
       For the Attention of \attentionof\cr
      \fi
     }\strut}}
   \bigskip
   \ifpleading\def\title{\chittitle\hfil}\fi
   \centerline{\vtop{\halign{\hfil##\hfil\cr\title\crcr}}}
   \vfil
   \centerline{\caps This Fax Consists of \the\count1\ Pages}
     \centerline{\caps (including this page)}
   \faxtext
   \vfil
   \def\addressfile{solicitors}
    \getaddress
    \leftline{\vtop{\baselineskip=13pt
                   \halign{##\hfil\cr
                     \sols\crcr}
                   \strut}}
   \supereject
 %  \endgroup
   \faxfalse}

\font\eightsl=cmsl8
\font\eightit=cmti8

\def\ca{% \def\v has been moved since it caused spacing problems
\begingroup\it\frenchspacing % This deals with, eg. Ltd. and v.
}

\def\v{\unskip\/\ {\rm v}\maybespace}% taken out of \ca
\def\se{\unskip\/\endgroup\maybespace}% mod aftergroup

\def\signed{%
 \inform{signature}%
 \par\nobreak
 \vskip1in plus 1fill
 \hbox{\hskip\signindent\vtop{%
  \parindent0pt
  \inn
  \hbox{\today}}}%
  \vskip 1in plus 2fill minus1in}

\def\jsigned{%
 \inform{signatures}%
 \par\nobreak
 \vskip1in plus 2fill
 \hbox{\hskip\signindent\vtop{%
  \parindent0pt
  \inn
  \hbox{\today}}}%
  \vskip 1in plus 1fill minus1in}

\def\copysigned{%
 \par\nobreak
 \vskip.75in plus 1fill
 \hbox{\hskip\signindent\vtop{%
  \parindent0pt
  \hbox{\counselname}
  \hbox{\inn}
  \hbox{\today}}}%
  \vskip 1in plus 2fill minus1in}

% These are defined twice! One should go...
\def\csettled#1{%
 \par\nobreak
 \vskip1in plus 1fill
 \hbox{\hskip\signindent\vtop{%
  \advance\hsize by-\signindent
  \parindent0pt
  \raggedright\tolerance=1000
  Settled, \ignorespaces#1
  \vskip\settledgap
  \inn
  \hbox{\today}}}%
  \vskip 1in plus 2fill minus1in}

\def\cresettled#1{% Note the \par
 \par\nobreak
 \vskip1in plus 1fill
 \hbox{\hskip\signindent\vtop{%
  \advance\hsize by-\signindent
  \parindent0pt
  \raggedright\tolerance=1000
  Re-Settled, \ignorespaces#1
  \vskip\settledgap
  \inn
  \hbox{\today}}}%
 \vskip 1in plus 2fill minus1in}

\def\silenthyphen{\space}

\def\footnotemark{% One bracket deleted.
 \let\@sf\empty\relaxnext@\ifhmode\edef
 \@sf{\spacefactor\the\spacefactor}\/\fi
 \def\next@{\ifx[\next\let\next\nextii@\else
  \ifx"\next\let\next\nextiii@\else
  \let\next\nextiv@\fi\fi\next}% bracket deleted.
 \def\nextii@[##1]{\footmarkform@{##1}\@sf}%
 \def\nextiii@"##1"{{##1}\@sf}%
 \def\nextiv@{{\scriptfont0=\sevenrm % scriptfont changed to 7pt
  \global\advance\footmarkcount@\@ne
  \footmarkform@{\number\footmarkcount@}\@sf}}%
 \futurelet\next\next@}
\catcode`\@=\other

\def\instructions{%
 \getbstitlewidth
 \begingroup
 \def\doctype{INSTRUCTIONS TO COUNSEL} 
 \capacitytrue
 \bsparams
 \ifpleading
   \else\xcenterline{\underbar{DATED\hskip2in \number\year}}\vfil\fi
 \xcenterline{\vtop{\openup2\jot
     \halign{\hfil##\hfil\cr
 \title\crcr}}}
\vfil
   \headerfont
   \xcenterline{%
    \setbox0\hbox{\doctype}%
    \ifdim\wd0<\bstitlewidth\copy0
     \else\vtop{\hsize=\bstitlewidth\centertext{\doctype\strut}}%
     \fi}
  \rm
  \medskip
  \xcenterline{\formalcounselname}%
  \vfil\vfil
   \getaddress
   \halign{\def\temp{##}\xcenterline{\upperc{\temp}}\inform{::\temp::}\cr
  \sols\crcr}%
   \smallskip
   \xcenterline{\eightrm Solicitors' Reference: \sref}
   \xcenterline{{\eightrm Counsel's Reference: \col/\cref}}
 \supereject
 \endgroup}

\def\writecontents{\inform{Opening contents file: }%
 \immediate\openout\cont=\contentswritefile}

\def\minutes{%
  \spleading{MINUTES OF ORDER}
   {\scaps This Application}, \etc\par
   {\scaps And Upon Hearing}, \etc\par
   {\scaps And Upon Reading}, \etc\par}

\vbadness=5000 % No messages about underfull pages
\delimitershortfall=1pt
\delimiterfactor=999

% amend topofpleading to have 3 params, 3 being party.
\def\dovcert{\sdcert{M}}
\def\giftcert{\sdcert{L}}

\def\capacityfont{}
\def\capacity#1{\ifcapacity ({\capacityfont #1\/})\else\unskip\fi}

\def\beginparticulars{%
 \par
 \vskip\clskip
 \begingroup
  \clno=0
  \centerline{PARTICULARS}
  \par\nobreak}

\def\endparticulars{%
  \endgroup}

\def\writtext{%
 {\scaps To The \expandafter\uppercase{\dfdants}}%
 \unskip\space\getdefs\smallskip
 {\caps This Writ of Summons} has been issued against you by
 the \plaintfs\ \getpls\unskip\ in respect of the claim
 hereinafter set out. 
 \medskip
 Within 14 days after the service of this Writ on you,
 counting the day of service, you must either satisfy the
 claim or return to the Court Office mentioned below the
 accompanying {\scaps Acknowledgment of Service} stating
 therein whether you intend to contest these proceedings.
 \medskip
 If you fail to satisfy the claim or to return the
 Acknowledgment without stating therein an intention to
 contest the proceedings, the \plaintfs\ may proceed with the
 action and judgment may be entered against you forthwith
 without further notice.
 \medskip
 Issued from the \issuer\ of the High Court this \nodate
 \bigskip
 {\bf Note}---This Writ may not be served later than 4 calendar
 months beginning with that date unless renewed by order of
 the Court.
 \bigskip
 \centerline{\bf IMPORTANT}
 \nobreak\medskip
 Directions for Acknowledgement of Service are given with the
 accompanying form.\par
 \bigskip 
 %\vfil\penalty-5000\vfilneg
 \baselineskip=18pt
 \nobreak\smallskip\nobreak} % End of \writtext

% set up defaults
\bstitle{}
\solsref{}
\colsref{}           % Omit Counsel's initials
\timetaken{}         % hours
\casetype{}
\value{}             % omit pound sign
\difficulty{}        % out of 10
\proposedfee{}       % omit pound sign
\legalaidno{}
\comments{}

\def\Writissued{}
\maxpartywidth=4.5in % set \maxp@rtywidth. 
\def\amendnote{}
\def\amend{}
% Set up default in case no division is given.
\ch

\pleadingfalse % And reset this
\resetpleadingdefaults
\reset
\input rhlocal
\catcode`@=12
\normalnumbering
\twelvepoint

