\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{uniudtesi}[2006/09/01  Redefines maketitle for University of Udine Thesis, and sets a binding offset of 1cm; written by Gianluca Gorni]
\RequirePackage{ifthen}
\RequirePackage{graphicx}
\RequirePackage{hyperref}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Per allontanare la parte stampata %
% dal margine della rilegatura:     %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\RequirePackage[bindingoffset=1cm]{geometry}


\hypersetup{pdfpagelayout=SinglePage,
pdfpagemode=UseOutlines,
bookmarksopen,
bookmarksopenlevel=2,
pdftitle=Tesi di Laurea,
pdfauthor=Tesista,
pdfsubject=Tesi di Laurea,
pdfkeywords=tesi laurea LaTeX}

\newcommand{\@facolta}{Scienze
    Matematiche, Fisiche e Naturali}
\newcommand{\@corsodilaurea}{?}
\newcommand{\@corsodilaureatriennale}{?}
\newcommand{\@corsodilaureaspecialistica}{?}
\newcommand{\@triennaleOspecialistica}{?}
\newcommand{\@titolo}{Senza Titolo}
\newcommand{\@annoaccademico}{?}
\newcommand{\@relatore}{?}
\newcommand{\@correlatore}{?}
\newcommand{\@correlatoreDue}{?}
\newcommand{\@laureando}{?}
\newcommand{\@laureanda}{?}
\newcommand{\@autore}{}
\newcommand{\@laureandoOlaureanda}{?}
\newcommand{\@dedica}{?}

\newcommand{\facolta}[1]{%
  \renewcommand{\@facolta}{#1}}
\newcommand{\corsodilaurea}[1]{%
  \renewcommand{\@corsodilaurea}{#1}%
  \renewcommand{\@triennaleOspecialistica}{\ignorespaces}}
\newcommand{\corsodilaureatriennale}[1]{%
  \renewcommand{\@corsodilaurea}{#1}%
  \renewcommand{\@triennaleOspecialistica}{Triennale }}
\newcommand{\corsodilaureaspecialistica}[1]{%
  \renewcommand{\@corsodilaurea}{#1}%
  \renewcommand{\@triennaleOspecialistica}{Specialistica }}
\newcommand{\titolo}[1]{%
  \renewcommand{\@titolo}{\uppercase{#1}}}
\newcommand{\annoaccademico}[1]{%
  \renewcommand{\@annoaccademico}{#1}}
\newcommand{\relatore}[2][Prof.]{%
  \renewcommand{\@relatore}{#1 \uppercase{#2}}}
\newcommand{\correlatore}[2][Prof.]{%
  \renewcommand{\@correlatore}{#1 \uppercase{#2}}}
\newcommand{\correlatoreDue}[2][Prof.]{%
  \renewcommand{\@correlatoreDue}{#1 \uppercase{#2}}}
\newcommand{\laureando}[1]{%
  \renewcommand{\@laureando}{\uppercase{#1}}%
  \renewcommand{\@autore}{\uppercase{#1}}%
  \renewcommand{\@laureandoOlaureanda}{Laureando}}
\newcommand{\laureanda}[1]{%
  \renewcommand{\@laureanda}{\uppercase{#1}}%
  \renewcommand{\@autore}{\uppercase{#1}}%
  \renewcommand{\@laureandoOlaureanda}{Laureanda}}
\newcommand{\dedica}[1]{%
  \renewcommand{\@dedica}{#1}}
\newcommand{\data}[1]{\date{#1}}

\newcommand{\clearemptydoublepage}{\newpage{\pagestyle{empty}%
  \cleardoublepage}}

    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    %                                   %
    %  Formattazione dell'intestazione  %
    %  della tesi                       %
    %                                   %
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\renewcommand\maketitle{\begin{titlepage}
  \begin{sffamily}
  \begin{large}
  \begin{center}
    \vbox to0pt{%
    \vbox to\textheight{\vfil
    \includegraphics[width=\textwidth]{polloPallido}%
    \vfil}\vss}
  \end{center}
  \begin{center}
  \begin{Large}
    \uppercase{Universit\`a degli Studi di Udine}
    \end{Large}\\
  \rule{9cm}{.4pt}\\
  \smallskip
  Facolt\`a di \@facolta\\
  \medskip
  Corso di Laurea \@triennaleOspecialistica in
     \@corsodilaurea\\
  \bigskip\vfill
  \begin{Large} Tesi di Laurea\end{Large}\\
  \bigskip
  \bigskip
  {\vfil
    \begin{Huge}
      {\renewcommand{\\}{\cr}
     \halign{\hbox to\textwidth{\strut\hfil##\hfil}\cr
     \@titolo\cr}}
    \end{Huge}}
  \bigskip\vfill
  \begin{tabular*}{\textwidth}{@{}l@{\extracolsep{\fill}}l@{}}
    Relatore:&\@laureandoOlaureanda:\\
     \vtop{\halign{\strut\hfil##\hfil\cr
       \@relatore\cr}}&%
     \vtop{\halign{\strut\hfil##\hfil\cr
       \@autore\cr}}%
  \end{tabular*}\end{center}
  \ifthenelse{\equal{\@correlatore}{?}}{}%
    {\noindent \ifthenelse{\equal{\@correlatoreDue}{?}}%
           {Correlatore}{Correlatori}:\newline
      \vtop{\halign{\strut##\hfil\cr
        \@correlatore%\cr%
      \ifthenelse{\equal{\@correlatoreDue}{?}}%
        {\cr}{\cr\@correlatoreDue\cr}}}}%
  \begin{center}
  \vfill
  \rule{9cm}{.4pt}\\
  \medskip
  \uppercase{Anno Accademico \@annoaccademico}\\
  \end{center}
  \end{large}
\end{sffamily}
\clearemptydoublepage
\ifthenelse{\equal{\@dedica}{?}}{}{%
\pagestyle{empty}
  \null\vfil
  \begin{Large}
  \begin{flushright}
    \@dedica
  \end{flushright}
  \end{Large}
  \vfil\vfil\clearemptydoublepage}
\end{titlepage}}


\endinput