% Save file as: ADD-WES.STY            Source: FILESERV@SHSU.BITNET  
% Posted by pauld@cs.washington.edu (Paul Barton-Davis) to comp.text.tex
% on 23 Aug 91 20:09:12 GMT
% Original text accompanying post follows \endinput at bottom of file
%%                      addison-wesley.sty
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%
%% A `book' style conforming (just!) to the Addison-Wesley house style
%% Paul Barton-Davis <pauld@cs.washington.edu> December 1988
%%
%% v1.05 nmm 29-jun-89 - include notes at head of index
%% v1.04 nmm 21-jun-89 - change 'part' handling
%% v1.03 pad 25-feb-89 - added `cexample' and `wexample' environments; fixed
%%			 error in `mycaption' which dropped figure
%%			 number when caption length > hsize.
%% v1.02 pad 15-feb-89 - added 'rhfig' to produce figures with captions
%%  			alongside instead of underneath, and 'mycaption' to
%%  			give nice captions.
%% v1.01 pad xx-jan-89 - change indents for display envts.
%%
%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%
%% Copyright (c):
%% 	Freely copy, modify and redistribute on condition that this
%% 	copyright notice remains on all such copied, modified or
%% 	distributed versions.
%%    
%%      Portions of this file derived from material written by
%%      Leslie Lamport.
%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%
%% NOTE:
%%
%% The author disclaims more or less all responsibility for the design
%% decisions implicitly represented in this file. This LaTeX
%% documentstyle was implememented to meet an external design
%% specification, and its existence neither condones or decries that
%% specification.
%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%
%% TO DO:
%% 
%% right floating figures (properly)
%% references
%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\typeout%
{Document Style `Addison-Wesley Book' v1.05 nmm 29-jun-89}

%% MATERIAL FROM BOOK.STY

\def\@ptsize{0} \@namedef{ds@11pt}{\def\@ptsize{1}}
\@namedef{ds@12pt}{\def\@ptsize{2}} 
\@twosidetrue \@mparswitchtrue \def\ds@draft{\overfullrule 5pt} 
\@options
\input bk1\@ptsize.sty\relax

\def\labelenumi{\arabic{enumi}.} 
\def\theenumi{\arabic{enumi}} 
\def\labelenumii{(\alph{enumii})}
\def\theenumii{\alph{enumii}}
\def\p@enumii{\theenumi}
\def\labelenumiii{\roman{enumiii}.}
\def\theenumiii{\roman{enumiii}}
\def\p@enumiii{\theenumi(\theenumii)}
\def\labelenumiv{\Alph{enumiv}.}
\def\theenumiv{\Alph{enumiv}} 
\def\p@enumiv{\p@enumiii\theenumiii}

\def\labelitemi{$\bullet$}
\def\labelitemii{\bf --}
\def\labelitemiii{$\ast$}
\def\labelitemiv{$\cdot$}

\def\verse{\let\\=\@centercr 
 \list{}{\itemsep\z@ \itemindent -1.5em\listparindent \itemindent 
 \rightmargin\leftmargin\advance\leftmargin 1.5em}\item[]}
\let\endverse\endlist
\def\quotation{\list{}{\listparindent 1.5em
 \itemindent\listparindent
 \rightmargin\leftmargin\parsep 0pt plus 1pt}\item[]}
\let\endquotation=\endlist
\def\quote{\list{}{\rightmargin\leftmargin}\item[]}
\let\endquote=\endlist

\def\descriptionlabel#1{\hspace\labelsep \bf #1}

\def\titlepage{\@restonecolfalse\if@twocolumn\@restonecoltrue\onecolumn
 \else \newpage \fi \thispagestyle{empty}\c@page\z@}
\def\endtitlepage{\if@restonecol\twocolumn \else \newpage \fi}

\arraycolsep 5pt \tabcolsep 6pt \arrayrulewidth .4pt \doublerulesep 2pt 
\tabbingsep \labelsep 
\skip\@mpfootins = \skip\footins
\fboxsep = 3pt \fboxrule = .4pt 

\newcounter{part}
\newcounter {chapter}
\newcounter {section}[chapter]
\newcounter {subsection}[section]
\newcounter {subsubsection}[subsection]
\newcounter {paragraph}[subsubsection]
\newcounter {subparagraph}[paragraph]

\def\thepart {\arabic{part}}
\def\thechapter {\arabic{chapter}}
\def\thesection {\thechapter.\arabic{section}}
\def\thesubsection {\thesection.\arabic{subsection}}
\def\thesubsubsection {\thesubsection .\arabic{subsubsection}}
\def\theparagraph {\thesubsubsection.\arabic{paragraph}}
\def\thesubparagraph {\theparagraph.\arabic{subparagraph}}
\def\@chapapp{Chapter}

\def\@pnumwidth{1.55em}
\def\@tocrmarg {2.55em}
\def\@dotsep{4.5}
\setcounter{tocdepth}{2}

\def\tableofcontents{\@restonecolfalse\if@twocolumn\@restonecoltrue\onecolumn
 \fi\chapter*{Contents\@mkboth{CONTENTS}{CONTENTS}}
 \@starttoc{toc}\if@restonecol\twocolumn\fi}
\def\l@part#1#2{\addpenalty{-\@highpenalty}
 \addvspace{2.25em plus 1pt} \begingroup
 \@tempdima 3em \parindent \z@ \rightskip \@pnumwidth \parfillskip
-\@pnumwidth 
 {\large \bf \leavevmode #1\hfil \hbox to\@pnumwidth{\hss #2}}\par
 \nobreak \endgroup}

\def\@dottedtocline#1#2#3#4#5{\ifnum #1>\c@tocdepth \else
%  \vskip \z@ plus .2pt
  {\hangindent #2\relax \rightskip \@tocrmarg \parfillskip -\rightskip
    \parindent #2\relax\@afterindenttrue
   \interlinepenalty\@M
   \leavevmode 
   \@tempdima #3\relax
    #4\nobreak\leaders\hbox{$\m@th \mkern \@dotsep mu.\mkern \@dotsep 
       mu$}\hfill \nobreak \hbox to\@pnumwidth{\hfil\rm #5}\vskip -\parskip
\par}\fi}

\def\l@chapter#1#2{\pagebreak[3] 
 \vskip 1.0em plus 1pt \@tempdima 1.5em \begingroup
 \parindent \z@ \rightskip \@pnumwidth 
 \parfillskip -\@pnumwidth 
 \bf \leavevmode #1\hfil \hbox to\@pnumwidth{\hss #2}\par
 \endgroup}
\def\l@section{\@dottedtocline{1}{1.5em}{2.3em}}
\def\l@subsection{\@dottedtocline{2}{3.8em}{3.2em}}
\def\l@subsubsection{\@dottedtocline{3}{7.0em}{4.1em}}
\def\l@paragraph{\@dottedtocline{4}{10em}{5em}}
\def\l@subparagraph{\@dottedtocline{5}{12em}{6em}}
\def\listoffigures{\@restonecolfalse\if@twocolumn\@restonecoltrue\onecolumn
 \fi\chapter*{List of Figures\@mkboth
 {LIST OF FIGURES}{LIST OF FIGURES}}\@starttoc{lof}\if@restonecol\twocolumn
 \fi}
\def\l@figure{\@dottedtocline{1}{1.5em}{2.3em}}
\def\listoftables{\@restonecolfalse\if@twocolumn\@restonecoltrue\onecolumn
 \fi\chapter*{List of Tables\@mkboth
 {LIST OF TABLES}{LIST OF TABLES}}\@starttoc{lot}\if@restonecol\twocolumn
 \fi}
\let\l@table\l@figure

\def\thebibliography#1{\chapter*{Bibliography\@mkboth
 {BIBLIOGRAPHY}{BIBLIOGRAPHY}}\list
 {[\arabic{enumi}]}{\settowidth\labelwidth{[#1]}\leftmargin\labelwidth
 \advance\leftmargin\labelsep
 \usecounter{enumi}}
 \def\newblock{\hskip .11em plus .33em minus -.07em}
 \sloppy\clubpenalty4000\widowpenalty4000
 \sfcode`\.=1000\relax}
\let\endthebibliography=\endlist
 
\newif\if@restonecol
\def\theindex{\@restonecoltrue\if@twocolumn\@restonecolfalse\fi
\columnseprule \z@
\chaptermark{Index}\columnsep 35pt\twocolumn[\@makeschapterhead{Index}In this index, page numbers are shown
in {\bf bold} type to indicate a major source of information about the item
being indexed.  Page numbers in {\it italics} indicate a definition.\vskip 1.5cm]
 \@mkboth{INDEX}{INDEX}\thispagestyle{plain}\parindent\z@
 \parskip\z@ plus .3pt\relax\let\item\@idxitem}
\def\@idxitem{\par\hangindent 40pt}
\def\subitem{\par\hangindent 40pt \hspace*{20pt}}
\def\subsubitem{\par\hangindent 40pt \hspace*{30pt}}
\def\endtheindex{\if@restonecol\onecolumn\else\clearpage\fi}
\def\indexspace{\par \vskip 10pt plus 5pt minus 3pt\relax}

\def\footnoterule{\kern-3\p@ 
 \hrule width .4\columnwidth 
 \kern 2.6\p@} 
\@addtoreset{footnote}{chapter} 
\long\def\@makefntext#1{\parindent 1em\noindent 
 \hbox to 1.8em{\hss$^{\@thefnmark}$}#1}

\setcounter{topnumber}{2}
\def\topfraction{.7}
\setcounter{bottomnumber}{1}
\def\bottomfraction{.3}
\setcounter{totalnumber}{3}
\def\textfraction{.2}
\def\floatpagefraction{.5}
\setcounter{dbltopnumber}{2}
\def\dbltopfraction{.7}
\def\dblfloatpagefraction{.5}

\long\def\@makecaption#1#2{
 \vskip 10pt 
 \setbox\@tempboxa\hbox{#1: #2}
 \ifdim \wd\@tempboxa >\hsize #1: #2\par \else \hbox
to\hsize{\hfil\box\@tempboxa\hfil} 
 \fi}

\newcounter{figure}[chapter]
\def\thefigure{\thechapter.\@arabic\c@figure}
\def\fps@figure{tbp}
\def\ftype@figure{1}
\def\ext@figure{lof}
\def\fnum@figure{Figure \thefigure}
\def\figure{\@float{figure}}
\let\endfigure\end@float
\@namedef{figure*}{\@dblfloat{figure}}
\@namedef{endfigure*}{\end@dblfloat}
\newcounter{table}[chapter]
\def\thetable{\thechapter.\@arabic\c@table}
\def\fps@table{tbp}
\def\ftype@table{2}
\def\ext@table{lot}
\def\fnum@table{Table \thetable}
\def\table{\@float{table}}
\let\endtable\end@float
\@namedef{table*}{\@dblfloat{table}}
\@namedef{endtable*}{\end@dblfloat}

\def\maketitle{\begin{titlepage}
 \let\footnotesize\small 
 \let\footnoterule\relax 
 \setcounter{page}{0}
 \null
 \vfil
 \vskip 60pt 
 {\Huge\sf \@title} \vskip 36pt
 {\large \@author}
 \vfil
 \end{titlepage}
 \setcounter{footnote}{0}
 \let\maketitle\relax}

\mark{{}{}} 

\def\today{\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
 \space\number\day, \number\year}

\@addtoreset{equation}{chapter} 
\def\theequation{\thechapter.\arabic{equation}}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%                            FONTS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% Use PostScript fonts (Times as default)
%% For newer LaTeX's, you can simply insert a new version of
%% the font definitions here.

\input{psdef.sty}
\input{times.sty}

%% redefine \LARGE to be 24pt (more in line with A-W's font sizes)

\def\LARGE{\@setsize\LARGE{24pt}\xxpt\@xxpt}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%                        PAGE DIMENSIONS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\textwidth 15truecm
\textheight 22.5truecm
\baselineskip 14truept
\oddsidemargin 1cm
\evensidemargin 1cm
\topmargin 0cm

%% skip sizes

\parskip 5pt plus 1pt minus 0.5pt

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%                    RUNNING HEADERS & FOOTERS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\def\headerfont{\normalsize\it}
\newdimen\headerspacer
\headerspacer 1truecm

\def\ps@headings
    {
    \let\@mkboth=\@gobbletwo
    \def\@oddhead{\hbox to \textwidth
		{\hfil {\headerfont \@chaptername%
			\hskip \headerspacer \thepage}}}
    \def\@oddfoot{\relax}

    \if@twoside
	\def\@evenhead{\hbox to \textwidth
		{{\headerfont \thepage%
			 \hskip \headerspacer  \the@title} \hfil}}
	\def\@evenfoot{\relax}
    \else
	\def\@evenhead{\relax}
	\def\@evenfoot{\relax}
    \fi
    }

%% Addison-Wesley `plain' headings (for chapter pages - just put the
%% page number in the bottom right corner)

\def\ps@plain
    {
   \let\@mkboth=\@gobbletwo
    \def\@oddhead{\relax}
    \def\@oddfoot{\hbox to \textwidth {\hfil \headerfont \thepage}}

    \if@twoside
	\def\@evenhead{\relax}
	\def\@evenfoot{\hbox to \textwidth {\headerfont \thepage \hfil}}
    \else
	\def\@evenhead{\relax}
	\def\@evenfoot{\hbox to \textwidth {\headerfont \thepage \hfil}}
    \fi
    }

\def\the@title{\@title}
\def\@title{} 		%% This is reset by a \title command in the text
\def\@chaptername{}	%% This is reset by a \chapter command in the text

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%                           ENVIRONMENTS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%
%% new environments, or new definitions of old ones
%%
%% - example       : for displaying computer interaction
%% - wexample      : as above, but full width
%% - cexample      : as above, but centered
%% - pseudocode    : for displaying pseudo-code
%% - outputstuff   : for displaying computer output
%% - description   : like description, but with equal left & right indents
%% - itemize       : as above, for itemized lists
%% - enumerate     : as above, for enumerated lists
%% - preface       : for prefaces
%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%
%% EXAMPLE environment
%%

\def\examplefont{\tb}      %% font (& style) used for all example environments
\newdimen\exampletopsep	   %% white space to leave above an example
\exampletopsep\parskip

\def\example{\list{}{%
\topsep\exampletopsep
\rightmargin\leftmargin
\examplefont}
\item[]}

\let\endexample\endlist

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%
%% FULL WIDTH EXAMPLE ENVIRONMENT
%%

\def\wexample{\list{}{%
\topsep\exampletopsep
\leftmargin 0pt
\rightmargin \leftmargin
\examplefont}
\item[]}

\let\endwexample\endlist

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%
%% CENTERED EXAMPLE ENVIRONMENT
%%

\def\cexample{%
\begin{center}
\examplefont}

\def\endcexample{\end{center}}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%
%% PSEUDO-PSUEDOCODE ENVIRONMENT
%%
%% usage:

%% \begin{pseudocode}
%%     if (test clause) \\
%%	\> action statement \\
%%     else \\
%%	\> alternative \\
%%     endif
%% \end{pseudocode}

%% extra levels of indentation can be achieved with additional \>'s.

\def\pseudocode{\list{}{%
\topsep \exampletopsep
\rightmargin \leftmargin
\examplefont}
\item[]
\begin{tabbing}
\hskip 1cm \= \hskip 1cm \= \hskip 1cm \= \hskip 1cm \= \hskip 1cm \= \kill}

\def\endpseudocode{\endtabbing\endlist}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%
%% OUTPUTSTUFF ENVIRONMENT 
%%
%% for displaying the output from computer interaction

\def\outputfont{\op}		%% font to use for outputstuff
\newdimen\outputstufftopsep	%% space to leave above outputstuff
\outputstufftopsep\parskip

\def\outputstuff{\list{}{%
\rightmargin \leftmargin
\topsep\outputstufftopsep
\outputfont}
\item[]}

\let\endoutputstuff\endlist


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%
%% DESCRIPTION ENVIRONMENT
%%
%% redefine the `description' environment
%% to give equal right and left margins,
%% and parametize its topsep

\newdimen\lrdesctopsep		%% space to leave above a description
\lrdesctopsep\parskip

\def\description{\list{}{%
\topsep\lrdesctopsep
\rightmargin\leftmargin
\itemindent -\leftmargin
\divide\itemindent by 2
\labelwidth\z@
\let\makelabel\descriptionlabel
}}

\let\enddescription\endlist

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%
%% ITEMIZED LIST ENVIRONMENT
%%

\def\itemize{%
\ifnum \@itemdepth >3%
	\@toodeep%
\else%
	\advance\@itemdepth \@ne%
	\edef\@itemitem{labelitem\romannumeral\the\@itemdepth}%
	\list{\csname\@itemitem\endcsname}%
	{\def\makelabel##1{\hss\llap{##1}}%
	\rightmargin\leftmargin}%
\fi}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%
%% ENUMERATED LIST ENVIRONMENT
%%

\def\enumerate{%
\ifnum \@enumdepth >3%
	\@toodeep%
\else
	\advance\@enumdepth \@ne%
	\edef\@enumctr{enum\romannumeral\the\@enumdepth}%
	\list{\csname label\@enumctr\endcsname}%
	{\usecounter{\@enumctr}%
	\def\makelabel##1{\hss\llap{##1}}%
	\rightmargin\leftmargin}%
\fi}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%
%% PREFACE ENVIRONMENT
%%
%% basically just uses roman page numbering, with a plain
%% pagestyle, and ships out the page(s) when done.
%% 
%% NB. should really save current pagenumbering and style,
%%     rather than just switching back to arabic/headings
%%     when done

\def\preface{%
\clearpage
\pagenumbering{roman}
\vbox to \chapterboxsize {%
	\noindent
	{\LARGE\hb  Preface}
	\vfill}
\pagestyle{plain}
\noindent

}

\def\endpreface{%
\clearpage
\pagenumbering{arabic}
\pagestyle{headings}
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%                             SECTIONING
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% Boiler plate material for sectioning, parametizing all
%% spacing, style and font information for users who want
%% to modify these on the fly (not that they're encouraged to).

\newdimen\abovesectionskip
\newdimen\belowsectionskip
\newdimen\abovesubsectionskip
\newdimen\belowsubsectionskip
\newdimen\abovesubsubsectionskip
\newdimen\belowsubsubsectionskip
\newdimen\baselineskiptwice 

\baselineskiptwice=\baselineskip
\multiply\baselineskiptwice by 2

\abovesectionskip=-\baselineskiptwice
\belowsectionskip=\baselineskip

\abovesubsectionskip=-\baselineskip
\belowsubsectionskip=6pt

\abovesubsubsectionskip=-\baselineskip
\belowsubsubsectionskip=4truept

\def\sectionfont{\large\hb}
\def\subsectionfont{\normalsize\hb}
\def\subsubsectionfont{\normalsize\ho}

%% prevent subsubsections and below being numbered

\setcounter{secnumdepth}{2}

%% now define the sectioning commands

%% PART is an exception, in that it doesn't use
%% \@startsection, but instead just throws out a recto
%% page with a Part number and associated rubbish with it.

\def\part#1{%
\cleardoublepage
\thispagestyle{empty}
\refstepcounter{part}
\vbox to \vsize{%
	\vskip 60pt
	\hbox to \textwidth{\hfil\Huge\hb Part \thepart \hfil}
	\vskip 2cm
	\begin{center}
	{\LARGE\hb #1}
	\end{center}
	\vfill}
\newpage
}

\def\section%%
{\@startsection{section}{1}%
	{\z@}{\abovesectionskip}{\belowsectionskip}%
	{\sectionfont}}

\def\subsection%%
{\@startsection{subsection}{2}%
	{\z@}{\abovesubsectionskip}{\belowsubsectionskip}%
	{\subsectionfont}}

\def\subsubsection%%
{\@startsection{subsubsection}{3}%
	{\z@}{\abovesubsubsectionskip}{\belowsubsubsectionskip}%
	{\subsubsectionfont}}

%% \chapter - redefine to ensure chapters begin on a recto
%% 	page; use `awplain' for chapter pages; define the@chapter as the
%% 	chapter

\def\cleartoversopage{\clearpage \ifodd\c@page \hbox{} \newpage\fi}

\def\chapter{%%
	\cleardoublepage%%	
	\thispagestyle{plain}%%
	\global\@topnum\z@
	\@afterindentfalse%% 
	\secdef\@chapter%%
	\@schapter}

\def\chaptermark#1{\gdef\@chaptername{#1}}
	
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%                        CAPTIONS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% \mycaption{figure number}{subnumber}{caption}
%%
%% Mysteriously, this macro seems to use absolute figure numbers
%% rather than relying on LaTeX to figure it out. Now, in 1991, I
%% don't know why this is. It was probably part of the general
%% book production scheme, which need to refer to figures by
%% and not by number; I just don't know. It does, however, allow
%% subnumbers (like 1.a, 1.b and 1.c).

\def\mycaption#1#2#3{%
	\setcounter{\@captype}{#1}
	\addcontentsline{\csname
	  ext@\@captype\endcsname}{\@captype}{\protect\numberline{\csname 
	  the\@captype\endcsname}{\ignorespaces #3}}
	\par
	\begingroup
	\@parboxrestore
	\vskip 10pt
	\setbox\@tempboxa\hbox{{\bf Figure \csname the\@captype\endcsname#2}
				 #3}
	\ifdim \wd\@tempboxa > \hsize 
		\setbox\@tempboxa\hbox{%
			\bf Figure \csname the\@captype\endcsname#2\ }%
		\@tempdima \textwidth
		\advance\@tempdima by -\wd\@tempboxa
		\hbox{%
		\box\@tempboxa	
		\vtop{\hsize \@tempdima #3}}
	\else 
		\par \hbox to \hsize{%
			\hfil\box\@tempboxa\hfil}
	\fi
	\endgroup}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%                 RIGHT-HAND INDENTED FIGURES
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\newdimen\@txtwd
\newdimen\@figwd
\newdimen\rhfigindent
\rhfigindent 1cm

%% \rhfig{HEIGHT}{WIDTH}{FIGURE NUMBER}{SUBNUMBER}{CAPTION}

\def\rhfig#1#2#3#4#5{%
	\begin{figure}[htb]
%%
%% set up the figure counter and add stuff to the aux file
%%
	\setcounter{\@captype}{#3}
	\addcontentsline{\csname
	  ext@\@captype\endcsname}{\@captype}{\protect\numberline{\csname 
	  the\@captype\endcsname}{\ignorespaces #5}}
%%
%% now adjust \@txtwd to give the width of the caption
%%
	\@txtwd \textwidth
	\@figwd #2
	\advance \@txtwd by -\@figwd
	\advance \@txtwd by -\rhfigindent
	\setbox\@tempboxa\hbox{\bf Figure \csname the\@captype\endcsname#4\ }
	\advance \@txtwd by -\wd\@tempboxa
%%
%% now set up a pair of hboxed vboxes with the caption in the right hand
%% one and the figure (space) in the left.
%%
	\hbox to \textwidth{%
		\hbox{\hskip \rhfigindent%
		\vtop to #1{\vfill
				\hbox{%
				\box\@tempboxa
				\vtop{\hsize\@txtwd #5}}
		 	    \vfill}}
		\hfill
		\hbox to \@figwd{
			\vtop{\vskip #1}}}
	\end{figure}}

\newdimen\@figwd
\newdimen\@txtwd
\newdimen\@blah

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%                    CHAPTER HEADINGS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\newdimen\chapterboxsize
\newdimen\chapternumberwidth
\newdimen\chaptertitlewidth

%% set total depth of chapter heading to be 14 lines

\chapterboxsize \baselineskip \multiply\chapterboxsize by 14

\chapternumberwidth 4cm %% width for "Chapter <number>"
\chaptertitlewidth \textwidth 
\advance \chaptertitlewidth by -\chapternumberwidth

\def\chapterheadfont{\LARGE\hb}%
\def\chapternumfont{\LARGE\ho}%

\def\@makechapterhead#1{%
	\vbox to \chapterboxsize {%
		\parindent=0pt%
		\hbox to \textwidth{%
			\vtop{\hsize \chapternumberwidth \chapternumfont
				 \@chapapp{} \thechapter}
			\hss
			\vtop{\baselineskip=26pt \hsize \chaptertitlewidth 
				\chapterheadfont \raggedright #1}}
		\vfill}}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% 		BOXES (for buttons and such things)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%
%% First a useful construct for putting `struts' into hboxes
%% to fix their height properly for boxing up.
%%

\newbox\@adbox%% box with ascenders and descenders present.
\def\@adstrut{%
\setbox\@adbox\hbox{bp}%% do this here to make sure we get the current font
\vrule height \ht\@adbox width 0pt depth \dp\@adbox}

%% \fbox - a new version with better spacing than lamport's
%%
%% We just set up two boxes - one the same as the argument,
%% and the other with its height adjusted to include ascenders and
%% descenders. It is this box that is used to set the dimensions
%% of the frame around the first (I hope).

\long\def\fbox#1{\leavevmode\setbox\@tempboxa\hbox{#1\@adstrut}
    \@tempdima 0pt \advance\@tempdima \fboxsep 
    \advance\@tempdima \dp\@tempboxa
   \hbox{\lower \@tempdima\hbox
  {\vbox{\hrule \@height \fboxrule
          \hbox{\vrule \@width \fboxrule \hskip\fboxsep
	    \vbox{\vskip\fboxsep \box\@tempboxa\vskip\fboxsep}\hskip 
			 \fboxsep\vrule \@width \fboxrule}
		   \hrule \@height \fboxrule}}}}

%% STUFF TO START WITH

\ps@headings 
\pagenumbering{arabic} 
\onecolumn 

\endinput

From: pauld@cs.washington.edu (Paul Barton-Davis)
Newsgroups: comp.text.tex
Subject: Addison-Wesley.sty (documentstyle provided)
Message-ID: <1991Aug23.200912.1556@beaver.cs.washington.edu>
Date: 23 Aug 91 20:09:12 GMT
Sender: news@beaver.cs.washington.edu (USENET News System)
Organization: Computer Science & Engineering, U. of Washington, Seattle
Lines: 790
Originator: pauld@stowe.cs.washington.edu

Below is a documentstyle I wrote for a book called "The X Window
System - A User's Guide" by Niall Mansfield, published in 1989 by
Addison-Wesley. As such, it is a style that closely (but not exactly)
matches A-W's house style for computer-related texts. This is the very
same file used to format the book, and it was written for this purpose
only. I have just gone through and added a few comments here and there
to help anyone else who might want to use it. I haven't used it in a
long time, and neither has Niall: we're both at work on a new style
called "STOP", based on the Hughes "STOP" format for user
documentation. I hope to be posting that within a month or so, but I
might wait until the new book that uses it is with A-W. If you have
problems with it, please send me mail. Note that it currently inputs
two files that set up PostScript Times Roman as the default font
family. These are not included, since I have posted them before.

Please remember that I know LaTeX a little better now than back then
(and still not well enough to hack floating indented figures). There
are several things in the style that I would change if I wrote it
again; I merely thought that some folks might like a chance to use a
"real book" documentstyle.

-- enjoy
    paul
-- 
