%% This is csc-letterhead.sty, which is the LaTeX 2e package for 
%% Computer Science Club letterheads.
%% Copyright (C) 2003  Computer Science Club of the University of Waterloo
%%
%% This program is free software; you can redistribute it and/or modify
%% it under the terms of the GNU General Public License as published by
%% the Free Software Foundation; either version 2 of the License, or
%% (at your option) any later version.
%%
%% This program is distributed in the hope that it will be useful,
%% but WITHOUT ANY WARRANTY; without even the implied warranty of
%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
%% GNU General Public License for more details.
%%
%% You should have received a copy of the GNU General Public License
%% along with this program; if not, write to the Free Software
%% Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
%%
%% Requirements: You must have tetex-extra installed on your system.
%% This package should be used in conjunction with letter.cls and 
%% letterhead.sty.
%%
%% If you wish to generate csclogo.pdf for the first time, you ought to
%% run `pdflatex -shell-escape myfile.tex` to allow PDFTeX to execute shell
%% commands.  This is only useful if you are invoking PDFLaTeX.
%%
%% Changelog:
%%   Version 1.0
%%   * Initial release.
%%   -- Simon Law <sfllaw@engmail.uwaterloo.ca> Sun, 19 Jan 2003 22:06:17 -0500

\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{csc-letterhead}[2003/01/19 v1.0]

%%%%%%%%%%%
%% PACKAGES
%%%%%%%%%%%
\RequirePackage{letterhead}
\RequirePackage{graphics}
\RequirePackage{url}
\urlstyle{same}

%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% DEFINE NEW SUBSTITUTIONS
%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand*{\email}[1]{\def\fromemail{#1}}
\newcommand*{\website}[1]{\def\websiteurl{#1}}
\email{}
\website{\url{http://www.csclub.uwaterloo.ca}}
\location{200 University Ave. W., MC 3036/3037, Waterloo, ON. N2L 3G1.}
\telephone{(519) 888-4567 x3870.}

%%%%%%%%%%%
%% CSC LOGO
%%%%%%%%%%%
\begin{filecontents*}{csclogo.eps}
%!PS-Adobe-2.0 EPSF-1.2
%%Creator:Ian Goldberg
%%Title:CSC Logo
%%BoundingBox: 0 0 540 165
%%EndComments
gsave %0 setlinecap 0 setlinejoin 1 setlinewidth
newpath 
10 %% Half of the line width, where the circles have radius 60
%% Calculate the magic angles
dup dup dup 2 mul 30 sub exch 60 sub div dup dup mul 1 exch sub sqrt exch atan
/csclogomagic1 exch def
dup 2 mul 30 add exch 60 add div dup dup mul 1 exch sub sqrt exch atan
/csclogomagic2 exch def
/csclogowid exch def

130 95 60 csclogowid sub 0 180 csclogomagic1 sub arcn
70 95 60 csclogowid add csclogomagic2 360 arc
190 95 60 csclogowid sub 180 csclogomagic1 neg arcn
250 95 60 csclogowid add 180 csclogomagic2 add 180 arc
csclogowid dup add 0 rmoveto
250 95 60 csclogowid sub 180 csclogomagic1 180 add arcn
190 95 60 csclogowid add csclogomagic2 neg 180 arc
70 95 60 csclogowid sub 0 csclogomagic1 arcn
130 95 60 csclogowid add 180 csclogomagic2 sub 360 arc
closepath fill
/Helvetica findfont 48 scalefont setfont
(Computer) 330 115 moveto show
(Science) 330 75 moveto show
(Club) 330 35 moveto show
/Helvetica findfont 18 scalefont setfont
(A Student Chapter of the ACM) 135 5 moveto show grestore
\end{filecontents*}

\RequirePackage{ifpdf}
\ifpdf
  \RequirePackage{epstopdf}
\fi

% Caculate the width of the logo, and how much space is left over.
\newsavebox{\csclogo}
\sbox{\csclogo}{\resizebox{!}{3\baselineskip}{\includegraphics{csclogo}}}
\newlength{\csclogowidth}
\newlength{\notlogowidth}
\settowidth{\csclogowidth}{\usebox{\csclogo}}
\setlength{\notlogowidth}{\textwidth}
\addtolength{\notlogowidth}{-\csclogowidth}

%%%%%%%%%%%%%
%% LETTERHEAD
%%%%%%%%%%%%%
\renewcommand{\letterhead}{%
  \sffamily%
  \parbox{\csclogowidth}{\usebox{\csclogo}}%
  \parbox{\notlogowidth}{%
    \mbox{} \hfill \fromname\\
    \mbox{} \hfill \fromoffice\\
    \mbox{} \hfill \fromemail
  }%
  \\%
  \mbox{}\hrulefill%
}

%%%%%%%%%
%% FOOTER
%%%%%%%%%
\renewcommand{\letterfoot}{%
  \sffamily%
  \centerline{\makebox[0.8\textwidth]{\hrulefill}}%
  \fromlocation \hfill \telephonenum\\%
  \centerline{\websiteurl}%
}


\endinput
