%%
%%    File : csfax.cls    (LaTeX2e class file)
%%  Author : Martin Reddy (mxr@dcs.ed.ac.uk) 
%% Version : 1.3
%% Updates : 1.0 [3/6/96] - initial release.
%%           1.1 [27/8/96] - updated for OzTeX
%%           1.2 [28/1/97] - corrected \parskip for \FaxMessage
%%           1.3 [6/2/97] - \FaxIntCode, \FaxShowFromFax, \faxbf/it default
%%
%% This file contains a class definition, csfax, for the LaTeX2e
%% system which defines the layout of a facsimile transmission sheet
%% used by the Dept of Computer Science at the University of Edinburgh.
%%
%% For information on this package, please refer to "texdoc csfax"
%%
%% To Do List:
%%    . font problems with cm option. option currently not documented
%%

\NeedsTeXFormat{LaTeX2e}[1994/12/01]
\ProvidesClass{csfax}[1996/02/06 v1.3 Computer Science FAX sheet - MXR]

%%
%%  --- Options ---
%%

\DeclareOption{times}{\def\fax@fontfamily{ptm}} %% font family used for 
\DeclareOption{cm}{\def\fax@fontfamily{cmr}}    %% titles
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{article}}

\ExecuteOptions{times}
\ProcessOptions

\LoadClass[a4paper]{article}

%%
%% --- Package Loading ---
%%

\RequirePackage{graphics}
\RequirePackage{array}

%%
%% --- Main Code ---
%%

%%
%% Set up the fax page margins
%%

\addtolength{\voffset}{-2.5cm}
\addtolength{\textheight}{5cm}

\addtolength{\hoffset}{-2cm}
\addtolength{\textwidth}{4cm}

%% 
%% Set up the fonts (so that the text doesn't change if the
%% document itself is 10pt, 11pt or 12pt).
%%

\def\fax@perpetuafontfamily{mpp}

\DeclareFixedFont{\fax@AddressFont}%
  {\encodingdefault}{\fax@perpetuafontfamily}{m}{n}{12pt}

\DeclareFixedFont{\fax@AddressSmallFont}%
  {\encodingdefault}{\fax@perpetuafontfamily}{m}{n}{10pt}

\DeclareFixedFont{\fax@AddressItalicFont}%
  {\encodingdefault}{\fax@perpetuafontfamily}{m}{it}{12pt}

\DeclareFixedFont{\fax@MainTextFont}%
  {\encodingdefault}{\fax@fontfamily}{m}{n}{12pt}

\DeclareFixedFont{\fax@MainItalicsFont}%
  {\encodingdefault}{\fax@fontfamily}{m}{it}{12pt}

\DeclareFixedFont{\fax@MainBoldFont}%
  {\encodingdefault}{\fax@fontfamily}{b}{n}{12pt}

\DeclareFixedFont{\fax@DescFont}%
  {\encodingdefault}{\fax@fontfamily}{m}{it}{12pt}

\DeclareFixedFont{\fax@TitleFont}%
  {\encodingdefault}{\fax@fontfamily}{b}{n}{16pt}

\DeclareFixedFont{\fax@SectionFont}%
  {\encodingdefault}{\fax@fontfamily}{b}{n}{12pt}

%% change the default bold and italics commands accordingly

\newcommand{\faxit}{\fax@MainItalicsFont}
\newcommand{\faxbf}{\fax@MainBoldFont}

\let\em\faxit
\let\it\faxit
\let\bf\faxbf
\let\bfseries\faxbf

%%
%% Now do the reading in of information
%%

\newcommand{\@faxfromname}{}
\newcommand{\@faxfromemail}{}
\newcommand{\@faxfromext}{}
\newcommand{\@faxcode}{0131}
\def\@faxfromfax{}

\newcommand{\@faxtoname}{}
\newcommand{\@faxtoorg}{}
\newcommand{\@faxtotel}{}
\newcommand{\@faxtofax}{}

\newcommand{\@faxpages}{\makebox[0.6cm][l]{}}
\newcommand{\@faxdate}{\@date}
\newcommand{\@faxmessage}{}

\newcommand{\FaxFromName}[1]{\renewcommand{\@faxfromname}{#1}}
\newcommand{\FaxFromEmail}[1]{\renewcommand{\@faxfromemail}{#1}}
\newcommand{\FaxFromExt}[1]{\renewcommand{\@faxfromext}{#1}}
\newcommand{\FaxShowFromFax}{\def\@faxfromfax{667 7209}}
\newcommand{\FaxIntCode}{\renewcommand{\@faxcode}{+44 131}}

\newcommand{\FaxToName}[1]{\renewcommand{\@faxtoname}{#1}}
\newcommand{\FaxToOrg}[1]{\renewcommand{\@faxtoorg}{#1}}
\newcommand{\FaxToTel}[1]{\renewcommand{\@faxtotel}{#1}}
\newcommand{\FaxToFax}[1]{\renewcommand{\@faxtofax}{#1}}

\newcommand{\FaxPages}[1]{\renewcommand{\@faxpages}{#1}}
\newcommand{\FaxDate}[1]{\renewcommand{\@faxdate}{#1}}
\newcommand{\FaxMessage}[1]{\renewcommand{\@faxmessage}{#1}}

\newcommand{\FaxPagesCalc}{%
  \def\fax@lastpage{
    \immediate\write\@auxout{\string \newlabel{FaxPageCount}{{}{\thepage}}}}%
  \AtEndDocument{\clearpage\fax@lastpage}%
  \renewcommand{\@faxpages}{\pageref{FaxPageCount}}
}

%%
%% Sundry lengths and commands used by the \makefax command
%%

\newlength{\fax@desclen}
\newlength{\fax@infolen}

\setlength{\fax@desclen}{1.6in}
\setlength{\fax@infolen}{\textwidth}
\addtolength{\fax@infolen}{-\fax@desclen}
\addtolength{\fax@infolen}{-24.8pt}

\newcommand{\fax@showinfo}[2]{\hfill{\fax@DescFont #1\/} : &
  \fax@MainTextFont #2\\}
\newcommand{\fax@section}[1]{%
  \vspace*{4ex}{\fax@SectionFont #1:}\par\vspace*{2ex}}

%%
%% The bit which inserts a University crest - ripped from euletr.cls
%%

\def\@dvips{dvips.def}
\def\@oztex{oztex.def}
\ifx\Gin@driver\@dvips
        %%% Do the PS image stuff for the DVIPS driver
        \newcommand{\@eushield}{%
          \scalebox{0.2332}{\includegraphics{eushield.ps}}
        }%
\else
\ifx\Gin@driver\@oztex
        %%% Do the PS image stuff for OzTeX
        \newcommand{\@eushield}{%
           \includegraphics[30mm,30mm]{eushield.ps}
        }%
\fi
\fi

%%
%% Now draw the actual fax cover page using the information we have
%%

\newcommand{\makefax}{%
  {\parindent=0pt\parskip=0pt
  \begin{titlepage}%
    \hfill \vbox to 0mm {\vss \hbox to 0pt {\hss \@eushield \hss} \vss}
    \vspace*{1.5cm}
    \begin{flushright}\fax@AddressFont
      DEPARTMENT {\fax@AddressItalicFont of} COMPUTER SCIENCE\vspace*{2ex}\\
      The University of Edinburgh \\
      James Clerk Maxwell Building \\
      The King's Buildings \\
      Mayfield Road \\
      Edinburgh\ \ EH9 3JZ\vspace*{1ex} \\
      \fax@AddressSmallFont
      Tel No: \@faxcode\ 650 5129 \\
      Fax No: \@faxcode\ 667 7209
    \end{flushright}%
    
    \vspace{2ex}\begin{flushleft}
    {\fax@TitleFont FACSIMILE TRANSMISSION SHEET}
    \end{flushleft}\vspace*{-3ex}\rule{\textwidth}{1mm}\par
  
    \setlength{\extrarowheight}{3pt}
    \fax@section{To}
    \framebox[\textwidth][l]{%
      \begin{tabular}{p{\fax@desclen}l}
        \fax@showinfo{Name}{\@faxtoname}
        \fax@showinfo{Organisation / Dept}{\@faxtoorg}
        \fax@showinfo{Tel No}{\@faxtotel}
        \fax@showinfo{Fax No}{\@faxtofax}
      \end{tabular}}

    \fax@section{From}
    \framebox[\textwidth][l]{%
      \begin{tabular}{p{\fax@desclen}l}
        \fax@showinfo{Name}{\@faxfromname}
        \fax@showinfo{E-mail}{\@faxfromemail}
        \fax@showinfo{Tel No}{\@faxcode\ 650 \@faxfromext}
        \ifx\@faxfromfax\empty
          \empty
        \else
          \fax@showinfo{Fax No}{\@faxcode\ 667 7209}
        \fi
      \end{tabular}}\vspace*{3pt}
    \framebox[\textwidth][l]{%
      \begin{tabular}{p{\fax@desclen}l}
        \fax@showinfo{Date Sent}{\@faxdate}
        \fax@showinfo{Pages}{\@faxpages\ \ (including cover sheet)}
      \end{tabular}}

    \fax@section{Message} \parskip=10pt\fax@MainTextFont\@faxmessage
  \end{titlepage}
  }
}

%%
%% EOF: csfax.cls
%%
