% my add-on LaTeX macros
% to be used like in:
% \documentstyle[12pt,gwm]{report}

% postscript inclusion:
\def\texpsfig#1#2#3
{\vbox{\kern #3pt\hbox{\special{psfile=#1}\kern #2pt}}\typeout{(#1)}}

% RCS version stripping
\def\RCSRevNum#1Revision: #2 ${#2}
\def\RCSRevVersion#1Version: #2 ${#2}

\newlength{\colaslength}
\newlength{\colaslengthh}
\newlength{\colasmargin}

\def\exemplefont{\footnotesize}
\def\usagefont{\large}
\def\usageupspace{\vspace{0.1mm}}
\newcommand{\Description}
	{\list{}{\leftmargin 4cm \labelsep 0.1cm \labelwidth 3.9cm}}

\def\descriptionlabel#1{\bf #1\hspace\labelsep\hfil}
\def\description
	{\list{}{\leftmargin 2.4cm \labelsep 0.1cm \labelwidth 2.3cm
	\let\makelabel\descriptionlabel}}

\def\upspace{\vspace{-2mm}}
\def\undertablespace{\vspace{-3mm}}

\def\Item#1#2{\upspace\pagebreak[1]\section*{\hspace{-7pt}
	{\large\tt#1}{\normalsize\sf\quad ---\quad #2}}\vspace{-0.3cm}}

\def\ITEMa#1#2{
 \Item{#1}{#2}\markright{#1}
 \label{#1}}
\def\ITEMb#1#2#3{
 \Item{\vbox{\hbox{#1}\hbox{#2}}}{#3}\markright{#1}
 \label{#1} \label{#2}}
\def\ITEMbi#1#2#3{
 \Item{\vbox{\hbox{#1}\hbox{#2}}}{#3}\markright{#1}
 \label{#2}}
\def\ITEMc#1#2#3#4{
 \Item{\vbox{\hbox{#1}\hbox{#2}\hbox{#3}}}{#4}\markright{#1}
 \label{#1}\label{#2} \label{#3}}
\def\ITEMci#1#2#3#4{
 \Item{\vbox{\hbox{#1}\hbox{#2}\hbox{#3}}}{#4}\markright{#1}
 \label{#2}\label{#3}}
\def\ITEMd#1#2#3#4#5{
 \Item{\vbox{\hbox{#1}\hbox{#2}\hbox{#3}\hbox{#4}}}{#5}\markright{#1}
 \label{#1}\label{#2}\label{#3}\label{#4}}
\def\ITEMe#1#2#3#4#5#6{
 \Item{
  \vbox{\hbox{#1}\hbox{#2}\hbox{#3}\hbox{#4}\hbox{#5}}}{#6}\markright{#1}
 \label{#1}\label{#2}\label{#3}\label{#4}\label{#5}}
\def\ITEMf#1#2#3#4#5#6#7{
 \Item{
    \vbox{\hbox{#1}\hbox{#2}\hbox{#3}\hbox{#4}\hbox{#5}\hbox{#6}}}{#7}
	\markright{#1}
 \label{#1}\label{#2}\label{#3}\label{#4}\label{#5}\label{#6}}

\newcommand{\context}[1]{
  Context used:
    \begin{center}\begin{tabular}{@{\tt}l@{\hspace{1cm}}@{\rm}p{7cm}}
    \multicolumn{1}{c}{\bf Variable}&\multicolumn{1}{c}{\bf used for}\\ 
    \hline \multicolumn{2}{l}{\undertablespace}\\
    #1
    \end{tabular}\end{center}}

\newcommand{\contextdim}[2]{
  \setlength{\colaslength}{7cm}
  \addtolength{\colaslength}{#1}
  Context used:
    \begin{center}\begin{tabular}{@{\tt}l@{\hspace{1cm}}@{\rm}p{\colaslength}}
    \multicolumn{1}{c}{\bf Variable}&\multicolumn{1}{c}{\bf used for}\\ 
    \hline  \multicolumn{2}{l}{\undertablespace}\\
    #2
    \end{tabular}\end{center}}

\newcommand{\desctable}[3]{
    \begin{center}\begin{tabular}{@{\bf}l@{\hspace{1cm}}@{\rm}p{7cm}}
    \multicolumn{1}{c}{\bf #1}&\multicolumn{1}{c}{\bf #2}\\ 
    \hline \multicolumn{2}{l}{\undertablespace}\\
    #3
    \end{tabular}\end{center}}

\newcommand{\desctabledim}[4]{
  \setlength{\colaslength}{7cm}
  \addtolength{\colaslength}{#1}
    \begin{center}\begin{tabular}{@{\bf}l@{\hspace{1cm}}@{\rm}p{\colaslength}}
    \multicolumn{1}{c}{\bf #2}&\multicolumn{1}{c}{\bf #3}\\ 
    \hline  \multicolumn{2}{l}{\undertablespace}\\
    #4
    \end{tabular}\end{center}}

\newcommand{\exemples}[2]{
  #1{\exemplefont 
    \begin{center}\begin{tabular}{@{\tt}l@{\hspace{1cm}}@{\rm}p{5cm}}
    #2
    \end{tabular}\end{center}}}

\newcommand{\exemplesdim}[3]{
  \setlength{\colaslength}{5cm}
  \addtolength{\colaslength}{#1}
  #2{\exemplefont 
    \begin{center}\begin{tabular}{@{\tt}l@{\hspace{1cm}}@{\rm}p{\colaslength}}
    #3
    \end{tabular}\end{center}}}

\newcommand{\usagetype}[1]{{\sl #1}\vspace{0.2cm}}
\newcommand{\usagetyped}[2]{{\sl #1}\quad{\it (#2)}\vspace{0.2cm}}
\newcommand{\see}[1]{{\tt #1}}
\newcommand{\seep}[1]{{\tt #1}, p~\pageref{#1}}
\newcommand{\seensp}[1]{{\tt #1} (see p~\pageref{#1})}
\newcommand{\seesnp}[1]{(see {\tt #1}, p~\pageref{#1})}
\newcommand{\seeref}[1]{{\tt #1} (see \ref{#1}, p~\pageref{#1})}
\newcommand{\seesp}[1]{(see \ref{#1}, p~\pageref{#1})}

\def\smalldesc#1#2#3{#1&#3&#2\\}
\newcommand{\bigdesc}[2]{
  \setlength{\colaslength}{300pt}
  \settowidth{\colaslengthh}{{\tt #1}}
  \addtolength{\colaslength}{-\colaslengthh}
    \begin{center}\begin{tabular}
	{@{\tt}l@{\hspace{0.5cm}}@{\sf}p{\colaslength}@{\hspace{0.4cm}}@{\bf}r}
   \multicolumn{1}{c}{\bf Object}&\multicolumn{1}{c}{\bf Description}&{\bf p}\\
    \hline \multicolumn{3}{l}{\undertablespace}\\
    #2
    \end{tabular}\end{center}}

\newcommand{\desc}[4]{
  \setlength{\colaslength}{250pt}
  \settowidth{\colaslengthh}{{\tt #1}}
  \addtolength{\colaslength}{-\colaslengthh}
    \begin{center}\begin{tabular}
{@{\tt}l@{\hspace{0.5cm}}@{\sf}p{\colaslength}}
    \multicolumn{1}{c}{\bf #2}&\multicolumn{1}{c}{\bf #3}\\
    \hline \multicolumn{2}{l}{\undertablespace}\\
    #4
    \end{tabular}\end{center}}

\newcommand{\contextdimtt}[2]{
  \setlength{\colaslength}{250pt}
  \settowidth{\colaslengthh}{{\tt #1}}
  \addtolength{\colaslength}{-\colaslengthh}
  Context used:
    \begin{center}\begin{tabular}{@{\tt}l@{\hspace{1cm}}@{\rm}p{\colaslength}}
    \multicolumn{1}{c}{\bf Variable}&\multicolumn{1}{c}{\bf used for}\\ 
    \hline \multicolumn{2}{l}{\undertablespace}\\
    #2
    \end{tabular}\end{center}}

\def\itemtt#1{\item[{\tt #1}]}
\def\itemit#1{\item[{\it #1}]}


% SIZE of page
%=============

\def\fullpage{\if@twoside \oddsidemargin 35pt \evensidemargin -8pt 
\marginparsep 10pt \marginparpush 10pt \marginparwidth 10pt
\else \oddsidemargin 0pt \evensidemargin 0pt 
\marginparwidth 30pt\fi
\textwidth 450pt \setlength{\colasmargin}{0pt}
\def\colaspm{\hspace{0pt}}\def\colasmm{\hspace{0pt}}
\def\colassmm{\hspace{0pt}}\def\colastitledisp{\hspace{0pt}}
}
\def\mediumpage{\if@twoside \oddsidemargin 75pt \evensidemargin 32pt 
\marginparsep 10pt \marginparpush 10pt \marginparwidth 40pt
\else \oddsidemargin 43pt \evensidemargin 63pt 
\marginparwidth 30pt\fi
\textwidth 410pt \setlength{\colasmargin}{0pt}
\def\colaspm{\hspace{40pt}}\def\colasmm{\hspace{-40pt}}
\def\colassmm{\hspace{-20pt}}\def\colastitledisp{\hspace{-45pt}}
}
\def\smallpage{\if@twoside \oddsidemargin 135pt \evensidemargin 92pt 
\marginparsep 10pt \marginparpush 10pt \marginparwidth 80pt
\else \oddsidemargin 123pt \evensidemargin 123pt
\marginparwidth 30pt \fi
\textwidth 350pt 
\setlength{\colasmargin}{100pt}
\def\colaspm{\hspace{100pt}}\def\colasmm{\hspace{-100pt}}
\def\colassmm{\hspace{-60pt}}\def\colastitledisp{\hspace{-75pt}}
}

\smallpage
\topmargin -30pt \headheight 12pt \headsep 25pt \footheight 12pt \footskip
30pt 
\textheight 680pt \columnsep 10pt \columnseprule 0pt 
\footnotesep 12pt \skip\footins 6pt plus 2pt minus 2pt 
\floatsep 12pt plus 2pt minus 2pt \textfloatsep 20pt plus 2pt minus 4pt
\intextsep 12pt plus 2pt minus 2pt \@maxsep 20pt \dblfloatsep 12pt plus 2pt
minus 2pt \dbltextfloatsep 20pt plus 2pt minus 4pt \@dblmaxsep 20pt 
\@fptop 0pt plus 1fil \@fpsep 8pt plus 2fil \@fpbot 0pt plus 1fil 
\@dblfptop 0pt plus 1fil \@dblfpsep 8pt plus 2fil \@dblfpbot 0pt plus 1fil

\parskip 5pt plus 1pt \parindent 0pt \topsep 2pt plus 1pt minus 1pt
\partopsep 0pt plus 1pt minus 1pt \itemsep 2pt plus 1pt minus 1pt 

\reversemarginpar
\@mparswitchfalse

%% abbrevs

\def\GWM{\sc Gwm}
\def\WOOL{\sc Wool}

%% fonts
\def\Huge{\@setsize\Huge{30pt}\xxvpt\@xxvpt}

%% chapter

\def\@makechapterhead#1{ \vspace*{1pt} { \parindent 0pt \raggedright 
 \Huge\bf \colasmm
 \ifnum \c@secnumdepth >\m@ne \thechapter \quad \fi
 #1\par 
 \nobreak \vskip 20pt
 \colasmm{\vbox{\hbox{\vrule height 5pt width450pt depth -3pt}
 			\vspace*{-1.1cm}
 		       \hbox{\vrule height 0.0pt width450pt depth 0.4pt}}}
 \nobreak \vskip 50pt \nobreak } }

\def\@makeschapterhead#1{ \vspace*{1pt} { \parindent 0pt \raggedright 
 \Huge \bf \colasmm #1\par 
 \nobreak \vskip 80pt } }

\def\chapter{\clearpage \thispagestyle{pagenum} \global\@topnum\z@
\@afterindentfalse \secdef\@chapter\@schapter} 
\def\@chapter[#1]#2{\ifnum \c@secnumdepth >\m@ne
 \refstepcounter{chapter}
 \typeout{\@chapapp\space\thechapter.}
 \addcontentsline{toc}{chapter}{\protect
 \numberline{\thechapter}#1}\else
 \addcontentsline{toc}{chapter}{#1}\fi
 \chaptermark{#1}
 \addtocontents{lof}{\protect\addvspace{10pt}}
\addtocontents{lot}{\protect\addvspace{10pt}} \if@twocolumn
\@topnewpage[\@makechapterhead{#2}] 
 \else \@makechapterhead{#2}
 \@afterheading \fi} 
\def\@schapter#1{\if@twocolumn \@topnewpage[\@makeschapterhead{#1}]
 \else \@makeschapterhead{#1} 
 \@afterheading\fi}

%% sections

\def\section{\@startsection {section}{1}{\z@}{-3.5ex plus -1ex minus 
 -.2ex}{2.3ex plus .2ex}{\Large\bf\colasmm}}
\def\subsection{\@startsection{subsection}{2}{\z@}{-3.25ex plus -1ex minus 
 -.2ex}{1.5ex plus .2ex}{\large\bf\colassmm}}
\def\subsubsection{\@startsection{subsubsection}{3}{\z@}{-3.25ex plus
-1ex minus -.2ex}{1.5ex plus .2ex}{\normalsize\bf}}
\def\paragraph{\@startsection
 {paragraph}{4}{\z@}{3.25ex plus 1ex minus .2ex}{-1em}{\normalsize\bf}}
\def\subparagraph{\@startsection
 {subparagraph}{4}{\parindent}{3.25ex plus 1ex minus 
 .2ex}{-1em}{\normalsize\bf}}

%% headings

\if@twoside \def\ps@headings{\def\@oddfoot{}
\def\@evenfoot{}\def\@evenhead{
\colasmm\makebox[0pt][l]{\vrule height-4pt width450pt depth4.3pt}
\bf\thepage\hfill \sl \leftmark}
\def\@oddhead{
\colasmm\makebox[0pt][l]{\vrule height-4pt width450pt depth4.3pt}
\sl \rightmark \hfill\bf\thepage}
\def\chaptermark##1{\markboth {\uppercase{\ifnum \c@secnumdepth
>\m@ne
 \@chapapp\ \thechapter. \ \fi ##1}}{}}\def\sectionmark##1{\markright
{\uppercase{\ifnum \c@secnumdepth >\z@
 \thesection. \ \fi ##1}}}}
\else \def\ps@headings{\def\@oddfoot{}\def\@evenfoot{}\def\@oddhead{\hbox
{}\sl \rightmark \hfill \rm\thepage}\def\chaptermark##1{\markright
{\uppercase{\ifnum \c@secnumdepth >\m@ne
 \@chapapp\ \thechapter. \ \fi ##1}}}}
\fi

\if@twoside \def\ps@pagenum{\def\@oddfoot{}
\def\@evenfoot{}\def\@evenhead{
\colasmm\bf\thepage\hfill}
\def\@oddhead{
\colasmm\hfill\bf\thepage}
\def\chaptermark##1{\markboth {\uppercase{\ifnum \c@secnumdepth
>\m@ne
 \@chapapp\ \thechapter. \ \fi ##1}}{}}\def\sectionmark##1{\markright
{\uppercase{\ifnum \c@secnumdepth >\z@
 \thesection. \ \fi ##1}}}}
\else \def\ps@pagenum{\def\@oddfoot{}\def\@evenfoot{}\def\@oddhead{\hbox
{}\hfil \bf\thepage}\def\chaptermark##1{\markright
{\uppercase{\ifnum \c@secnumdepth >\m@ne
 \@chapapp\ \thechapter. \ \fi ##1}}}}
\fi

