%
% Front page layout for thesis made at the University of Aveiro
%
% (c) 1999,2001 Tom�s Oliveira e Silva
%
% WORKS WELL ONLY FOR 11pt DOCUMENTS
%
\ProvidesPackage{uaThesis}[2005/09/13 v0.3a UA thesis front pages]
\usepackage{epsfig}

\ifcase\@ptsize % 10pt
  \message{^^JThe uaThesis style does NOT work well for 10pt documents^^J^^J}
\or             % 11pt
\or             % 12pt
  \message{^^JThe uaThesis style does NOT work well for 12pt documents^^J^^J}
\fi

\newif\ifua@color@\ua@color@false
\DeclareOption{usecolor}{\ua@color@true}

% Mechanical Engineering
\DeclareOption{MEng}{\def\ua@red{0.64}\def\ua@green{0.0}\def\ua@blue{0.0}%
  \def\ua@dep{Departamento de Engenharia Mec�nica}}

% Mathematics
\DeclareOption{Mat}{\def\ua@red{0.0}\def\ua@green{0.5}\def\ua@blue{1.0}%
  \def\ua@dep{Departamento de Matem\'atica}}

%Physics
\DeclareOption{Fis}{\def\ua@red{0.49}\def\ua@green{0.83}\def\ua@blue{0.87}%
  \def\ua@dep{Departamento de F\'\i sica}}

%Civil
\DeclareOption{CEng}{\def\ua@red{0.64}\def\ua@green{0.0}\def\ua@blue{0.0}%
  \def\ua@dep{Departamento de Engenharia Civil}}

\ExecuteOptions{MEng} % default!
\ProcessOptions

%
% Used to place a colored bar in the title page. The \BAR macro must be
% placed inside the first argument of the \HEADER macro.
%
\ifua@color@
  \usepackage[dvips]{color}
  \def\BAR{\smash{\rlap{\textcolor[rgb]{\ua@red,\ua@green,\ua@blue}{%
    \vrule width 133mm height 12mm depth -8mm}}}}
\else
  \def\BAR{\smash{\rlap{\special{ps:gsave \ua@red \ua@green \ua@blue setrgbcolor}%
    \vrule width 133mm height 12mm depth -8mm%
  \special{ps:grestore}}}}
\fi

%
% Used to include a figure in the title page. The \FIG macro must be placed
% inside the first argument of the \HEADER macro. The text of the macro is
% typeset in the space reversed for a figure, citation, or whatever, and must
% have an height plus depth that does not exceed 60mm
%
\long\def\FIG#1{\smash{\rlap{\setbox0=\hbox{#1}\dimen0=137mm%
  \advance\dimen0 by\ht0\lower\dimen0\box0}}}

%
% Used to put the University logo on the top of a page. Should be the first
% macro inside a \TitlePage environment. (The \GRID and \DRAFT macros may be
% safely placed before the \HEADER macro.) Its first argument can be a \BAR
% macro call and/or a \FIG macro call; anything else that does not change the
% horizontal and vertical positions can also be used. Its second argument is
% the year of the thesis.
%
\long\def\HEADER#1#2{\vspace*{5mm}\noindent\rlap{\parbox{\textwidth}{%
    \hspace*{77mm}#1\textsf{\textbf{Universidade de Aveiro} \ua@dep}%
    \hrule width \textwidth height .3pt depth 0mm\relax
    \hspace*{77mm}\textsf{\textbf{\strut #2}}}}\par
  \vspace*{-8.8mm}\noindent\hspace*{67mm}\includegraphics[height=9mm]{uaLogoOld.pdf}%
  \par\vspace*{40mm}}

%
% Used to put the thesis title in the page. Must be immediately after
% the \HEADER macro. The first argument is the author's name and the
% second argument is the thesis title.
%
\long\def\TITLE#1#2{\noindent\hspace*{15mm}\parbox[t]{52mm}{\raggedright
  \Large\textsf{\textbf{#1}}}\hspace*{10mm}\parbox[t]{120mm}{\raggedright
  \Large\textsf{\textbf{#2}}}\par}

%
% Used to put text in the page. The first argument is the left hand side
% text (may be empty) and the second argument is the right hand side text.
% Use either one \TEXT macro call per paragraph or put all paragraphs in
% one \TEXT macro call.
%
\long\def\TEXT#1#2{\noindent\hspace*{15mm}\parbox[t]{52mm}{\raggedright\sloppy
  \textsf{#1}}\hspace*{10mm}\parbox[t]{120mm}{\textsf{#2}}\par\medskip}

%
% The environment used to build a special page.
%
\def\TitlePage{\newpage\begingroup
  \hoffset=-1in%
  \voffset=-1in%
  \oddsidemargin=0mm%
  \evensidemargin=0mm%
  \topmargin=0mm%
  \headheight=0mm%
  \headsep=0mm%
  \textwidth=210mm%
  %\textheight=297mm%
  \paperwidth=210mm%
  \paperheight=297mm%
  \footskip=0mm%
  \maxdepth=0mm%
  \hsize=210mm%
  \vsize=297mm%
  \titlepage}
\def\EndTitlePage{\endtitlepage\endgroup\newpage}

%
% Used to place the text "Documento Provis�rio" across a page. This macro
% works correctly when the PostScript file is generated by dvips.
%
\def\DRAFT{\special{"gsave initmatrix newpath 297.64 500.94 translate
  30 rotate /Arial-BoldItalic findfont dup length dict begin
    { 1 index /FID ne { def } { pop pop } ifelse } forall
    /Encoding ISOLatin1Encoding def currentdict
  end /ISO exch definefont 50 scalefont setfont
  (Documento Provis�rio) dup stringwidth exch -2 div exch
  -2 div 0.26 50 mul sub moveto dup gsave 0.9 setgray show grestore
  true charpath 0 setlinewidth stroke grestore}}

%
% Used to place a 3mm grid in the page (useful for positioning things). This
% macro works correctly when the PostScript file is generated by dvips. Perfect
% for ghostscript (gv), but very bad when printed.
%
\def\GRID{\special{"gsave initmatrix 72 25.4 div dup scale
  newpath 0 setlinewidth 0.8 setgray
  0 3 210 { 0 moveto 0 297 rlineto } for
  0 3 297 { 0 exch moveto 210 0 rlineto } for stroke grestore}}

%
% Used to place a 3mm grid in the page (useful for positioning things). This
% macro works correctly when the PostScript file is generated by dvips. Too
% dark for ghostscript (gv), and acceptable when printed.
%
\def\PGRID{\special{"gsave initmatrix 72 25.4 div dup scale
  newpath 0 setlinewidth 0 setgray
  0 3 210 { 0 moveto 0 297 rlineto } for
  0 3 297 { 0 exch moveto 210 0 rlineto } for stroke grestore}}

\endinput
