%% 
%% rugstijl.cls
%%
%% Ghent University 'huisstijl' for letters
%% Koen Denecker <denecker@elis.rug.ac.be>
%% 13/01/2000, v0.1beta
%%
\NeedsTeXFormat{LaTeX2e}[1996/01/01]
\ProvidesClass{rugstijl}[2000/01/01 v0.1beta Letter Ghent Univ. (K. Denecker)]
%%
%% preliminary declarations
\newcommand{\lang}{dutch}
%%
%% options
\DeclareOption{10pt}{\PassOptionsToClass{10pt}{letter}}
\DeclareOption{11pt}{\PassOptionsToClass{11pt}{letter}}
\DeclareOption{12pt}{\PassOptionsToClass{12pt}{letter}}
\DeclareOption{dutch}{\renewcommand{\lang}{dutch}}
\DeclareOption{english}{\renewcommand{\lang}{english}}
\DeclareOption{french}{\renewcommand{\lang}{french}}
\DeclareOption{german}{\renewcommand{\lang}{german}}
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{letter}}
\ProcessOptions\relax
%%
%% other class/packages
\LoadClass[a4paper]{letter}
\RequirePackage[dvips]{graphicx,color}
\RequirePackage{ifthen}
%%
%% (approximate) lengths
\setlength{\oddsidemargin}{8mm}
\setlength{\evensidemargin}{8mm}
\setlength{\textwidth}{157mm}
\setlength{\topmargin}{-20mm}
\setlength{\textheight}{230mm}
%%
%% fonts: Arial, 11pt
\renewcommand{\sfdefault}{phv}
\renewcommand{\rmdefault}{phv} %(!)
\DeclareFixedFont{\ixbsf}{OT1}{phv}{b}{n}{9}
\DeclareFixedFont{\xsf}{OT1}{phv}{m}{n}{10}
\DeclareFixedFont{\viiibsf}{OT1}{phv}{b}{n}{8}
%%
%% details
% RUG blue = Pantone 300CVC
\definecolor{rug_blue}{cmyk}{1,0.43,0,0}
%\definecolor{rug_blue}{cmyk}{0.96,0.51,0,0}
%\definecolor{rug_blue_qmsmc2_2400}{cmyk}{1,0.39,0,0.05}
%%
% RUG gray = Pantone 431CVC
\definecolor{rug_gray}{cmyk}{0.11,0,0,0.65}
%\definecolor{rug_gray}{cmyk}{0.58,0.40,0.34,0.26}
%\definecolor{rug_gray_qmsmc2_2400}{cmyk}{0.28,0,0,.71}
%%
\newcommand{\dutchnames}{%
  \newcommand{\yourrefname}{\textbf{Uw kenmerk}}%
  \newcommand{\ourrefname}{\textup{\textbf{Ons kenmerk}}}%
  \newcommand{\datename}{\textup{\textbf{Datum}}}%
  }%
\newcommand{\englishnames}{%
  \newcommand{\yourrefname}{\textbf{Your reference}}%
  \newcommand{\ourrefname}{\textup{\textbf{Our reference}}}%
  \newcommand{\datename}{\textup{\textbf{Date}}}%
  }%
\ifthenelse{\equal{\lang}{dutch}}{%
  \RequirePackage[dutch]{babel}%
  \dutchnames%
  }{\ifthenelse{\equal{\lang}{english}}{%
    \englishnames%
    }{\ifthenelse{\equal{\lang}{french}}{%
      \ClassError{rugstijl}{Language 'french' is not supported.}{}%
      }{\ifthenelse{\equal{\lang}{german}}{%
        \ClassError{rugstijl}{Language 'german' is not supported.}{}%
        }{%
        }%
      }%
    }%
  }%
\newcommand{\headlogo}{ruglogo.eps}
\newcommand{\footlogo}{ruglogo.eps}
\newcommand{\tbullet}{\raisebox{1pt}{\tiny $\bullet$}}
\newcommand{\sbullet}{\hspace{4pt}\tbullet\hspace{4pt}}
%%
% internal commands
\newcommand{\@yourref}{}
\newcommand{\@ourref}{}
\newcommand{\@thedate}{}
\newcommand{\@faculty}{\mbox{}}
\newcommand{\@dept}{\mbox{}}
\newcommand{\@depthead}{\mbox{}}
\newcommand{\@tel}{}
\newcommand{\@fax}{}
\newcommand{\@email}{}
\newcommand{\@optionline}{}
% internal booleans
\newboolean{@tel}\setboolean{@tel}{false}
\newboolean{@fax}\setboolean{@fax}{false}
\newboolean{@email}\setboolean{@email}{false}
%%
% external commands
\newcommand{\yourref}[1]{\renewcommand{\@yourref}{\yourrefname\\#1}}
\newcommand{\ourref}[1]{\renewcommand{\@ourref}{\ourrefname\\#1}}
\renewcommand{\@thedate}{\hfill\datename\\\mbox{}\hfill\@date}
\newcommand{\faculty}[1]{\renewcommand{\@faculty}{#1}}
\newcommand{\dept}[1]{\renewcommand{\@dept}{#1}}
\newcommand{\depthead}[1]{\renewcommand{\@depthead}{#1}}
\newcommand{\tel}[1]{\renewcommand{\@tel}{tel.\ #1}}
\newcommand{\fax}[1]{\renewcommand{\@fax}{fax #1}}
\newcommand{\email}[1]{\renewcommand{\@email}{e-mail: #1}}
\newcommand{\optionline}[1]{\renewcommand{\@optionline}{#1}}
%%
\newcommand{\footname}{RUG-ELIS-MEDISIP \tbullet{}
  Sint-Pietersnieuwstraat 41, B-9000 Gent, Belgium\\
  tel. +32\,(0)\,264\,89\,08 \tbullet{}
  fax +32\,(0)\,264\,35\,08 \tbullet{}
  e-mail:\, denecker@elis.rug.ac.be}
%%
\newcommand{\@telfaxmailline}{%
  \ifthenelse{\equal{\@tel}{}}{%
    \setboolean{@tel}{false}}{%
    \setboolean{@tel}{true}}%
  \ifthenelse{\equal{\@fax}{}}{%
    \setboolean{@fax}{false}}{%
    \setboolean{@fax}{true}}%
  \ifthenelse{\equal{\@email}{}}{%
    \setboolean{@email}{false}}{%
    \setboolean{@email}{true}}%
  \@tel%
  \ifthenelse{\boolean{@tel}\and\boolean{@fax}}{%
    \sbullet}{}%
  \@fax%
  \ifthenelse{\(\boolean{@tel}\or\boolean{@fax}\)\and{\boolean{@email}}}{%
    \sbullet}{}%
  \@email%
  \ifthenelse{\(\boolean{@tel}\or\boolean{@fax}\)\or{\boolean{@email}}}{%
    \\}{}%
  }%
%%
\newcommand{\@fromaddressline}{%
  \ifthenelse{\equal{\fromaddress}{}}{%
    \ClassError{rugstijl}{The \protect\address\space field is missing}{}%
    }%
  \fromaddress\\%
  }%
%%
\newsavebox{\lefthead}
\newsavebox{\righthead}
\newsavebox{\leftfoot}
\newsavebox{\middlefoot}
\newsavebox{\rightfoot}
\newsavebox{\head}
\newsavebox{\foot}
%%
\newcommand{\makeboxes}{%
  \sbox{\lefthead}{%
    \begin{picture}(0,0)%
      \setlength{\unitlength}{1mm}%
      \put(-28,-64){\makebox(0,0)[l]{\rule{6mm}{0.2pt}}}%
    \end{picture}%
    \mbox{%
      \hspace{-15mm}%
      \includegraphics[width=30mm]{\headlogo}%
      }%
    }%
  \sbox{\righthead}{%
    \parbox[b]{120mm}{%
      \begin{flushright}%
        \fontsize{11}{13.75}\selectfont%
        {\ixbsf \MakeUppercase{\@faculty}}\\[-4pt]%
        \textcolor{rug_blue}{\rule{120mm}{1.2pt}}\\[-10.5pt]%
        \textcolor{rug_blue}{\rule{120mm}{1.8pt}}\\[4pt]%
        {\ixbsf \MakeUppercase{\@dept}}\\[-2pt]%
        {\xsf \@depthead}%
      \end{flushright}%
      }%
    }%
  \sbox{\leftfoot}{%
    \mbox{%
      \hspace*{-15mm}%     
      \parbox[t]{142mm}{%
        \textcolor{rug_blue}{\rule{142mm}{1pt}}\\[-15pt]%
        \mbox{%
          \hspace*{15mm}%
          \parbox[t]{127mm}{%
            \begin{center}{%
                \viiibsf\setlength{\baselineskip}{9pt}%
                \@fromaddressline%
                \@telfaxmailline%
                \@optionline\par%
                }%
            \end{center}%
            }%
          }%
        }%
      }%
    }%
  \sbox{\middlefoot}{%
    \parbox{20mm}{%
      \includegraphics[width=20mm]{\footlogo}%
      }%
    }%
  \sbox{\rightfoot}{%
    \parbox[t]{8mm}{%
      \textcolor{rug_blue}{\rule{8mm}{1pt}}%
      }%
    }%
  \sbox{\head}{%
    \makebox[157mm]{%
      \usebox{\lefthead}%
      \hfill\usebox{\righthead}%
      }%
    }%
  \sbox{\foot}{%
    \makebox[157mm]{%
      \usebox{\leftfoot}%
      \hfill\usebox{\middlefoot}%
      \hfill\usebox{\rightfoot}%
      }%
    }%
  }%
%%
\renewcommand{\ps@firstpage}{%
  \setlength{\headheight}{30mm}%
  \setlength{\headsep}{12mm}%
  \setlength{\footskip}{0mm}% cannot be negative
  \renewcommand{\@oddhead}{\usebox{\head}}%
  \renewcommand{\@oddfoot}{\raisebox{0mm}[0mm]{\usebox{\foot}}}%
  \renewcommand{\@evenhead}{}%
  \renewcommand{\@evenfoot}{}%
  }
%%
\renewcommand{\ps@headings}{%
  \setlength{\headheight}{18mm}%
  \setlength{\headsep}{12mm}%
  \setlength{\footskip}{12mm}% cannot be negative
  \renewcommand{\@oddhead}{\hfill.../\hspace*{-1pt}... \thepage}%
  \renewcommand{\@evenhead}{}%
  \renewcommand{\@oddfoot}{\usebox{\foot}}%
  \renewcommand{\@evenfoot}{}%
  }%
%%
\providecommand{\@evenhead}{}
\providecommand{\@evenfoot}{}
\providecommand{\@oddhead}{}
\providecommand{\@oddfoot}{}
%%
\pagestyle{headings}
\raggedbottom
%%
\renewcommand{\opening}[1]{%
  \makeboxes%
  \enlargethispage{-12mm}% to compensate for increased headheight
  \thispagestyle{firstpage}%
  \begin{flushleft}%
  \parbox[t][30mm][t]{80mm}{%
    \toname\\%
    \toaddress%
    }\\[18mm]%
  \parbox[t]{65mm}{\@yourref}%
  \parbox[t]{45mm}{\@ourref}\hfill%
  \parbox[t]{40mm}{\@thedate}\\[8mm]%
  \end{flushleft}%
  #1\par\nobreak%
  }
%%
\renewcommand{\closing}[1]{%
  \par\nobreak\vspace{\parskip}%
  \stopbreaks%
  \noindent%
  #1\\*[6\parskip]%
  \mbox{}\fromsig%
  }%
