% \iffalse meta-comment
%
% Copyright (C) 2008-2011 by Enrico Gregorio 
% <Enrico dot Gregorio at univr dot it>
% -------------------------------------------------------
% 
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3
% of this license or (at your option) any later version.
% The latest version of this license is in
%   http://www.latex-project.org/lppl.txt
% and version 1.3 or later is part of all distributions of LaTeX
% version 2005/12/01 or later.
%
% This work consists of all files listed in README
%
% \fi
%
% \iffalse
%<*driver>
\ProvidesFile{frontespizio.dtx}
%</driver>
%<package>\NeedsTeXFormat{LaTeX2e}[2005/12/01]
%<package>\ProvidesPackage{frontespizio}
%<*package>
  [2011/09/21 1.4a (Enrico Gregorio)]
%</package>
%<*driver>
\PassOptionsToClass{a4paper}{article} % we need a4paper
\documentclass{ltxdoc}
\usepackage[T1]{fontenc}
\usepackage[english,italian]{babel}
\usepackage{graphicx,array,booktabs,microtype}
\usepackage{frontespizio}

\newcommand{\pack}[1]{\mbox{\sffamily#1}}
\newcommand{\env}{\texttt}
\newcommand{\file}{\texttt}
\newcommand{\opt}[1]{``\texttt{#1}''}
\newcommand{\frontcommand}[3][f]{%
  \subsection*{\cs{#2}#3%
  \ifx#1o%
    ~(*)%
  \else
  \ifx#1s%
    ~(\textdagger)%
  \fi\fi}%
}
\newcommand{\frontenvironment}[2]{%
  \subsection*{\cs{begin}\ttchar\{\texttt{#1}\ttchar\}\\
    #2\\
    \cs{end}\ttchar\{\texttt{#1}\ttchar\}}}
\makeatletter
\def\meta@font@select{\normalfont\itshape} % I dislike tt italic
\makeatother
\newcommand{\ttchar}[1]{{\normalfont\ttfamily\char`#1}}
\newcommand{\frontoption}[1]{\subsection*{\texttt{#1}}}
\newcommand{\includeex}[1]{\par\vfill\begin{center}
  \setlength{\fboxsep}{0pt}\fbox{\includegraphics[scale=.3]{#1}}
  \end{center}}

\DeclareRobustCommand\Xe{%
  \leavevmode X\lower0.5ex
   \hbox{\kern-0.15em\reflectbox{E}}\kern-0.15em}

\EnableCrossrefs         
\CodelineIndex
\RecordChanges
\begin{document}
  \DocInput{frontespizio.dtx}
\end{document}
%</driver>
% \fi
%
% \CheckSum{1331}
%
% \CharacterTable
%  {Upper-case    \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
%   Lower-case    \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
%   Digits        \0\1\2\3\4\5\6\7\8\9
%   Exclamation   \!     Double quote  \"     Hash (number) \#
%   Dollar        \$     Percent       \%     Ampersand     \&
%   Acute accent  \'     Left paren    \(     Right paren   \)
%   Asterisk      \*     Plus          \+     Comma         \,
%   Minus         \-     Point         \.     Solidus       \/
%   Colon         \:     Semicolon     \;     Less than     \<
%   Equals        \=     Greater than  \>     Question mark \?
%   Commercial at \@     Left bracket  \[     Backslash     \\
%   Right bracket \]     Circumflex    \^     Underscore    \_
%   Grave accent  \`     Left brace    \{     Vertical bar  \|
%   Right brace   \}     Tilde         \~}
%
% \changes{v1.0}{2008/03/04}{First public release}
% \changes{v1.2}{2010/06/25}{Added `noinputenc' and `nouppercase'
%   options; added `Preambolo*' environment; various implementation changes}
% \changes{v1.3}{2011/03/08}{Added support for memoir}
% \changes{v1.3a}{2011/03/08}{Added info message in the \file{frn} file}
% \changes{v1.4}{2011/07/18}{Added option `suftesi'; updated the documentation}
% \changes{v1.4a}{2011/09/21}{Maintenance release, no changes}
% \GetFileInfo{frontespizio.dtx}
%
% \DoNotIndex{\newcommand,\newenvironment,\def,\begin,\vskip,\ }
% \DoNotIndex{\DeclareOption,\ExecuteOptions,\RequirePackage}
% \DoNotIndex{\@@end,\@empty,\@ifclassloaded,\@nameuse,\@nil}
% \DoNotIndex{\@undefined,\\,\`,\addtocounter,\advance,\bfseries}
% \DoNotIndex{\centering,\closeout,\define@key,\documentclass}
% \DoNotIndex{\edef,\else,\end,\endinput,\endtitlepage,\expandafter}
% \DoNotIndex{\extracolsep,\fi,\fill,\fontsize,\g@addto@macro,\toks}
% \DoNotIndex{\hrule,\hspace,\if,\if@twoside,\ifcase,\ifdefined}
% \DoNotIndex{\iffalse,\IfFileExists,\ifnum,\ifx,\immediate,\setcounter}
% \DoNotIndex{\jobname,\let,\long,\MakeUppercase,\MessageBreak}
% \DoNotIndex{\newcount,\newif,\newpage,\newtoks,\newwrite,\next}
% \DoNotIndex{\noexpand,\nofiles,\normalfont,\normalsize,\null}
% \DoNotIndex{\openout,\or,\Package,\PackageError,\PackageWarning}
% \DoNotIndex{\PackageWarningNoLine,\paperheight,\paperwidth,\par}
% \DoNotIndex{\parbox,\parindent,\relax,\scshape,\selectfont,\setkeys}
% \DoNotIndex{\sffamily,\space,\stretch,\string,\textheight,\textwidth}
% \DoNotIndex{\the,\thispagestyle,\unexpanded,\unless,\unskip,\upshape}
% \DoNotIndex{\usepackage,\vbox,\vfill,\vspace,\write,\z@}
% \DoNotIndex{\CurrentOption,\AtEndDocument,\@ne,\c@page,\m@ne}
% \DoNotIndex{\@firstofone,\@gobble,\@makeother,\begingroup,\endgroup}
% \DoNotIndex{\eTeXversion,\hbox,\hsize,\includegraphics,\newlinechar}
% \DoNotIndex{\titlepage,\vss,\vtop,\xdef,\@gobbletwo,\color,\dimexpr}
% \DoNotIndex{\huge,\large,\makebox,\ProcessOptions,\renewcommand}
% 
% \begin{frontespizio}
% \Universita{Pietrascambio}
% \Facolta{Scienze Matematiche, Fisiche e Naturali}
% \Corso[Laurea]{Tipografia elettronica}
% \Titoletto{Tesi di perfezionamento}
% \Titolo{Come comporre un frontespizio\\e vivere felici}
% \Rientro{2cm}
% \NCandidato{Autore}
% \Candidato{Enrico Gregorio}
% \Relatore{Ch.mo Prof.\ Basilio Nodari}
% \Correlatore{Dott.\ R. J. Drofnats}
% \Annoaccademico{2007-2011}
% \end{frontespizio}
% 
% 
% \title{Il pacchetto \textsf{frontespizio}\thanks{Questa
%   documentazione corrisponde alla versione~\fileversion{}
%   del~\filedate}}
% \author{Enrico Gregorio \\
%   \texttt{Enrico dot Gregorio at univr dot it}}
% \date{\filedate}
% \maketitle
% 
% \begin{otherlanguage*}{english}
% \section*{Introduction in English}
% 
% This package is meant for Italian users who want to print a
% frontispiece to their thesis, be it for graduation or for their
% Ph.D\@.; actually the package can be tweaked also for other
% purposes, provided the overall structure of the desired frontispiece
% is compatible with the standard one.
% 
% It's usually difficult to get a first page which has very different
% layout than the internal pages; use of the \pack{chngpage} package
% is cumbersome for this purpose and it's difficult to adapt the
% settings to all classes.  I tried an approach with this package, but
% it was difficult to maintain and extend.
% 
% The idea of this package is similar to that of \pack{pdfpages}: we 
% produce a page and include it as a graphic object. The difference 
% from \pack{pdfpages} is that the markup necessary to define the 
% elements of the frontispiece is given in the user's document.
% 
% Since traditions for frontispieces are different in the various
% countries, I decided to prepare this package with Italian customs in
% mind.  Therefore the structure of the frontispiece is somewhat rigid
% and might not be apt to be used abroad.  Consequently, I decided to
% write the documentation in Italian and on \textsc{a}4 paper, but the
% comments to the code will be in English.
% \end{otherlanguage*}
% 
% \section{Introduzione}
% 
% Molti, scrivendo la propria tesi di laurea o di dottorato, hanno il 
% problema di produrre un frontespizio adeguato che sia ben centrato 
% sulla prima pagina. Questo \`e piuttosto difficile, anche usando 
% l'ambiente \env{titlepage} che eredita il formato di pagina imposto 
% dalla classe o modificato dall'utente con \pack{geometry}.
% 
% Come si vede, il frontespizio di questo documento \`e del tutto
% indipendente dai parametri di impaginazione successivi.  Ovviamente
% il nome dell'universit\`a e quello del relatore sono di fantasia.  O
% no?
% 
% Una prima soluzione che impiegava il pacchetto \pack{chngpage} aveva
% vari difetti, pur se funzionava con le classi standard.  Questo
% nuovo pacchetto cerca di risolvere la questione producendo un
% documento separato che va compilato a parte e che verr\`a poi
% incluso direttamente nel documento principale senza altri
% interventi.  Il vantaggio di usare questo pacchetto \`e che i
% comandi necessari per definire i vari elementi del frontespizio
% (titolo, candidato, relatore e cos\`i via) sono contenuti nello
% stesso documento.  Se il documento principale si chiama
% \file{tesi.tex}, il documento da compilare sar\`a
% \file{tesi-frn.tex} e si trover\`a nella stessa cartella che
% contiene quello principale.  La sequenza di comandi \`e, dunque,
%\begin{verbatim}
%pdflatex tesi
%pdflatex tesi-frn
%pdflatex tesi
%\end{verbatim}
% e, alla fine, il frontespizio sar\`a al suo posto. Nel seguito, il 
% documento che contiene i dati per comporre il frontespizio sar\`a 
% chiamato \file{frn}. Nel caso si usi \file{latex} e non 
% \file{pdflatex}, la sequenza di comandi \`e
%\begin{verbatim}
%latex tesi
%latex tesi-frn
%dvips -o tesi-frn.eps tesi-frn
%latex tesi
%\end{verbatim}
% Non occorre certo dare ogni volta questi comandi: basta farlo quando
% abbiamo modificato il contenuto dell'ambiente \env{frontespizio}.
%
% Se la classe \`e chiamata con l'opzione \opt{oneside}, il frontespizio
% occupa correttamente solo la prima; nel caso di \opt{twoside}, viene
% prodotta una pagina bianca.  \`E meglio con \opt{twoside}, naturalmente:
% scrivere solo fronte \`e uno spreco di carta, cos\`i come con interlinea
% maggiorata.
% 
% \`E possibile usare il pacchetto anche per includere un frontespizio 
% creato con altri sistemi, si veda pi\`u avanti la descrizione 
% dell'opzione \opt{onlyinclude}.
%
% Sono a conoscenza del fatto che il pacchetto è stato usato per
% comporre frontespizi anche di documenti diversi da tesi e
% simili. Naturalmente qui si tratta di frontespizi `formali', senza
% alcuna pretesa di essere artistici.
% 
% \section{Uso}
% 
% Il documento va impostato con l'opzione \opt{titlepage} e va caricato
% il pacchetto \pack{frontespizio}: per esempio
%\begin{verbatim}
%\documentclass[a4paper,titlepage]{book}
%\usepackage[italian]{babel}
%\usepackage[<opzioni>]{frontespizio}
%\end{verbatim}
% L'opzione \opt{titlepage} \`e normalmente attiva per la classe 
% \pack{book}, ma non lo \`e per la classe \pack{report}. L'opzione
% non esiste per la classe \pack{memoir} e quindi non va data.
% 
% Sono previste due opzioni principali: \opt{sans} e \opt{nowrite}.  La
% prima compone il frontespizio in caratteri senza grazie, la seconda
% serve a evitare la scrittura o riscrittura del documento \file{frn},
% ovviamente solo quando esso \`e definitivo o quando non ci interessa
% riscriverlo ogni volta che compiliamo.
% 
% Vediamo un tipico frontespizio nella tabella~\ref{tab:example}. I
% comandi vanno dati dopo |\begin{document}|.  Si possono dare quanti
% relatori e correlatori si vuole; basta scriverli uno dopo l'altro
% come argomenti di comandi \cs{Relatore} o
% \cs{Correlatore}.\footnote{Aggiungere i titoli onorifici o
% professionali, mi raccomando!  Altrimenti i chiarissimi professori
% potrebbero offendersi.~\texttt{;-)}} Il correlatore \`e colui che
% collabora alla direzione del lavoro di tesi, non quello che fa le
% pulci alla tesi stessa prima dell'esame finale, propriamente
% \emph{controrelatore}, il cui nome \emph{non} va nel frontespizio.
%
% \begin{table}[tp]
% \caption{Esempio di comandi per il frontespizio}\label{tab:example}
% \centering
% \bigskip
% \begin{lrbox}{0}
% \begin{minipage}{.75\textwidth}
%\begin{verbatim}
%\begin{frontespizio}
%\Universita{Paperopoli}
%\Logo{duck}
%\Facolta{Pennutologia}
%\Corso{Belle Lettere}
%\Annoaccademico{2030--2031}
%\Titoletto{Tesi di laurea magistrale}
%\Titolo{La mia tesi:\\ una lunga serie di risultati\\
%        difficilissimi e complicatissimi}
%\Sottotitolo{Alcune considerazioni mutevoli}
%\Candidato[PP999999]{Paperon de' Paperoni}
%\Relatore{Giovanni Episcopo}
%\Relatore{Pippo Cluvio}
%\Correlatore{Ugo Frogio}
%\Correlatore{Ubaldo Kutuzu}
%\end{frontespizio}
%\end{verbatim}
% \end{minipage}
% \end{lrbox}\fboxsep=1em \fbox{\usebox{0}}
% \end{table}
% 
% Si pu\`o anche non indicare il nome del relatore; questo pu\`o capitare 
% probabilmente per le tesi di dottorato. Basta allora dare l'opzione 
% \opt{noadvisor} al pacchetto.
% 
% Descriveremo pi\`u avanti, in dettaglio, i vari comandi disponibili.
% Notiamo subito che l'ordine in cui sono dati all'interno
% dell'ambiente \env{frontespizio} \`e irrilevante.
% 
% Con l'opzione \opt{onlyinclude}, nessuno dei comandi descritti pi\`u
% avanti \`e disponibile.  Si pu\`o usare solo il comando
% \cs{includefront} che prende come argomento il nome del documento
% che contiene il frontespizio.  Questo deve essere in formato
% \textsc{iso}~A4.  Il comando ha anche un argomento opzionale per
% rimettere in ordine i numeri di pagina, che deve essere un numero
% piccolo (fra $0$ e $9$).
% 
% Un'altra opzione \`e \opt{signatures}, che lascia fra i nomi dei
% relatori lo spazio per le loro firme.  Questa opzione pu\`o essere
% aggiunta direttamente al documento~\file{frn}: il mio consiglio \`e di
% duplicarlo, aggiungere l'opzione, compilarlo e usarne la stampa solo
% per la copia da far firmare al relatore.
% 
% Con l'opzione \opt{norules} si eliminano i filetti dal frontespizio 
% che normalmente vengono disegnati fra il nome dell'ateneo e quello 
% della facolt\`a e sopra l'indicazione dell'anno accademico.
%
% Con l'opzione \opt{swapnames} viene scambiata la posizione dei nomi
% di relatori e candidato; la posizione normale \`e con il nome del
% candidato a sinistra e quello del relatore a destra.
%
% 
% \section{Le opzioni}
% 
% Raccolgo qui le opzioni gi\`a descritte, per un pi\`u facile
% riferimento.  Quando due opzioni sono separate da~`$\mid$', la prima
% \`e quella valida normalmente.
% 
% \frontoption{write${}\mid{}$nowrite}%
% Mutuamente esclusive.  Con la seconda si inibisce la scrittura del
% documento~\file{frn}: quando sappiamo che \`e definitivo non vale la
% pena riscrivere il file ogni volta.
% 
% \frontoption{standard${}\mid{}$suftesi}
% Mutuamente esclusive. Con la seconda si usa la forma del
% frontespizio adatta alla classe \pack{suftesi}, si veda la
% sezione~\ref{suftesi}.
%
% \frontoption{signatures}%
% Nel campo dedicato a relatori e correlatori vengono lasciati gli spazi
% per le firme.
% 
% \frontoption{noadvisor}%
% Non viene stampato il campo dedicato a relatori e correlatori.
%
% \frontoption{swapnames}%
% Dando questa opzione il campo dedicato a relatori e correlatori
% sar\`a stampato a sinistra e quello dedicato ai candidati a destra,
% contrariamente al comportamento usuale.
% 
% \frontoption{normal${}\mid{}$sans}%
% Mutuamente esclusive. Con la seconda si sceglie per il frontespizio 
% un carattere senza grazie; questo carattere pu\`o essere determinato 
% usando un comando del tipo
%\begin{verbatim}
%\Preambolo{\usepackage{helvet}}
%\end{verbatim}
% 
% \frontoption{norules}%
% Non vengono inseriti filetti nel frontespizio; senza questa opzione 
% un filetto separa il nome dell'ateneo da quello della facolt\`a e un 
% altro viene disegnato sopra l'indicazione dell'anno accademico.
%
% \frontoption{nouppercase}%
% Senza questa opzione il nome della facolt\`a di riferimento \`e in
% tutto maiuscolo; specificandola, verr\`a rispettato il maiuscolo e
% il minuscolo come indicato nel documento.
%
% \frontoption{noinputenc}%
% Il pacchetto ora trascrive automaticamente la chiamata al pacchetto
% \pack{inputenc} del documento principale, se c'\`e, con la stessa
% opzione. In casi estremi pu\`o essere necessario evitarlo per
% specificare direttamente, con il comando \cs{Preambolo} o
% l'ambiente \env{Preambolo*}, la chiamata a \pack{inputenc}
% 
% \frontoption{onlyinclude}%
% Definisce il comando \cs{includefront} e disabilita l'ambiente 
% \env{frontespizio}. Serve per includere un frontespizio preparato con 
% altri metodi; deve essere un file grafico che sia fra quelli
% gestibili con \cs{includegraphics} e deve avere formato 
% \textsc{iso}~A4.
% 
% \frontoption{driver=$\langle\mathit{driver}\rangle$}%
% Imposta la chiamata di \pack{graphicx} nel documento~\file{frn} per
% l'uso di un driver diverso da \texttt{dvips} o \texttt{pdftex}, per 
% esempio |driver=dvipdfm| oppure |driver=textures|.
% \emph{Attenzione}: ogni altra opzione data a \pack{frontespizio} produrr\`a
% il messaggio di errore
%\begin{verbatim}
%! Package frontespizio Error: Key <...> undefined.
%\end{verbatim}
% 
% \section{I comandi}
% 
% Alcuni comandi sono obbligatori: \`e necessario specificare
% l'istituzione e la sua divisione (facolt\`a o dipartimento) presso la
% quale si discute la tesi; ovviamente occorrono anche il titolo e
% l'autore, cio\`e il candidato, e l'anno accademico. Per tener conto di 
% possibili variazioni sul tema, i comandi obbligatori hanno varianti 
% che possono essere usate al loro posto.
% 
% Indicheremo con un asterisco~(*) i comandi obbligatori, con una
% spada~(\textdagger) quelli sostitutivi, cio\`e le varianti di cui si
% diceva, senza niente quelli facoltativi.
% 
% \frontcommand[o]{Universita}{\marg{nome breve}}
% L'istituzione in cui si discute la tesi, cio\`e quella che rilascia il 
% titolo di studio; va dato il nome abbreviato:
%\begin{verbatim}
%\Universita{Verona}
%\Universita{Napoli `Federico II'}
%\end{verbatim}
% Il comando aggiunge da s\'e ``Universit\`a degli Studi di''.
% 
% \frontcommand[s]{Istituzione}{\marg{nome completo}}
% Quando l'istituzione ha un nome particolare, occorre specificarlo per 
% intero con questo comando:
%\begin{verbatim}
%\Istituzione{Politecnico di Torino}
%\Istituzione{Universit\`a `Bocconi' di Milano}
%\Istituzione{Sapienza -- Universit\`a di Roma}
%\end{verbatim}
% 
% \frontcommand{Logo}{\oarg{dimen}\marg{file}}
% L'argomento di questo comando \`e il nome (senza estensione) di un
% documento grafico che contenga il simbolo dell'istituzione.  Ha un
% argomento opzionale, la dimensione in altezza del logo (normalmente
% 1.5\,cm):
%\begin{verbatim}
%\Logo[1.5cm]{logo}
%\end{verbatim}
% 
% \frontcommand{Filigrana}{\oarg{parametri}\marg{file}}
% L'argomento \`e il nome (senza estensione) di un documento che contenga 
% il simbolo dell'istituzione, con opportuna retinatura in modo che 
% appaia come in filigrana. Ha un argomento opzionale, che permette di 
% impostare alcuni parametri:
%\begin{verbatim}
%\Filigrana[height=10cm,before=1,after=1]{logoretinato}
%\end{verbatim}
% Con la chiave \texttt{height} si imposta l'altezza del simbolo, con le
% chiavi \texttt{before} e \texttt{after} si imposta la proporzione in
% cui \`e diviso lo spazio rimanente; i valori usuali sono quelli mostrati
% nell'esempio. Si pu\`o usare questo comando, dando opportuni valori,
% per inserire il logo in un posto diverso da quello che si ottiene
% con \cs{Logo}.
% 
% \frontcommand[o]{Facolta}{\marg{nome breve}}
% La facolt\`a in cui si sono svolti gli studi.  Per le tesi di laurea
% triennale o magistrale, sono le facolt\`a gli enti responsabili
% dell'esame finale.
% 
% \frontcommand[s]{Dipartimento}{\marg{nome breve}}
% Per le tesi di dottorato, la responsabilit\`a \`e di un dipartimento.
% 
% \frontcommand[s]{Divisione}{\marg{nome completo}}
% Se la facolt\`a o dipartimento ha un nome non usuale, si pu\`o inserirlo
% con questo comando:
%\begin{verbatim}
%\Divisione{Istituto di Cultura Generale}
%\end{verbatim}
% 
% \frontcommand[s]{Interfacolta}{\marg{nomi completi}}
% Se il corso di laurea \`e diviso fra pi\`u facolt\`a, si usi questo 
% comando; si noti che, a differenza di \cs{Facolta} e 
% \cs{Divisione}, il risultato non \`e messo automaticamente in 
% maiuscolo. Quindi si scriva, per esempio,
%\begin{verbatim}
%FACOLT\`A DI TUTTOLOGIA\\
%FACOLT\`A DI SCIENZE FUMETTISTICHE
%\end{verbatim}
% Si pu\`o usare la doppia barra rovescia per indicare dove spezzare le 
% righe.
% 
% \frontcommand[o]{Corso}{\oarg{tipo}\marg{nome}}
% Il corso di studi seguito, di cui la tesi \`e il compimento. Ha un 
% argomento opzionale che, non espresso, equivale a `Laurea Magistrale':
%\begin{verbatim}
%\Corso{Pennutistica}
%\Corso[Dottorato di Ricerca]{Pennutistica}
%\end{verbatim}
% 
% \frontcommand[s]{Scuola}{\marg{nome completo}}
% Se il corso di studi ha un nome speciale, si usi questo comando che 
% produce esattamente il suo argomento:
%\begin{verbatim}
%\Scuola{Scuola di specializzazione in Volo Planato}
%\end{verbatim}
% 
% \frontcommand{Titoletto}{\marg{tipo}}
% \`E possibile, con questo comando, specificare il tipo di tesi:
%\begin{verbatim}
%\Titoletto{Tesi di Laurea}
%\Titoletto{Tesi di Laurea Magistrale}
%\Titoletto{Tesi di Dottorato di Ricerca}
%\end{verbatim}
% 
% \frontcommand[o]{Titolo}{\marg{titolo}}
% Il titolo della tesi, con eventuali punti dove andare a capo espressi 
% con |\\|.
% 
% \frontcommand{Sottotitolo}{\marg{sottotitolo}}
% Un sottotitolo. Accade talvolta che due studenti preparino la loro 
% tesi in collaborazione e che ciascuno ne presenti una parte: il 
% sottotitolo \`e per questi casi, o altri che si possano pensare.
% 
% \frontcommand[o]{Candidato}{\oarg{matricola}\marg{nome}}

% Il nome e cognome del candidato.  Notare che, in italiano, il nome
% va \emph{prima} del cognome, qualsiasi cosa affermino i burocrati.
% Il comando prende come argomento opzionale il numero di matricola,
% che potrebbe essere richiesto dalle regole locali.  \`E possibile
% ripetere il comando, nel caso ci siano pi\`u candidati che
% presentano insieme il lavoro. Non c'\`e un comando per eliminare o
% modificare la scritta `Matricola'; nel caso lo si desiderasse si pu\`o
% usare uno fra i seguenti biechi trucchi:
%\begin{verbatim}
%\Preambolo{\renewcommand{\frontsmallfont}[1]{\small}}
%\Preambolo{\renewcommand{\frontsmallfont}[1]{\small Matr.}}
%\end{verbatim}
% Con il primo non viene stampato niente, con il secondo si avr\`a
% l'abbreviazione.
% 
% \frontcommand[o]{Relatore}{\marg{nome}}
% Il nome e cognome (se si preferisce preceduto dall'appellativo 
% accademico) del relatore. Pu\`o capitare che i relatori siano pi\`u 
% d'uno: basta specificarli successivamente, si veda l'esempio di prima.
% Il comando \`e obbligatorio se non si \`e data l'opzione \opt{noadvisor}.
% 
% \frontcommand{Correlatore}{\marg{nome}}
% Il nome e cognome del correlatore, di solito un esterno 
% all'istituzione che ha collaborato alla guida del lavoro che ha 
% portato alla tesi. Anche qui se ne pu\`o specificare pi\`u d'uno.
% 
% \frontcommand[o]{Annoaccademico}{\marg{anno}}
% L'anno accademico nel quale si discute la tesi.
% 
% \frontcommand[s]{Piede}{\marg{testo}}
% Se al piede non si vuole la scritta ``Anno Accademico'' ma 
% qualcos'altro, lo si specifichi nell'argomento a questo comando.
% 
% 
% \section{Modifiche all'aspetto del frontespizio}
% Alcuni aspetti del frontespizio possono essere variati.  Per esempio,
% \`e possibile caricare gli stessi caratteri usati nel corpo della tesi o
% cambiare i margini.
% 
% \frontcommand{NCandidato}{\marg{nome}}
% Il nome del candidato \`e preceduto dalla parola ``Candidato''. Se si 
% preferisce ``Laureando'', si usi
%\begin{verbatim}
%\NCandidato{Laureando}
%\end{verbatim}
% 
% \frontcommand{NCandidati}{\marg{nome}}
% Se ci sono pi\`u candidati, i nomi sono preceduti dalla parola
% ``Candidati''.  Se si preferisce ``Laureandi'', si usi
%\begin{verbatim}
%\NCandidati{Laureandi}
%\end{verbatim}
% 
% \frontcommand{NRelatore}{\marg{singolare}\marg{plurale}}
% Analogamente, il nome del relatore \`e preceduto da ``Relatore''. Se si 
% fosse esterofili, si potrebbe modificarlo con
%\begin{verbatim}
%\NRelatore{Advisor}{Advisors}
%\end{verbatim}
% \`E necessario scrivere sia la forma singolare che quella plurale, anche
% se ci sar\`a un solo relatore (ma si pu\`o lasciare l'argomento vuoto).
% 
% \frontcommand{NCorrelatore}{\marg{singolare}\marg{plurale}}
% Stesso discorso fatto per l'appellativo del relatore.
% 
% \frontcommand{Punteggiatura}{\marg{carattere}}
% Gli appellativi ``Candidato'' e ``Relatore'' sono seguiti da due 
% punti; se non lo si desidera, si scriva
%\begin{verbatim}
%\Punteggiatura{}
%\end{verbatim}
% 
% \frontcommand{Preambolo}{\marg{comandi}}
% Supponiamo che la tesi sia stata scritta con il carattere Utopia, 
% fornito dal pacchetto \pack{fourier}. Occorre specificarlo anche per 
% il frontespizio con
%\begin{verbatim}
%\Preambolo{\usepackage{fourier}}
%\end{verbatim}
% Nessuno dei pacchetti caricati dal documento principale passa
% automaticamente al frontespizio: ripetendo questo comando, che ha
% effetto cumulativo, si possono risolvere altri problemi particolari.
% Infatti l'argomento del comando viene trascritto cos\`i com'\`e nel
% preambolo del documento~\file{frn}.\footnote{In una versione
% precedente il comando era chiamato \cs{Package}; questo \`e ancora
% definito come equivalente di \cs{Preambolo}, ma il suo uso \`e
% deprecato.} Vedremo in seguito altri usi del comando; si consiglia di
% usarne uno per ciascuna riga da aggiungere al preambolo.
% 
% \frontenvironment{Preambolo*}{\meta{comandi}}
% Usare molti comandi \cs{Preambolo} pu\`o essere fastidioso.
% Perci\`o \`e stato introdotto questo ambiente dove possono essere
% dati vari comandi tutti insieme. Per esempio,
%\begin{verbatim}
%\begin{Preambolo*}
%\usepackage{kpfonts}
%\renewcommand{\fronttitlefont}{\fontsize{17}{21}\scshape}
%\renewcommand{\frontfootfont}{\fontsize{12}{14}\itshape}
%\end{Preambolo*}
%\end{verbatim}
% evita di dover specificare lunghi argomenti a \cs{Preambolo} o
% di usare questo comando pi\`u volte. In uno degli esempi della
% documentazione si vede come in questo ambiente possa andare
% qualsiasi cosa sia sensata nel preambolo di un documento \LaTeX.
%
% \frontcommand{Rientro}{\marg{dimen}}
% Il nome del candidato e quello del relatore sono a filo dei margini 
% sinistro e destro (che si possono ricavare dalle dimensioni dei due 
% filetti). Se si desidera averli pi\`u rientrati si pu\`o usare questo 
% comando:
%\begin{verbatim}
%\Rientro{1cm}
%\end{verbatim}
% 
% \frontcommand{Margini}{\marg{dimen}\marg{dimen}\marg{dimen}\marg{dimen}}
% Se i margini scelti dal pacchetto non sono di gradimento, si possono 
% specificarne di diversi con questo comando:
%\begin{verbatim}
%\Margini{1cm}{1.5cm}{1cm}{1cm}
%\end{verbatim}
% \`e l'equivalente della scelta del pacchetto.  Le dimensioni si
% riferiscono, nell'ordine, al margine sinistro, in basso, destro e in
% alto.\footnote{In versioni precedenti, questo comando e il
% precedente si chiamavano, rispettivamente, \cs{Margins} e
% \cs{MoreMargin}.}
% 
% 
% \section{Scelta dei caratteri: forma e misura}
% 
% Se non si fosse soddisfatti della scelta dei caratteri proposta
% dall'autore, si pu\`o usare il comando \cs{Preambolo} (o
% l'ambiente \env{Preambolo*}) per modificarla.  I comandi disponibili
% compaiono nella tabella~\ref{fonts}, con il loro valore usuale e la
% posizione in cui vengono usati.  Per esempio, per avere il titolo in
% maiuscoletto~16/20 (cio\`e corpo~16 con distanza fra le linee di
% base di 20 punti), si scriver\`a 
%\begin{verbatim}
%\Preambolo{\renewcommand{\fronttitlefont}{%
%    \fontsize{16}{20}\scshape}}
%\end{verbatim}
% La sintassi non \`e comoda, per scelta precisa.  Si ricordi che
% con l'opzione \texttt{sans} non \`e disponibile il maiuscoletto.
% Un'altra cosa da ricordare \`e che per scegliere un carattere,
% occorre specificare non solo le sue dimensioni (e questo va fatto
% per prima cosa), ma anche le sue altre caratteristiche.  Il comando
% \cs{fontsize} prende due argomenti: il corpo e l'avanzamento di
% riga; se non si specifica l'unit\`a di misura, viene assunta quella
% di punti tipografici~(pt).  Se si cambia uno dei caratteri
% predefiniti, occorre specificare ogni aspetto del nuovo, se non si
% vogliono avere sorprese. Una dichiarazione finale come
% \cs{scshape} o \cs{bfseries} rende disponibile il font; se
% manca occorre dare \cs{selectfont}.
% 
% \begin{table}[ht]
% \centering
% \caption{Comandi per la scelta dei caratteri}\label{fonts}
% \medskip\footnotesize
% \begin{tabular}{lll}
% \toprule
% Comando & Valore usuale & Impiego\\
% \midrule
% \cs{frontinstitutionfont} &
% Neretto, 14/17 &
% Nome dell'universit\`a o istituzione\\[3pt]
% \cs{frontdivisionfont} &
% Tondo, 12/16 &
% Nome della facolt\`a o divisione\\[3pt]
% \cs{frontpretitlefont} &
% Maiuscoletto, 10/12 &
% Per il titoletto\\[3pt]
% \cs{fronttitlefont} &
% Neretto, 17/21 &
% Per il titolo della tesi\\[3pt]
% \cs{frontsubtitlefont} &
% Tondo, 12/14 &
% Per il sottotitolo\\[3pt]
% \cs{frontfixednamesfont} &
% Tondo, 12/14 &
% Per scrivere le parole chiave\\
% && `Candidato', `Relatore' e `Correlatore'\\[3pt]
% \cs{frontnamesfont} &
% Neretto, 12/14 &
% Per i nomi di candidato e relatore\\[3pt]
% \cs{frontsmallfont} &
% Neretto, 9/11 &
% Per il numero di matricola\\
% && (eredita attributi dal precedente)\\[3pt]
% \cs{frontfootfont} &
% Neretto, 12/14 &
% Per scrivere l'anno accademico\\
% \midrule
% \cs{fronttitlecolor} &
% Maroon &
% Il colore del titolo con l'opzione\\
% && \texttt{suftesi}\\
% \bottomrule
% \end{tabular}
% \end{table}
% 
% 
% \section{Parametri di spaziatura}
% 
% \`E possibile cambiare la spaziatura fra il campo `relatori' e quello
% `correlatori' (il valore normale \`e 1\unit{ex}):
%\begin{verbatim}
%\Preambolo{\renewcommand{\frontrelcorrelsep}{2ex}}
%\end{verbatim}
% 
% Analogamente si pu\`o aggiustare la composizione nel caso si usi
% l'opzione \opt{signatures} modificando il comando
% \cs{frontadjustforsignatures} per esempio con
%\begin{verbatim}
%\Preambolo{\renewcommand{\frontadjustforsignatures}{1cm}}
%\end{verbatim}
% Si definisce cos\`i una spaziatura verticale aggiuntiva fra la zona
% ``candidato-relatori'', in modo che non si arrivi troppo vicino al
% filetto in basso.  Il comando non ha effetto se non dando l'opzione
% \opt{signatures}.
% 
% Un terzo parametro dimensionale \`e \cs{frontlogosep}, il cui
% valore normale \`e 6\unit{pt}; se il logo dovesse essere troppo vicino o
% lontano dal nome dell'universit\`a, si pu\`o modificare con un comando
% come
%\begin{verbatim}
%\Preambolo{\renewcommand{\frontlogosep}{4pt}}
%\end{verbatim}
% dove la dimensione pu\`o anche essere negativa.
% 
% Nel caso di pi\`u candidati, la spaziatura fra i nomi \`e regolata
% dal parametro \cs{frontcandidatesep}, il cui valore usuale \`e
% 3\unit{ex}; la si pu\`o modificare con un comando come
%\begin{verbatim}
%\Preambolo{\renewcommand{\frontcandidatesep}{1cm}}
%\end{verbatim}
% 
% \section{L'opzione \texttt{suftesi}}\label{suftesi}
%
% Ivan Valbusa ha creato la classe \pack{suftesi} e ha impostato una
% forma di frontespizio che usa questo pacchetto. Per migliorare la
% compatibilità, si è deciso di inserire nel pacchetto il codice della
% classe \pack{suftesi} relativo al frontespizio. Questa forma può
% essere usata indipendentemente dalla classe; non occorre altro che
% specificare l'opzione alla chiamata del pacchetto.
%
% Va però notato che questa forma di frontespizio è più rigida di
% quella standard, nel senso che non permette cambiamenti ai font
% usati, riguardo a grandezza e forma: prendere o lasciare. Il resto
% funziona (quasi) allo stesso modo. Si veda l'ultimo degli esempi.
% 
% Per questa forma di frontespizio è consigliata la presenza del logo,
% che però non è obbligatoria. Si noti che non ha alcuna rilevanza
% l'argomento opzionale dato a |\Logo|, che verrà sempre stampato con
% una dimensione fissa. Non si usi il comando |\Filigrana|, sebbene
% non sia vietato e si eviti l'uso di |\Margini|.  Con questa forma di
% frontespizio è possibile modificare il colore del titolo, che è
% usualmente un marroncino, agendo sul comando |\fronttitlecolor|
% esattamente come si farebbe per i font. Sono disponibili tutti i
% colori predefiniti con l'opzione \texttt{svgnames} di \pack{xcolor},
% meglio però non essere troppo fantasiosi: l'unica vera alternativa è
% scrivere
%\begin{verbatim}
%\Preambolo{\renewcommand{\fronttitlecolor}{black}}
%\end{verbatim}
%
%
%
% \section{\Xe\LaTeX}
% 
% \`E possibile usare \Xe\TeX{}, ovviamente nella forma \Xe\LaTeX, per 
% produrre il frontespizio. Ovviamente dovr\`a essere usato il comando 
% \cs{Preambolo} per impostare anche il documento~\file{frn} per 
% l'uso di questo motore \TeX. Per esempio, se il documento principale 
% \`e composto in ``Adobe Caslon~Pro'', si potr\`a scrivere
%\begin{verbatim}
%\begin{Preambolo*}
%\usepackage{fontspec}
%\setmainfont{Adobe Caslon Pro}
%\end{Preambolo*}
%\end{verbatim}
% Naturalmente \`e possibile compilare il \file{frn} anche usando
% \textsc{pdf}\LaTeX{} oppure \LaTeX{} e \textsc{dvips}.  Tuttavia si
% consiglia l'uniformit\`a fra il carattere usato nel testo e quello usato
% nel frontespizio, se non ci sono disposizioni particolari che
% richiedano diversamente.
% 
% Si ricordi che \Xe\TeX{} legge correttamente solo documenti scritti
% nelle codifiche \textsc{utf}-8 (oppure \textsc{utf}-16). Quindi se
% il documento principale \`e da compilare con \textsc{pdf}\LaTeX{} si
% dovr\`a caricare \pack{inputenc} con l'opzione \opt{utf8}, e questo
% \`e proprio un caso in cui potrebbe essere necessario passare al
% pacchetto \pack{frontespizio} l'opzione \pack{noinputenc}.
% 
% 
% \section{\LaTeX{}mk}
%
% È possibile automatizzare la creazione del frontespizio mediante lo
% \emph{script} \texttt{latexmk} (si ringrazia l'autore John Collins
% per i preziosi suggerimenti); si rimanda alla documentazione per
% capire come funziona lo script, qui si presuppone che lo si conosca
% già. Vediamo i vari casi: (1)~il~frontespizio è composto con
% \texttt{pdflatex}; (2)~il~frontespizio è composto con \texttt{latex}
% per ottenere in seguito un \textsc{eps}; (3)~il~frontespizio è
% composto con \texttt{xelatex}. In tutti i casi la compilazione va
% lanciata con
%\begin{flushleft}
%\texttt{latexmk} \meta{opzioni} \texttt{tesi}
%\end{flushleft}
% dove \meta{opzioni} sono le usuali che vengono date a
% \texttt{latexmk} e \file{tesi.tex} sta per il nome del nostro
% documento.
% 
% \subsection{\texttt{pdflatex}}
% Si crei il file \file{latexmkrc} che contenga il seguente codice:
%\begin{verbatim}
%add_cus_dep( "tex", "pdf", 0, "frn2pdf" );
%  sub frn2pdf { return system( "latexmk -pdf $_[0]" ); }
%\end{verbatim}
% Se già si usa un \file{latexmkrc} si aggiungano quelle due righe
% alla fine.
%
% \subsection{\texttt{latex} e \texttt{dvips}}
% Si crei il file \file{latexmkrc} che contenga il seguente codice:
%\begin{verbatim}
%add_cus_dep( "tex", "eps", 0, "frn2eps" );
%  sub frn2eps {
%    system( "latexmk -dvi -ps- -pdf- $_[0]" );
%    return system( "dvips -o $_[0].eps $_[0].dvi" );
%  }
%\end{verbatim}
% Se già si usa un \file{latexmkrc} si aggiungano quelle due righe
% alla fine.
%
% \subsection{\texttt{xelatex}}
% Si crei il file \file{latexmkrc} che contenga il seguente codice:
%\begin{verbatim}
%add_cus_dep( "tex", "pdf", 0, "frn2pdf" );
%  sub frn2pdf { return system( "xelatex $_[0]" ); }
%\end{verbatim}
% Se già si usa un \file{latexmkrc} si aggiungano quelle due righe
% alla fine.
%
%
% \section{Limitazioni e incompatibilit\`a}
% 
% Gli altri pacchetti caricati sono \pack{ifpdf}, \pack{graphicx},
% \pack{afterpage}, \pack{atbegshi} e \pack{ifxetex} che non hanno
% incompatibilit\`a note. Se si dovesse usare \pack{graphicx} con
% opzioni, per esempio con un \emph{driver} diverso da \texttt{dvips}
% o \texttt{pdftex}, va caricato \emph{prima} di \pack{frontespizio};
% ricordiamo che i due \emph{driver} menzionati non vanno dichiarati
% come opzione a \pack{graphicx}, perch\'e in mancanza di altre
% opzioni vengono scelti automaticamente dal compilatore.  Attenzione:
% usando \emph{Textures}, per esempio, va inserita anche l'opzione
% \opt{driver=textures} a \pack{frontespizio}.  Cambiare il nome del
% driver, se necessario.  Ovviamente si dovr\`a consultare il manuale
% della propria distribuzione per sapere come produrre il file eps in
% modo corretto.
%
% Il documento \file{frn} usa il pacchetto \pack{xcolor} con l'opzione
% \texttt{svgnames}. Non si carichi anche \pack{color} con |\Preambolo|.
%
% Si noti che il pacchetto non \`e compatibile con \pack{vmargin}; se
% si desidera modificare l'impostazione tipografica del documento, si
% usi \pack{geometry}, pi\`u potente e facile.
% 
% Il pacchetto è compatibile con le classi pi\`u diffuse:
% \pack{article}, \pack{report}, \pack{book}, \pack{amsart},
% \pack{amsbook} e, dalla versione 1.3, anche con
% \pack{memoir}. Funziona anche con \pack{scrbook} e \pack{scrreprt}.
%
% 
% \section{Novità nelle versioni successive alla prima}
%
% \paragraph{Versione 1.1}
% È stata introdotta l'opzione \opt{swapnames} per invertire l'ordine
% di relatori e candidato.
%
% \paragraph{Versione 1.2}
% Nella versione 1.2 sono state aggiunte le opzioni \opt{nouppercase}
% e \opt{noinputenc}; la prima serve per non trasformare in maiuscolo
% il nome della facolt\`a, la seconda per uno scopo un po' recondito
% che vedremo pi\`u avanti, legato al fatto che ora il pacchetto
% rispetta la codifica di input del documento principale anche nel
% documento~\file{frn}. È stato aggiunto anche l'ambiente
% \texttt{Preambolo*} per rendere più comoda la scrittura di comandi
% nel preambolo del documento~\file{frn}.
%
% \paragraph{Versione 1.3}
% Le sole modifiche sono la compatibilità con la classe \pack{memoir}
% e la scrittura di un messaggio informativo che rende possibile la
% cooperazione con \pack{latexmk}.
%
% \paragraph{Versione 1.4}
% Viene introdotta la nozione di \emph{forma} del frontespizio, con la
% possibilità di scegliere tra le opzioni \opt{standard} e
% \opt{suftesi}. Questo apre la possibilità di altri stili che
% potranno essere disponibili in versioni successive.
%
%
% \section{Soluzione del giochino}
% 
% L'etimologia di `Stanford' \`e `stan$+$ford'; l'antico inglese
% `stan' \`e ora `stone', cio\`e `pietra', mentre il toponimo `ford'
% indica un luogo di mercato.  Il cognome `Knuth' \`e di origine
% norvegese, affine a `Knudsen', e significa `nodo'.  Il nome `Donald'
% \`e di origine gaelica e vuol dire `reggitore del mondo', mentre
% `Basilio' viene dalla parola greca che significa~`re'.  Revinu Jitis
% Drofnats non ha bisogno di presentazioni nel mondo~\TeX.
% 
% 
% \section{Esempi}
% 
% Nelle pagine seguenti vedremo alcuni esempi con il sorgente.  I titoli
% delle tesi sono veri, manca solo l'indicazione dell'anno accademico,
% per evidenti motivi di \emph{privacy}.  Non sono stati messi `logo' di
% universit\`a per evitare problemi legali.
% 
% \clearpage
% 
% \iffalse
%<*examplea>
% \fi
% \begin{verbatim}
\documentclass[a4paper,titlepage]{book}
\usepackage{frontespizio}

\begin{document}
\begin{frontespizio}
\Universita{Padova}
\Facolta{Scienze Matematiche, Fisiche e Naturali}
\Corso[Laurea]{Matematica}
\Titoletto{Tesi di laurea}
\Titolo{Equivalenze fra categorie di moduli\\
e applicazioni}
\Candidato[145822]{Enrico Gregorio}
\Relatore{Ch.mo Prof.~Adalberto Orsatti}
\Annoaccademico{19??-19??}
\end{frontespizio}
\end{document}
% \end{verbatim}
% \iffalse
%</examplea>
% \fi
% 
% \vspace{4ex}
% 
% \includeex{examplea-frn}
% 
% \clearpage
% 
% \iffalse
%<*exampleb>
% \fi
% \begin{verbatim}
\documentclass[a4paper,titlepage]{book}
\usepackage[sans,nouppercase]{frontespizio}

\begin{document}
\begin{frontespizio}
\Universita{Padova}
\Facolta{Scienze Matematiche, Fisiche e Naturali}
\Corso[Laurea]{Matematica}
\Titoletto{Tesi di laurea}
\Titolo{Equivalenze fra categorie di moduli\\
e applicazioni}
\Candidato{Enrico Gregorio}
\Relatore{Ch.mo Prof.~Adalberto Orsatti}
\Annoaccademico{19??-19??}
\Rientro{1.5cm}
\NCandidato{Laureando}
\Punteggiatura{}
\end{frontespizio}
\end{document}
% \end{verbatim}
% \iffalse
%</exampleb>
% \fi
% 
% \vspace{4ex}
% 
% \includeex{exampleb-frn}
% 
% \clearpage
% 
% \iffalse
%<*examplec>
% \fi
% \begin{verbatim}
\documentclass[a4paper,titlepage]{book}
\usepackage[swapnames]{frontespizio}

\begin{document}
\begin{frontespizio}
\begin{Preambolo*}
  \usepackage{fourier}
  \newcommand{\compring}{anelli compatti}
\end{Preambolo*}
\Universita{Bologna}
\Dipartimento{Matematica}
\Corso[Dottorato di Ricerca]{Matematica}
\Titolo{Equivalenza di Morita generalizzata\\
  e applicazioni alla teoria degli\\
  \compring}
\Candidato{Enrico Gregorio}
\Relatore{Ch.mo Prof.~Ermanno Lanconelli}
\NRelatore{Coordinatore}{}
\Correlatore{Ch.mo Prof.~Adalberto Orsatti}
\NCorrelatore{Supervisore della ricerca}{}
\Annoaccademico{19??-19??}
\end{frontespizio}
\end{document}
% \end{verbatim}
% \iffalse
%</examplec>
% \fi
% 
% \vspace{4ex}
% 
% \includeex{examplec-frn}
% \newpage
% 
% \iffalse
%<*exampled>
% \fi
% \begin{verbatim}
\documentclass[a4paper,titlepage]{book}
\usepackage[nouppercase]{frontespizio}

\begin{document}
\begin{frontespizio}
\Istituzione{University of St.\ Anford}
\Divisione{Department of Typography}
\Scuola{Ph.D. degree in \TeX{} and \LaTeX{}}
\Titolo{How to prepare a\\
  formal frontispiece}
\Sottotitolo{Theory and practice}
\NCandidato{Candidate}
\Candidato{Enrico Gregorio}
\NRelatore{Thesis advisor}{}
\Relatore{Prof. R. J. Drofnats}
\NCorrelatore{Research supervisor}{Research supervisors}
\Correlatore{J. H. Quick}
\Correlatore{B. L. User}
\Piede{Thesis submitted in 2010}
\end{frontespizio}
\end{document}
% \end{verbatim}
% \iffalse
%</exampled>
% \fi
% 
% \vspace{4ex}
% 
% \includeex{exampled-frn}
% \newpage
%
% \iffalse
%<*fakelogo>
prologues:=3;
outputtemplate:="%j.mps";
input boxes;
beginfig(1);
draw fullcircle scaled (2.5cm + 1pt) withcolor white;
draw fullcircle scaled 2.5cm;
draw fullcircle scaled 2.3cm;
draw thelabel(btex \vbox{\sevenrm\halign{\hfil#\hfil\cr University of\cr
      St. Anford\cr Seal\cr}} etex, origin);
endfig;
end
%</fakelogo>
% \fi
% 
% \iffalse
%<*examplee>
% \fi
% \begin{verbatim}
\documentclass[a4paper,titlepage]{book}
\usepackage[suftesi]{frontespizio}

\begin{document}
\begin{frontespizio}
\Logo{fakelogo}
\Istituzione{University of St.\ Anford}
\Divisione{Department of Typography}
\Scuola{Ph.D. degree in \TeX{} and \LaTeX{}}
\Titolo{How to prepare a\\
  formal frontispiece}
\Sottotitolo{Theory and practice}
\NCandidato{Candidate}
\Candidato{Enrico Gregorio}
\NRelatore{Thesis advisor}{}
\Relatore{Prof. R. J. Drofnats}
\NCorrelatore{Research supervisor}{Research supervisors}
\Correlatore{J. H. Quick}
\Correlatore{B. L. User}
\Piede{Thesis submitted in 2010}
\end{frontespizio}
\end{document}
% \end{verbatim}
% \iffalse
%</examplee>
% \fi
% 
% \vspace{4ex}
% 
% \includeex{examplee-frn}
% \newpage
%
% \section{A shell script to compile the documentation}
% Running \texttt{latex} on \file{frontespizio.ins} produces also 
% \file{makedoc.sh} which can be run, on Unix systems, by one of the 
% following command from a shell:
% \begin{flushleft}\ttfamily
% sh makedoc.sh
% \end{flushleft}
% The shell script code is as follows.
% 
% \iffalse
%<*thedoc>
% \fi
% \begin{verbatim}
#!/bin/sh
pdflatex examplea.tex
pdflatex examplea-frn.tex
pdflatex exampleb.tex
pdflatex exampleb-frn.tex
pdflatex examplec.tex
pdflatex examplec-frn.tex
pdflatex exampled.tex
pdflatex exampled-frn.tex
mpost fakelogo.mp
epstopdf --hires fakelogo.mps
pdflatex examplee.tex
pdflatex examplee-frn.tex
pdflatex frontespizio.dtx
pdflatex frontespizio-frn.tex
makeindex -s gind frontespizio
makeindex -s gglo -o frontespizio.gls frontespizio.glo
pdflatex frontespizio.dtx
pdflatex frontespizio.dtx
exit
% \end{verbatim}
% \iffalse
%</thedoc>
% \fi
%
% \StopEventually{\PrintChanges\PrintIndex}
% \changes{v1.1}{2009/04/03}{Added swapnames option}
% \changes{v1.2}{2010/06/25}{Added noinputenc option}
% \changes{v1.2}{2010/06/25}{Added nouppercase option}
% \changes{v1.2}{2010/06/25}{Added `Preambolo*' environment}
% \changes{v1.2}{2010/06/25}{Various implementation changes}
% \changes{v1.3}{2011/03/08}{Added support for memoir}
% \selectlanguage{english}
% \section{The implementation}
% After the usual stuff of package presentation, here are the actual
% macros.  We use the $\varepsilon$-\TeX{} extensions, so we check
% that they are present.
% \iffalse
%<*package>
% \fi
%    \begin{macrocode}
\def\@not@eTeX{%
  \PackageError{frontespizio}
  {This package requires e-TeX, I'll stop right now}
  {This package is built on the e-TeX extensions which are not present.%
   \MessageBreak
   The best thing you can do is to upgrade your TeX system or try%
   \MessageBreak
   using `elatex' or `pdfelatex'.}%
    \expandafter\@@end}
\ifx\eTeXversion\@undefined
  \@not@eTeX
\else
  \let\@not@eTeX\@undefined
\fi
%    \end{macrocode}
% \subsection{Package options}
% Now we declare options and a conditional which is true when we write
% to the \file{frn} file: this is the file which will be compiled
% later in order to produce the pdf page that will be included as the
% frontispiece.  The option `infront' is a private one, which is set
% only in the \file{frn} file where the nowrite option is set, so we
% need a correction.  It's easier to use \cs{ifdefined} than to
% define many new conditionals. Actually, the package doesn't use 
% $\varepsilon$-\TeX{} features other than \cs{ifdefined} and
% \cs{unless}, but I wanted to try and encourage to upgrade from 
% old \TeX{} systems.
% 
% \begin{macro}{\iffront@write}
% The conditional \cs{iffront@write} is false when we don't want 
% to write the \file{frn} file.
% \end{macro}
% \begin{macro}{\front@infront}
% \cs{front@infront} is defined only if we are typesetting the
% \file{frn} file.
% \end{macro}
% \begin{macro}{\front@signatures}
% \cs{front@signatures} is defined if we need to leave space for 
% the advisor's signature.
% \end{macro}
% \begin{macro}{\front@noadvisor}
% \cs{front@noadvisor} is defined if we don't want an advisor's 
% name.
% \end{macro}
% \begin{macro}{\front@swapnames}
% \changes{v1.1}{2009/04/03}{Added macro \cs{front@swapnames} and
%                            option \texttt{swapnames}}
% \cs{front@swapnames} is defined if we want to swap the advisor's
% and candidate's fields.
% \end{macro}
% \begin{macro}{\front@thefont}
% \begin{macro}{\fontoptionnormal}
% \begin{macro}{\fontoptionsans}
% The options `normal' and `sans' are an elementary way to control 
% the font choice for the frontispiece.
% \end{macro}
% \end{macro}
% \end{macro}
% \begin{macro}{\front@norules}
% \cs{front@norules} is defined if we don't want rules in the 
% frontispiece.
% \end{macro}
% \begin{macro}{\front@nouppercase}
% \changes{v1.2}{2010/06/25}{Added macro \cs{front@nouppercase} and
%                            option \texttt{nouppercase}}
% \cs{front@nouppercase} is defined if we don't want to capitalize
% the faculty line.
% \end{macro}
% \begin{macro}{\front@noinputenc}
% \changes{v1.2}{2010/06/25}{Added macro \cs{front@noinputenc} and
%                            option \texttt{noinputenc}}
% \cs{front@nouppercase} is defined if we don't want to export the
% option to \pack{inputenc} to the \file{frn}~file.
% \end{macro}
% \begin{macro}{\iffront@include}
% \cs{iffront@include} controls whether we use the package only in 
% order to include an external file (similarly to pdfpages).
% \end{macro}
% \begin{macro}{\front@otheroptions}
% \changes{v1.4}{2011/07/18}{Added options \texttt{standard} and
%   \texttt{suftesi}}
% \changes{v1.4}{2011/07/18}{Added command \cs{fronttitlecolor} for suftesi}
% \changes{v1.2}{2010/06/25}{Added macro \cs{front@otheroptions}}
% \changes{v1.2}{2010/06/25}{Deleted macro \cs{front@grfdriver}}
% In \cs{front@otheroptions} we load the all other options, to be
% processed by \pack{keyval}.
% \end{macro}
%    \begin{macrocode}
\newif\iffront@write
\DeclareOption{write}{\front@writetrue}
\DeclareOption{nowrite}{\front@writefalse}
\DeclareOption{infront}{\let\front@infront=T}
\DeclareOption{signatures}{\let\front@signatures=T}
\DeclareOption{noadvisor}{\let\front@noadvisor=T}
\DeclareOption{swapnames}{\let\front@swapnames=T}
\DeclareOption{normal}{\def\front@thefont{\fontoptionnormal}}
\DeclareOption{sans}{\def\front@thefont{\fontoptionsans}}
\DeclareOption{norules}{\let\front@norules=T}
\DeclareOption{nouppercase}{\let\front@nouppercase=T}
\DeclareOption{noinputenc}{\let\front@noinputenc=T}
\DeclareOption{standard}{\def\front@shape{standard}}
\DeclareOption{suftesi}{\def\front@shape{suftesi}\def\fronttitlecolor{Maroon}}
%
\newif\iffront@include
\DeclareOption{onlyinclude}{\front@includetrue\ExecuteOptions{nowrite}}
\let\front@otheroptions\@empty
\DeclareOption*{\expandafter\g@addto@macro\expandafter\front@otheroptions
  \expandafter{\CurrentOption,}}
%    \end{macrocode}
% Now we choose the default options; we want to write the \file{frn} file
% and roman fonts.
%    \begin{macrocode}
\ExecuteOptions{write,normal,standard}
\ProcessOptions\relax
%    \end{macrocode}
% \subsection{Required packages and service macros}
% We load the needed packages.  Of course \pack{graphicx} and
% \pack{atbegshi} for graphic inclusion; we need also \pack{afterpage} 
% for adjustments when using some classes.
% \changes{v1.2}{2010/06/25}{Changed from \pack{eso-pic} to \pack{atbegshi}}
% \changes{v1.2}{2010/06/25}{We load also \pack{environ}}
%    \begin{macrocode}
\RequirePackage{afterpage}
\RequirePackage{graphicx}
\RequirePackage{atbegshi}
\RequirePackage{environ}
%    \end{macrocode}
% \begin{macro}{\includefront}
% We manage first the onlyinclude option.  If we are only including an
% external file, we load it and prepare for an empty verso page; the
% optional argument is there in order to correct the page number, if
% necessary; after that we stop reading the package. If a
% \env{frontespizio} environment is present, it's ignored after
% raising a warning, via \pack{environ}'s \cs{Collect@Body}.
% \changes{v1.2}{2010/06/25}{\cs{includefront} now depends on \pack{atbegshi}}
%    \begin{macrocode}
\iffront@include
\newcommand{\includefront}[2][0]{%
  \titlepage\null
    \AtBeginShipoutNext{\AtBeginShipoutUpperLeft{% 
      \vbox to\z@{\hbox{\includegraphics{#2}}\vss}}}
    \afterpage{\thispagestyle{empty}}%
  \endtitlepage
  \ifx0#1\else
    \null\thispagestyle{empty}\newpage\addtocounter{page}{-#1}%
  \fi}
  \newenvironment{frontespizio}{%
    \PackageWarningNoLine{frontespizio}
    {Using the `frontespizio' environment along with%
     \MessageBreak
     the `onlyinclude' option is meaningless. The%
     \MessageBreak
     environment's content will be ignored}
     \Collect@Body\@gobble}{}
\expandafter\endinput
\else
%    \end{macrocode}
% \end{macro}
% If the `onlyinclude' option is not given we can be in different 
% situations: first of all we load support for distinguishing whether 
% the user is typesetting with \texttt{latex}, \texttt{pdflatex} or 
% \texttt{xelatex}.
%    \begin{macrocode}
\RequirePackage{ifpdf}
%    \end{macrocode}
% We want to support also \Xe\LaTeX{}.
% \changes{v1.2}{2010/06/25}{Package \pack{ifxetex} is required}
%    \begin{macrocode}
\RequirePackage{ifxetex}
\fi
%    \end{macrocode}
% \begin{macro}{\front@write}
% \begin{macro}{\front@expwrite}
% If we are writing the \file{frn} file, we allocate an output stream,
% otherwise we let \cs{front@write} and \cs{front@expwrite} to
% gobble their argument; \cs{front@write} is used to write things
% without expansion while \cs{front@expwrite} expands tokens in the
% argument. We now use, if available, the \cs{pdfmdfivesum} facility
% of \textsc{pdf}\TeX, in order to tell the user if the \file{frn}
% file has changed.
% \end{macro}
% \end{macro}
%    \begin{macrocode}
\iffront@write
  \ifdefined\pdfmdfivesum
    \IfFileExists{\jobname-frn.tex}{%
      \xdef\front@mdfiveold{\pdfmdfivesum file{\jobname-frn.tex}}}{}%
  \fi
  \newwrite\front@out
  \immediate\openout\front@out=\jobname-frn.tex
  \long\def\front@write#1{\immediate\write\front@out{\unexpanded{#1}}}
  \long\def\front@expwrite{\immediate\write\front@out}
\else
  \long\def\front@write#1{}
  \let\front@expwrite\front@write
\fi
%    \end{macrocode}
% \subsection{Initialization of the \file{frn} file}
% Now we initialize the \file{frn} file by setting the class and the
% margins.  If a driver option has been given we want to load
% \pack{graphicx} in the \file{frn} file with the right driver; we have to do
% this before loading the present package, which always requires
% \pack{graphicx}. Meanwhile, we load also the \pack{inputenc}
% package with the same options given in the main document; this can
% be overrided with the \opt{noinputenc} package option. Nothing is
% done if \pack{inputenc} is not loaded in the document.
% \changes{v1.3a}{2011/03/08}{Added info message in the \file{frn} file}
%    \begin{macrocode}
\front@expwrite{\@percentchar\@percentchar\space This file has been
  automatically generated by `frontespizio'.}
\front@expwrite{\@percentchar\@percentchar\space Don't use it as a model for a
  new frontispiece, use the}
\front@expwrite{\@percentchar\@percentchar\space `frontespizio'
  environment in you document instead.}
\front@write{\documentclass[titlepage]{article}}
\ifdefined\front@noinputenc\else
  \ifdefined\inputencodingname
    \front@expwrite{\string\usepackage[\inputencodingname]{inputenc}}
  \fi
\fi
%    \end{macrocode}
% Now we define the standard margins for the two shapes; in case we
% add other shapes, something should be done here.
% \changes{v1.4}{2011/07/18}{Adapted the writing of parameters for
%   geometry for the new shape options}
%    \begin{macrocode}
\def\front@geometry@standard{%
  \front@write{\usepackage[a4paper,left=1cm,bottom=1.5cm,%
    right=1cm,top=1cm]{geometry}}}
\def\front@geometry@suftesi{%
  \front@write{\usepackage[a4paper,textwidth=312pt,includehead,%
    textheight=624pt,right=90pt,vmarginratio=1:2]{geometry}}}
\@nameuse{front@geometry@\front@shape}
%    \end{macrocode}
% \begin{macro}{\front@processkeys}
% If the user has specified an unusual driver for \pack{graphicx}, we
% manage it with \pack{keyval}; otherwise we load the package without
% options, in a group because we redefine locally \cs{KV@errx} to be more
% informative; also the key(s) will be defined only locally, as well
% as \cs{front@processkeys}.
%    \begin{macrocode}
\ifx\front@otheroptions\@empty
  \front@write{\usepackage{graphicx}}
  \front@write{\usepackage[svgnames]{xcolor}}
\else
  \begingroup
 \def\KV@errx#1{%
    \PackageError{frontespizio}{Key #1}
      {The only allowed key is `driver'; the given key will be ignored.%
       \MessageBreak Type \space<return> \space to proceed.}}
  \define@key{front}{driver}{\front@write{\usepackage[#1]{graphicx}}%
                             \front@write{\usepackage[#1,svgnames]{xcolor}}}
  \edef\front@processkeys{\noexpand\setkeys{front}{\front@otheroptions}}
  \front@processkeys
  \endgroup
\fi
%    \end{macrocode}
% \end{macro}
% Set the options in the \file{frn} file: there we don't want to be
% writing the \file{frn} file, of course, nor we need aux files, but
% we add the private option.
% \changes{v1.4}{2011/07/18}{We write also the shape option to the \file{frn} file}
%    \begin{macrocode}
\edef\front@theoptions{nowrite,infront,\front@shape}
\ifdefined\front@signatures
  \g@addto@macro\front@theoptions{,signatures}
\fi
\ifdefined\front@noadvisor
  \g@addto@macro\front@theoptions{,noadvisor}
\fi
\ifdefined\front@swapnames
  \g@addto@macro\front@theoptions{,swapnames}
\fi
\ifdefined\front@norules
  \g@addto@macro\front@theoptions{,norules}
\fi
\ifdefined\front@nouppercase
  \g@addto@macro\front@theoptions{,nouppercase}
\fi
\front@expwrite{\string\usepackage[\front@theoptions]{frontespizio}}
\front@write{\nofiles}
%    \end{macrocode}
% Write in the \file{frn} file the font choosing command; here we need only 
% a one level expansion.
%    \begin{macrocode}
\expandafter\front@write\expandafter{\front@thefont}
%    \end{macrocode}
% \subsection{Commands, conditionals and registers}
% The following commands are necessary only when we are compiling 
% the frontispiece, when the \cs{front@infront} command is defined.
%    \begin{macrocode}
\ifdefined\front@infront
\def\fontoptionnormal{%
  \let\front@font\normalfont \let\front@scfont\scshape}
\def\fontoptionsans{%
  \let\front@font\sffamily \let\front@scfont\upshape}
\def\front@push{}
\def\front@thecandidate{Candidato}
\def\front@thecandidates{Candidati}
\def\front@theadvisor{Relatore}
\def\front@theadvisors{Relatori}
\def\front@thecoadvisor{Correlatore}
\def\front@thecoadvisors{Correlatori}
\def\front@punct{:}
\newif\iffront@titoletto
\newif\iffront@matr
\newif\iffront@onecand
\newif\iffront@morecand
\newif\iffront@correl
\newif\iffront@logo
\newif\iffront@inst
\newif\iffront@sottotit
\newif\iffront@multiple
\newif\iffront@division
\newif\iffront@school
\newif\iffront@foot
\newtoks\front@candtoks
\newcount\front@candcount
\newtoks\front@reltoks
\newcount\front@relcount
\newtoks\front@correltoks
\newcount\front@correlcount
\fi
%    \end{macrocode}
% We need a macro to hide the conditionals, which we load and define
% only when making the front page; the \cs{if} conditional will
% always expand to nothing or be skipped altogether up to the matching
% \cs{fi} when writing the \file{frn} file; if expanded, however,
% it will put in the correct conditional when making the front page.
%    \begin{macrocode}
\def\@front@#1{TT\fi\@nameuse{iffront@#1}}
%    \end{macrocode}
% Now we define the markup commands. We do this three times, because 
% they will behave differently in different conditions.
%    \begin{macrocode}
\iffront@write
%    \end{macrocode}
% \changes{v1.2}{2010/06/25}{Added the \texttt{Preambolo*} environment}
% If we are writing the \file{frn} file, then we simply copy the
% commands to it.  An exception is \cs{Preambolo}: in this case we
% copy only its argument. The same is with the |Preambolo*|
% environment, using \cs{Collect@Body}; the category code changes are
% made because we want to preserve newlines in the input.  Since there
% can be several candidate names, the \cs{Candidato} macro is treated
% differently, because it can have an optional argument.
%    \begin{macrocode}
\newcommand{\Preambolo}[1]{\front@write{#1}}
\newenvironment{Preambolo*}
  {\@makeother\%\@makeother\^^M\newlinechar=`\^^M
   \Collect@Body\front@write}{}
\newcommand{\Rientro}[1]{\front@write{\Rientro{#1}}}
\newcommand{\Margini}[4]{\front@write{\Margini{#1}{#2}{#3}{#4}}}
\newcommand{\Logo}[2][1.5cm]{\front@write{\Logo[#1]{#2}}}
\newcommand{\Filigrana}[2][height=10cm]{%
  \front@write{\Filigrana[#1]{#2}}}
\newcommand{\Universita}[1]{\front@write{\Universita{#1}}}
\newcommand{\Istituzione}[1]{\front@write{\Istituzione{#1}}}
\newcommand{\Facolta}[1]{\front@write{\Facolta{#1}}}
\newcommand{\Dipartimento}[1]{\front@write{\Dipartimento{#1}}}
\newcommand{\Divisione}[1]{\front@write{\Divisione{#1}}}
\newcommand{\Interfacolta}[1]{\front@write{\Interfacolta{#1}}}
\newcommand{\Corso}[2][Laurea Magistrale]{\front@write{\Corso[#1]{#2}}}
\newcommand{\Scuola}[1]{\front@write{\Scuola{#1}}}
\newcommand{\Titolo}[1]{\front@write{\Titolo{#1}}}
\newcommand{\Sottotitolo}[1]{\front@write{\Sottotitolo{#1}}}
\newcommand{\Annoaccademico}[1]{\front@write{\Annoaccademico{#1}}}
\newcommand{\Piede}[1]{\front@write{\Piede{#1}}}
\newcommand{\Titoletto}[1]{\front@write{\Titoletto{#1}}}
\newcommand{\Candidato}[2][]{%
  \def\next{#1}%
  \ifx\next\@empty
    \front@write{\Candidato{#2}}%
  \else
    \front@write{\Candidato[#1]{#2}}%
  \fi}
\newcommand{\Relatore}[1]{\front@write{\Relatore{#1}}}
\newcommand{\Correlatore}[1]{\front@write{\Correlatore{#1}}}
\newcommand{\NCandidato}[1]{\front@write{\NCandidato{#1}}}
\newcommand{\NCandidati}[1]{\front@write{\NCandidati{#1}}}
\newcommand{\NRelatore}[2]{\front@write{\NRelatore{#1}{#2}}}
\newcommand{\NCorrelatore}[2]{\front@write{\NCorrelatore{#1}{#2}}}
\newcommand{\Punteggiatura}[1]{\front@write{\Punteggiatura{#1}}}
%    \end{macrocode}
% Now some equivalent commands for backwards compatibility with the
% preproduction version called \pack{front-th}. Unfortunately, the old 
% command \cs{Matricola} cannot be made compatible.
%    \begin{macrocode}
\def\front@oldcommand#1#2{\def#1{\PackageWarning{frontespizio}
  {Old command \string#1 found; use \string#2}#2}}
\front@oldcommand\IlCandidato\Candidato
\front@oldcommand\Package\Preambolo
\front@oldcommand\MoreMargin\Rientro
\front@oldcommand\Margins\Margini
% Sorry, \Matricola cannot be used any more
\def\Matricola#1{\PackageError{frontespizio}
  {Old command \noexpand\Matricola found}
  {The command \noexpand\Matricola cannot be used with this package.%
   \MessageBreak Use the optional argument to \string\Candidato}}
%
\else\ifdefined\front@infront
%    \end{macrocode}
% If we are typesetting the front page, then we give the commands 
% their real meaning, i.e., we define macros which will be used in 
% \cs{preparefrontpage...}.
%    \begin{macrocode}
\newcommand{\Rientro}[1]{\def\front@push{\hspace{#1}}}
\newcommand{\Margini}[4]{\geometry{left=#1,bottom=#2,right=#3,top=#4}}
\newcommand{\Logo}[2][1.5cm]{\def\front@logo{#2}%
  \def\front@logosize{#1}\front@logotrue}
%    \end{macrocode}
% We support a centered logo in the background, using xkeyval.
% \changes{v1.2}{2010/06/25}{Changed \cs{Filigrana} definition}
%    \begin{macrocode}
\def\front@logobefore{1}\def\front@logoafter{1} % default values
\define@key{filigrana}{height}[10cm]{\def\front@logoheight{#1}}
\define@key{filigrana}{before}[1]{\def\front@logobefore{#1}}
\define@key{filigrana}{after}[1]{\def\front@logoafter{#1}}
\newcommand{\Filigrana}[2][height=10cm]{%
  \setkeys{filigrana}{#1}%
    \AtBeginShipoutNext{\AtBeginShipoutUpperLeft{% 
      \vtop to\paperheight{\hsize=\paperwidth
        \vspace*{\stretch{\front@logobefore}}
        \centering
        \includegraphics[height=\front@logoheight]{#2}
        \vspace{\stretch{\front@logoafter}}
}}}}
%    \end{macrocode}
% Now we continue the definition of the markup commands, mostly 
% passing their arguments to the internal macros; in some cases we 
% need more work, using token lists.
%    \begin{macrocode}
\newcommand{\Universita}[1]{\def\front@univ{#1}}
\newcommand{\Istituzione}[1]{\def\front@instit{#1}\front@insttrue}
\newcommand{\Facolta}[1]{\def\front@facoldip{#1}%
  \def\front@thefacoldip{Facolt\`a}}
\newcommand{\Dipartimento}[1]{\def\front@facoldip{#1}%
  \def\front@thefacoldip{Dipartimento}}
\newcommand{\Interfacolta}[1]{%
  \def\front@multiple{#1}\front@multipletrue}
\newcommand{\Divisione}[1]{\def\front@division{#1}\front@divisiontrue}
\newcommand{\Corso}[2][Laurea Magistrale]{%
  \def\front@cl{#1\unskip\space in #2}}
\newcommand{\Scuola}[1]{\def\front@school{#1}\front@schooltrue}
\newcommand{\Titolo}[1]{\def\front@title{#1}}
\newcommand{\Sottotitolo}[1]{\def\front@subtitle{#1}\front@sottotittrue}
\newcommand{\Annoaccademico}[1]{\def\front@anno{#1}}
\newcommand{\Piede}[1]{\def\front@foot{#1}\front@foottrue}
\newcommand{\Titoletto}[1]{\def\front@titoletto{#1}\front@titolettotrue}
\newcommand{\Candidato}[2][]{\advance\front@candcount\@ne
  \front@candtoks=\expandafter{\the\front@candtoks
    \front@docand{#1}{#2}}%
  \def\front@cand{#2}%
  \def\next{#1}%
  \ifx\next\@empty\else\def\front@matr{#1}\front@matrtrue\fi
}
\newcommand{\Relatore}[1]{\advance\front@relcount\@ne 
  \front@reltoks=\expandafter{\the\front@reltoks\\#1%
   \ifdefined\front@signatures\\[1cm]\fi}}
\newcommand{\Correlatore}[1]{%
  \front@correltrue\advance\front@correlcount\@ne
  \front@correltoks=\expandafter{\the\front@correltoks\\#1}}
\newcommand{\NCandidato}[1]{\def\front@thecandidate{#1}}
\newcommand{\NCandidati}[1]{\def\front@thecandidates{#1}}
\newcommand{\NRelatore}[2]{\def\front@theadvisor{#1}%
  \def\front@theadvisors{#2}}
\newcommand{\NCorrelatore}[2]{\def\front@thecoadvisor{#1}%
  \def\front@thecoadvisors{#2}}
\newcommand{\Punteggiatura}[1]{\def\front@punct{#1}}
%    \end{macrocode}
% Now we set the default fonts for the various parts of the 
% frontispiece.
% \begin{macro}{\frontinstitutionfont}
% \begin{macro}{\frontdivisionfont}
% \begin{macro}{\frontpretitlefont}
% \begin{macro}{\fronttitlefont}
% \begin{macro}{\frontsubtitlefont}
% \begin{macro}{\frontnamesfont}
% \begin{macro}{\frontsmallfont}
% \begin{macro}{\frontfootfont}
% \begin{macro}{\frontfixednamesfont}
%    \begin{macrocode}
\def\frontinstitutionfont{\fontsize{14}{17}\bfseries}
\def\frontdivisionfont{\fontsize{12}{16}\selectfont}
\def\frontpretitlefont{\fontsize{10}{12}\front@scfont}
\def\fronttitlefont{\fontsize{17}{21}\bfseries}
\def\frontsubtitlefont{\fontsize{12}{14}\selectfont}
\def\frontnamesfont{\fontsize{12}{14}\bfseries}
\def\frontsmallfont{\fontsize{9}{11}\selectfont}
\def\frontfootfont{\fontsize{12}{14}\bfseries}
\def\frontfixednamesfont{\normalfont\normalsize\front@font}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \begin{macro}{\frontcandidatesep}
% \begin{macro}{\frontrelcorrelsep}
% \begin{macro}{\frontlogosep}
% \begin{macro}{\frontadjustforsignatures}
% Some pseudo-parameters: the first is to separate candidates' names;
% the second to separate `Relatore' and `Correlatore' fields; the
% third to separate the logo from the University name; the fourth to
% adjust the `candidate-advisor' field in case there are many advisors
% and coadvisors and the "signature" option is in force.
%    \begin{macrocode}
\def\frontcandidatesep{3ex}
\def\frontrelcorrelsep{1ex}
\def\frontlogosep{6pt}
\def\frontadjustforsignatures{0pt}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% The command to typeset more than one candidate.
%    \begin{macrocode}
\def\front@docand#1#2{%
  #2\\% the candidate's name
  \def\next{#1}%
  \unless\ifx\next\@empty
    \frontsmallfont {Matricola }#1\\[\frontcandidatesep]
  \fi}
%    \end{macrocode}
% \begin{macro}{\front@MakeUppercase}
% \changes{v1.2}{2010/06/25}{Added option \opt{nouppercase}}
% We define \cs{front@MakeUppercase} to be \cs{MakeUppercase} unless
% \opt{nouppercase} has been specified, otherwise it does nothing.
%    \begin{macrocode}
\ifdefined\front@nouppercase
  \let\front@MakeUppercase\@firstofone
\else
  \let\front@MakeUppercase\MakeUppercase
  \fi
%    \end{macrocode}
% \end{macro}
% 
% \subsection{The typesetting}
% \changes{v1.4}{2011/07/18}{The command written in the \file{frn} file
%   depends now on the shape option}
% \begin{macro}{\preparefrontpagestandard}
% \changes{v1.4}{2011/07/18}{Added `standard' shape}
% Here is where the typesetting is defined.
%    \begin{macrocode}
\def\preparefrontpagestandard{%
\titlepage\front@font
\centering
\par
%    \end{macrocode}
% \end{macro}
% First block: the institution's logo.
%    \begin{macrocode}
\if\@front@{logo}
\includegraphics[height=\front@logosize]{\front@logo}\par
\vspace{\frontlogosep}
\fi
\par
%    \end{macrocode}
% Second block: the institution's name.
%    \begin{macrocode}
{\frontinstitutionfont
\if\@front@{inst}
  \front@instit
\else
  Universit\`a degli Studi di \front@univ
\fi\par}
\vspace{1.5ex}
\unless\ifdefined\front@norules\hrule\fi
\vspace{1.5ex}
%    \end{macrocode}
% Third block: the department's name; in Italy graduation theses are
% responsibility of Faculties, only Ph.D. theses are responsibility of
% Departments.
% \changes{v1.2}{2010/06/25}{Use \cs{front@MakeUppercase}}
%    \begin{macrocode}
{\frontdivisionfont
\if\@front@{multiple}
  \front@multiple
\else
  \if\@front@{division}
    \front@MakeUppercase{\front@division}
  \else
    \front@MakeUppercase{\front@thefacoldip\space di \front@facoldip}
  \fi
\fi\\
\if\@front@{school}
  \front@school
\else
  Corso di \front@cl
\fi
\par}
%    \end{macrocode}
% Fourth block: the specification of the thesis' kind.
%    \begin{macrocode}
\if\@front@{titoletto}
\vspace{2cm}
{\frontpretitlefont\front@titoletto\par}
\fi
\vspace{\fill}
%    \end{macrocode}
% Fifth block: the thesis' title.
%    \begin{macrocode}
{\fronttitlefont\front@title\par}
%    \end{macrocode}
% Sixth block: the thesis' subtitle, if present.
%    \begin{macrocode}
\if\@front@{sottotit}
\vspace{4ex}
{\frontsubtitlefont\front@subtitle\par}
\fi
\vspace{\fill}
%    \end{macrocode}

% Seventh block: the candidate's name and the advisor's name.  A
% \texttt{tabular*} spanning all the text width has two columns; on
% the left we put the candidate's name, on the right the advisor's
% name (possibly more than one) and, if present, the coadvisor's name.
% It the option `swapnames' has been given, the two columns are exchanged.
% \changes{v1.1}{2009/04/03}{Added \cs{front@makecandidates}}
% \changes{v1.1}{2009/04/03}{Added \cs{front@@makeadvisors}}
%    \begin{macrocode}
\def\front@makecandidates{%
  \begin{tabular}[t]{@{}l@{}}
  \relax\ifnum\front@candcount<1
    \PackageWarningNoLine{frontespizio}{Missing candidate name}%
  \else
    \frontfixednamesfont
    \ifnum\front@candcount=1
      \front@thecandidate
    \else
      \front@thecandidates
    \fi
    \front@punct\\
    \the\front@candtoks
  \fi
  \end{tabular}}
\def\front@makeadvisors{%
  \unless\ifdefined\front@noadvisor
    \begin{tabular}[t]{@{}l@{}}
    \relax
    \ifcase\front@relcount
      \PackageWarningNoLine{frontespizio}{Missing advisor name}%
    \or
      \frontfixednamesfont\front@theadvisor\front@punct
    \else
      \frontfixednamesfont\front@theadvisors\front@punct
    \fi
    \the\front@reltoks
    \if\@front@{correl}
      \\[\frontrelcorrelsep]
      \ifcase\front@correlcount\or
        \frontfixednamesfont\front@thecoadvisor\front@punct
      \else
        \frontfixednamesfont\front@thecoadvisors\front@punct
      \fi
    \the\front@correltoks
    \fi
    \end{tabular}
  \fi}
\vbox to .3\textheight{\parindent\z@
\frontnamesfont
\ifdefined\front@swapnames
  \begin{tabular*}{\textwidth}
    {@{\front@push}l@{\extracolsep{\fill}}l@{\front@push}}
  \front@makeadvisors&\front@makecandidates
  \end{tabular*}
\else
  \begin{tabular*}{\textwidth}
    {@{\front@push}l@{\extracolsep{\fill}}l@{\front@push}}
  \front@makecandidates&\front@makeadvisors
  \end{tabular*}
\fi
\par
\vfill}
%    \end{macrocode}
% Eighth block: the foot. Before setting it we do, if necessary, a 
% vertical negative skip.
%    \begin{macrocode}
\ifdefined\front@signatures\vskip\frontadjustforsignatures\fi
\unless\ifdefined\front@norules\hrule\fi
\vspace{1.5ex}
{\frontfootfont
 \if\@front@{foot}
   \front@foot
 \else
   Anno Accademico \front@anno
 \fi
 \par}
\endtitlepage}
%    \end{macrocode}
% \begin{macro}{\preparefrontpagesuftesi}
% \changes{v1.4}{2011/07/18}{Added suftesi shape}
% This shape is due to Ivan Valbusa, who created it for his class
% \pack{suftesi}. First of all we do some initialization, this
% shape is more rigid than the standard one.
%    \begin{macrocode}
\def\preparefrontpagesuftesi{%
  \titlepage\front@font
  \renewcommand{\frontinstitutionfont}{\normalfont}
  \renewcommand{\frontdivisionfont}{\large}
  \renewcommand{\frontpretitlefont}{\normalsize\sffamily}
  \renewcommand{\fronttitlefont}{\huge\sffamily}
  \renewcommand{\frontsubtitlefont}{\normalsize\sffamily}
  \renewcommand{\frontnamesfont}{\normalfont}
  \renewcommand{\frontfixednamesfont}{\normalsize\sffamily}
  \renewcommand{\frontfootfont}{\normalfont}
%    \end{macrocode}
% The paragraph indentation is zero.
%    \begin{macrocode}
  \parindent\z@
%    \end{macrocode}
% First block: logo and institutions
%    \begin{macrocode}
  \makebox[\textwidth][r]{%
  \begin{minipage}{6pc}
    \if\@front@{logo}
      {\includegraphics[height=\textwidth]{\front@logo}}
    \else
      \hspace*{\textwidth}
    \fi
  \end{minipage}%
  \hspace{2.5pc}%
  \begin{minipage}{\dimexpr\textwidth-4pc\relax}
  \frontinstitutionfont
  \if\@front@{inst}
    \front@instit
  \else
    Universit\`a degli Studi di \front@univ
  \fi\par
  \frontdivisionfont
  \if\@front@{multiple}
    \front@multiple
  \else
    \if\@front@{division}
      \front@division
    \else
      \front@thefacoldip\ di \front@facoldip
    \fi
  \fi\par
  \frontinstitutionfont
  \vskip1ex\hrule\vskip1.2ex
  \if\@front@{school}
    \front@school
  \else
    Corso di \front@cl
  \fi\par
  \end{minipage}\hspace*{4pc}}\par
  \vspace{\stretch{5}}
%    \end{macrocode}
% Second block: the specification of the thesis' kind.
%    \begin{macrocode}
  \if\@front@{titoletto}
    {\frontpretitlefont\front@titoletto\par}
  \fi
  \vspace{\stretch{2}}
%    \end{macrocode}
% Third block: the title and subtitle.
%    \begin{macrocode}
  {\fronttitlefont\color{\fronttitlecolor}\front@title\par}
  \if\@front@{sottotit}
    \vspace{4ex}
    {\frontsubtitlefont\front@subtitle\par}
  \fi
  \vspace{\stretch{3}}
%    \end{macrocode}
% We set up the block for the candidate's name (or candidates' names).
%    \begin{macrocode}
  \def\front@makecandidates{%
    \begin{tabular}[t]{@{}l}
    \relax\ifnum\front@candcount<1
      \PackageWarningNoLine{frontespizio}{Missing candidate name}%
    \else
      \frontfixednamesfont
      \ifnum\front@candcount=1
        \front@thecandidate
      \else
        \front@thecandidates
      \fi
      \front@punct\\
      \the\front@candtoks
    \fi
    \end{tabular}
  }
%    \end{macrocode}
% We set up the block for advisors and coadvisors.
%    \begin{macrocode}
  \def\front@makeadvisors{%
    \unless\ifdefined\front@noadvisor
      \begin{tabular}[t]{@{}l}
      \relax
      \ifcase\front@relcount
        \PackageWarningNoLine{frontespizio}{Missing advisor name}%
      \or
        \frontfixednamesfont\front@theadvisor\front@punct
      \else
        \frontfixednamesfont\front@theadvisors\front@punct
      \fi
      \the\front@reltoks
      \if\@front@{correl}
        \\[\frontrelcorrelsep]
        \ifcase\front@correlcount\or
          \frontfixednamesfont\front@thecoadvisor\front@punct
        \else
          \frontfixednamesfont\front@thecoadvisors\front@punct
        \fi
        \the\front@correltoks
      \fi
      \end{tabular}
    \fi}
  \vspace{\stretch{1}}
%    \end{macrocode}
% Third block: candidate and advisors.
%    \begin{macrocode}
  \frontnamesfont
  \ifdefined\front@swapnames% relatori candidati
    \front@makeadvisors\par
    \vspace{3ex}
    \front@makecandidates\par
  \else% candidati relatori
    \front@makecandidates\par
    \vspace{3ex}
    \front@makeadvisors\par
  \fi
  \vfill
  \ifdefined\front@signatures\vskip\frontadjustforsignatures\fi
  \unless\ifdefined\front@norules\fi
  \vspace{\stretch{5}}
%    \end{macrocode}
% Fourth block: academic year
%    \begin{macrocode}
  \frontfootfont
  \if\@front@{foot}
    \front@foot
  \else
    Anno Accademico \front@anno
  \fi
  \par
%    \end{macrocode}
% Now we close the title page.
%    \begin{macrocode}
\endtitlepage}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\preparefrontpage}
% \changes{v1.4}{2011/07/18}{Old macro \cs{preparefrontpage} is kept
%   for compatibility}
% For compatibility with old \file{frn} files, we define also the old macro
%    \begin{macrocode}
\let\preparefrontpage\preparefrontpagestandard
%    \end{macrocode}
% \end{macro}
%
% The following \cs{else} matches the |\ifdefined\front@infront|
% several lines ahead
%    \begin{macrocode}
\else
%    \end{macrocode}
% If we get here, we are neither compiling the frontispiece, nor
% writing to the \file{frn} file, so we provide dummy definitions for
% all the user level commands.
% \changes{v1.4}{2011/07/18}{Added missing definition for \texttt{Preambolo*}}
%    \begin{macrocode}
\newenvironment{Preambolo*}{\Collect@Body\@gobble}{}
\newcommand{\Preambolo}[1]{}
\newcommand{\Rientro}[1]{}
\newcommand{\Margini}[4]{}
\newcommand{\Logo}[2][]{}
\newcommand{\Filigrana}[2][]{}
\newcommand{\Universita}[1]{}
\newcommand{\Istituzione}[1]{}
\newcommand{\Facolta}[1]{}
\newcommand{\Dipartimento}[1]{}
\newcommand{\Interfacolta}[1]{}
\newcommand{\Divisione}[1]{}
\newcommand{\Corso}[2][]{}
\newcommand{\Scuola}[1]{}
\newcommand{\Titolo}[1]{}
\newcommand{\Sottotitolo}[1]{}
\newcommand{\Annoaccademico}[1]{}
\newcommand{\Piede}[1]{}
\newcommand{\Titoletto}[1]{}
\newcommand{\Candidato}[2][]{}
\newcommand{\Relatore}[1]{}
\newcommand{\Correlatore}[1]{}
\newcommand{\NCandidato}[1]{}
\newcommand{\NCandidati}[1]{}
\newcommand{\NRelatore}[2]{}
\newcommand{\NCorrelatore}[2]{}
\newcommand{\Punteggiatura}[1]{}
%    \end{macrocode}
% The following two \cs{fi} match |\ifdefined\front@infront|
% and \cs{iffront@write} several lines ahead
%    \begin{macrocode}
\fi
\fi
%    \end{macrocode}
% \subsection{The external file inclusion}
% We define a command to hold the requested file name extension.
%    \begin{macrocode}
\ifpdf
  \def\front@ext{pdf}
\else
  \ifxetex
    \def\front@ext{pdf}
  \else
    \def\front@ext{eps}
  \fi
\fi
%    \end{macrocode}
% If we use \pack{amsbook}, then the titlepage environment doesn't
% generate the verso page, while book does. If we use \pack{memoir} we
% have to exploit its \texttt{titlingpage} environment.
% \changes{v1.3}{2011/03/08}{Support for memoir}
%    \begin{macrocode}
\@ifclassloaded{amsbook}
  {\def\front@cp{\null\thispagestyle{empty}\newpage
    \advance\c@page\m@ne}}
  {\let\front@cp\relax}
\@ifclassloaded{memoir}
  {\let\titlepage\titlingpage 
   \toks0={\let\setcounter\@gobbletwo}%
   \toks2=\expandafter{\endtitlingpage}%
   \edef\endtitlepage{\the\toks0 \the\toks2 }}
  {\let\front@cp\relax}
%    \end{macrocode}
% \begin{macro}{\front@message}
% \changes{v1.2}{2010/06/25}{Added infrastructure for the final message}
% Here we define the infrastructure for the final message.
%    \begin{macrocode}
\newif\if@front@message
\def\front@message{%
  \PackageWarningNoLine{frontespizio}
    {Remember to compile \jobname-frn with\MessageBreak
    \ifpdf
      pdflatex \jobname-frn%
    \else
      \ifxetex
        xelatex \jobname-frn
      \else
        latex \jobname-frn\MessageBreak
        dvips -o \jobname-frn.eps \jobname-frn%
      \fi
    \fi\MessageBreak
    and then rerun \ifpdf pdf\fi \ifxetex xe\fi latex}}
%    \end{macrocode}
% \end{macro}
% \begin{environment}{frontespizio}
% \changes{v1.2}{2010/06/25}{Changed the definition to use \pack{atbegshi}}
% \changes{v1.2}{2010/06/25}{Excised the final message stuff}
% \changes{v1.2}{2010/06/25}{Modified \cs{endfrontespizio} for the
% final message}
% The environment \env{frontespizio} goes in the main file and is
% responsible for ending the writing of the \file{frn} file (in its final
% part; in the initial part it typesets the front page by including
% the pdf file if already typeset.
% 
% The front page commands must go before the end of this environment;
% the best choice is, of course, to put them inside it.  Maybe a
% key-value syntax would be preferable.
% 
% Now we define the environment; its purpose is to initialize the
% mechanism and finalize it.
%    \begin{macrocode}
\def\frontespizio{%
  \titlepage\null
  \IfFileExists{\jobname-frn.\front@ext}
    {\AtBeginShipoutNext{\AtBeginShipoutUpperLeft{% 
     \vbox to\z@{\hbox{\includegraphics{\jobname-frn}}\vss}}}}
    {\PackageWarningNoLine{frontespizio}
       {Missing file \jobname-frn.\front@ext}%
     \@front@messagetrue}%
  \afterpage{\thispagestyle{empty}}%
  \endtitlepage
  \if@twoside\front@cp\fi
}
\def\endfrontespizio{%
  \front@write{\begin{document}}
  \front@expwrite{\string\preparefrontpage\front@shape}
  \front@write{\end{document}}
  \iffront@write\immediate\closeout\front@out\fi
  \ifdefined\front@mdfiveold
    \xdef\front@mdfivenew{\pdfmdfivesum file{\jobname-frn.tex}}%
    \ifx\front@mdfiveold\front@mdfivenew\else
      \@front@messagetrue
    \fi
  \fi
  \if@front@message
    \AtEndDocument{\front@message}
  \fi
}
%    \end{macrocode}
% \iffalse
%</package>
% \fi
% \end{environment}
% The end.
% \Finale