% Author: Maurizio Loreti, aka MLO or (HAM) I3NOO
% Work:   University of Padova - Department of Physics
%         Via F. Marzolo, 8 - 35131 PADOVA - Italy
% Phone:  +39 (049) 827-7216   FAX: +39 (049) 827-7102
% EMail:  loreti@pd.infn.it
% WWW:    http://www.pd.infn.it/~loreti/mlo.html
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% A class for official letters from ``Istituto Nazionale
% di Fisica Nucleare, Sezione di Padova''; it is a simple
% interface to the ``letter'' class, that prints in the
% first page the Italian Republic official seal and the
% local INFN header, and selects for the following pages
% the ``plain'' page style.
%
% The only option specific to this class is "center", that
% prints the first page header centered (the default is to
% flush the header on the left); all other options are
% passed to the letter class, and to the used packages.
%
% N.B.: the offsets have been found by trial and error, and
%       are intended for A4 paper.
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% $Id: infnpd.cls,v 1.4 2005/01/03 13:27:14 loreti Exp $
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{infnpd}[2005/01/03 INFN-Padova letter class]

\newif\ifCenterInfnHeader\CenterInfnHeaderfalse
\DeclareOption{center}{\CenterInfnHeadertrue}
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{letter}}
\ProcessOptions\relax
\LoadClass[a4paper]{letter}

\RequirePackage{graphicx}
\RequirePackage{geometry}[2002/07/08]

% The interface with the ``geometry'' class has changed with
% the release of July, 2002

\geometry{a4paper, centering, margin=1.5in, nomarginpar, ignoreheadfoot}

% Seal (scanned); headers (in Helvetica); footer (also in
% Helvetica).

\newsavebox{\infnHead}
\newsavebox{\infnFoot}

\sbox{\infnHead}{%
  \parbox[t]{250pt}{%
    \begin{center}
      {\includegraphics[width=8mm]{repit.eps.gz}} \\[1mm]
      {\fontfamily{phv}\fontseries{bc}\fontsize{14}{14}\selectfont
        ISTITUTO NAZIONALE DI FISICA NUCLEARE} \\
      {\fontfamily{phv}\fontseries{m}\fontsize{9}{9}\selectfont
        Sezione di PADOVA} \\
      \vspace*{-1mm}\rule{10mm}{0.1mm}
    \end{center}}}

\sbox{\infnFoot}{%
  \parbox[t]{430pt}{%
    \rule{430pt}{0.1mm}\\[10pt]
    \fontfamily{phv}\fontseries{m}\fontsize{6}{8}\selectfont%
    \centering\mbox{%
      Via F.\ Marzolo 8 - 35131 Padova -
      Telefono +39 (049) 827-5111 -
      FAX +39 (049) 827-7102 -
      Codice Fiscale 80006480281 -
      Partita IVA (VAT) 00742430283}}}

\ifCenterInfnHeader
\renewcommand{\ps@headings}{%
  \renewcommand{\@oddhead}{\raisebox{20pt}[0pt]{%
      \makebox[\textwidth][c]{\usebox{\infnHead}}}}%
  \renewcommand{\@oddfoot}{\raisebox{-30pt}[0pt]{%
      \makebox[\textwidth][c]{\usebox{\infnFoot}}}}%
  \renewcommand{\@evenhead}{}%
  \renewcommand{\@evenfoot}{}%
}
\else
\renewcommand{\ps@headings}{%
  \renewcommand{\@oddhead}{\raisebox{20pt}[0pt]{%
      \makebox[\textwidth][l]{\usebox{\infnHead}}}}%
  \renewcommand{\@oddfoot}{\raisebox{-30pt}[0pt]{%
      \makebox[\textwidth][c]{\usebox{\infnFoot}}}}%
  \renewcommand{\@evenhead}{}%
  \renewcommand{\@evenfoot}{}%
}
\fi

\providecommand{\@oddhead}{}
\providecommand{\@oddfoot}{}
\providecommand{\@evenhead}{}
\providecommand{\@evenfoot}{}

\pagestyle{plain}
\thispagestyle{headings}

% A special command to be prepended to the letter, in order
% to let a reasonable amount of space under the header.

\newcommand{\FirstPage}{\par\vspace*{20mm}}

\endinput

%%
%% End of `infnpd.cls'
