From 74e9852b0c607417766f22bc3508d9c16c9fa7fc Mon Sep 17 00:00:00 2001
From: Manuel Pégourié-Gonnard <mpg@elzevir.fr>
Date: Wed, 3 Aug 2011 13:21:12 +0000
Subject: suftesi 2011/07/25 v. 0.5

git-svn-id: svn://tug.org/texlive/trunk@23384 c570f23f-e606-0410-a88d-b1316a301751
---
 Master/texmf-dist/tex/latex/suftesi/suftesi.cls | 874 +++++++++++++++---------
 1 file changed, 547 insertions(+), 327 deletions(-)

(limited to 'Master/texmf-dist/tex/latex/suftesi/suftesi.cls')

diff --git a/Master/texmf-dist/tex/latex/suftesi/suftesi.cls b/Master/texmf-dist/tex/latex/suftesi/suftesi.cls
index d6f20d18628..be1991c5da9 100644
--- a/Master/texmf-dist/tex/latex/suftesi/suftesi.cls
+++ b/Master/texmf-dist/tex/latex/suftesi/suftesi.cls
@@ -1,7 +1,7 @@
 %%
 %% This is file `suftesi.cls',
 %%
-%%  Copyright (C) 2010 Ivan Valbusa
+%%  Copyright (C) 2010-11 Ivan Valbusa
 %% 
 %%  This program is provided under the terms of the
 %%  LaTeX Project Public License distributed from CTAN
@@ -14,8 +14,8 @@
 %% 
 \NeedsTeXFormat{LaTeX2e}[2005/12/01]
 \ProvidesClass{suftesi}
-		[2010/09/17 v. 0.4
-		Classe per tesi di laurea e di dottorato delle facolta' umanistiche]
+		[2011/07/25 v. 0.5
+		A class for typesetting theses, books and articles]
 %****************************************
 %  declare options
 %****************************************
@@ -26,8 +26,16 @@
 \newif\ifsuftesi@defaultfont 
 \newif\ifsuftesi@defaultgreek
 \newif\ifsuftesi@plain
+\newif\ifsuftesi@fullplain
 \newif\ifsuftesi@bozza
+\newif\ifsuftesi@article
 \newif\ifsuftesi@nofront
+\newif\ifsuftesi@compact
+\newif\ifsuftesi@supercompact
+\newif\ifsuftesi@elements
+\newif\ifsuftesi@sufelements
+\newif\ifsuftesi@nocrop
+\newif\ifsuftesi@nomarginpar
 \DeclareOption{centertitle}{\suftesi@centertitletrue}
 \DeclareOption{sctitles}{\suftesi@sctitlestrue}
 \DeclareOption{disablefront}{\suftesi@nofronttrue}
@@ -38,23 +46,28 @@
 \DeclareOption{defaultgreek}{\suftesi@defaultgreektrue
 	\suftesi@artemisiafalse\suftesi@porsonfalse} 
 \DeclareOption{plain}{\suftesi@plaintrue} 
+\DeclareOption{fullplain}{\suftesi@fullplaintrue} 
 \DeclareOption{bozza}{\suftesi@bozzatrue} 
-%****************************************
-%  execute and process options
-%****************************************
+\DeclareOption{compact}{\suftesi@compacttrue} 
+\DeclareOption{supercompact}{\suftesi@supercompacttrue} 
+\DeclareOption{elements}{\suftesi@elementstrue\suftesi@sufelementstrue} 
+\DeclareOption{sufelements}{\suftesi@sufelementstrue\suftesi@sctitlestrue} 
+\DeclareOption{nocrop}{\suftesi@nocroptrue} 
+\DeclareOption{nomarginpar}{\suftesi@nomarginpartrue} 
+\DeclareOption{article}{\suftesi@articletrue}
 \DeclareOption*{\PassOptionsToClass{\CurrentOption}{book}}
 \ExecuteOptions{artemisia} 
 \ProcessOptions
 \relax
-%****************************************
-% load class
-%****************************************
 \LoadClass[a4paper]{book}
 %****************************************
 % 		PACKAGES
 %****************************************
-\RequirePackage{ifxetex,ifluatex,metalogo} %ifpdf
-\RequirePackage{microtype}
+\RequirePackage{color}
+	\definecolor{sufred}{rgb}{0.5,0,0}
+	\definecolor{sufgray}{rgb}{0.5,0.5,0.5}
+\RequirePackage{ifxetex,ifluatex,metalogo}
+\RequirePackage[letterspace=110]{microtype}
 \RequirePackage{textcase}
 \RequirePackage{multicol}
 \RequirePackage{emptypage}
@@ -62,7 +75,6 @@
 \RequirePackage{mparhack}
 \RequirePackage{caption}
 	\captionsetup{labelsep=period,font=small}
-%	epigraphs
 \RequirePackage{epigraph}                       
 	\setlength{\beforeepigraphskip}{-3\baselineskip} 
 	\setlength{\afterepigraphskip}{2\baselineskip}   
@@ -71,18 +83,24 @@
 	\renewcommand{\sourceflush}{flushepinormal}      
 	\renewcommand{\epigraphsize}{\footnotesize}  
 \RequirePackage{enumitem}
-\setlist{labelsep=0.6em,itemsep=0.2ex,font=\normalfont}
-\setdescription{font=\normalfont\sffamily,itemsep=0.2ex}
-\setenumerate[1]{leftmargin=0pt,label=\arabic*}
-\setenumerate[2]{leftmargin= 1.3em,label=\arabic*}
-\setenumerate[3]{leftmargin= 1.3em,label=\arabic*}
-\setitemize[1]{leftmargin=0pt}
-\setitemize[2]{leftmargin=1.3em}
-\setitemize[3]{leftmargin=1.3em}
-%%****************************************
-%% 		GREEK FONT
-%%****************************************
-% thanks to Enrico Gregorio
+\ifsuftesi@elements
+	\setdescription{font=\normalfont\itshape,noitemsep}
+	\setenumerate[1]{font=\normalfont,leftmargin=0pt,label=\arabic*}
+	\setitemize[1]{font=\normalfont,leftmargin=0pt}
+\else
+	\setlist{labelsep=0.6em,itemsep=0ex,font=\normalfont}
+	\setdescription{font=\normalfont\sffamily,itemsep=0ex}
+	\setenumerate[1]{leftmargin=0pt,label=\arabic*}
+	\setenumerate[2]{leftmargin= 1.3em,label=\arabic*}
+	\setenumerate[3]{leftmargin= 1.3em,label=\arabic*}
+	\setitemize[1]{leftmargin=0pt}
+	\setitemize[2]{leftmargin=1.3em}
+	\setitemize[3]{leftmargin=1.3em}
+\fi	
+%****************************************
+% 		GREEK FONT
+%****************************************
+%...thanks to the TeX guru Enrico Gregorio
 \ifxetex
    \relax
       \else
@@ -130,6 +148,7 @@
 %		LAYOUT
 %****************************************
 \RequirePackage{geometry}
+  \parindent1em
 \ifcase\@ptsize\relax
 	\geometry{%
 	  textwidth=312pt,
@@ -138,8 +157,8 @@
 	  textwidth=324pt,
 	  textheight=648pt}\or
 	\geometry{%
-	  textwidth=336pt,
-	  textheight=672pt}
+	  textwidth=324pt,
+	  textheight=648pt}
 	  \fi
 	\geometry{%
 	  marginparsep=12pt,
@@ -149,70 +168,260 @@
 	  heightrounded,
 	  marginparwidth=82pt,
 	  }	  
-  \parindent1em
+\ifsuftesi@nocrop
+     \relax
+       \else
+          \RequirePackage[a4,cam,center]{crop}
+\fi
+\ifsuftesi@compact
+    \geometry{
+    textheight=16.5cm,
+    textwidth=11cm,
+    paperwidth=16cm,
+    paperheight=24cm,
+    hmarginratio=2:3,
+    vmarginratio=2:3,
+    includefoot,
+    includehead,
+    heightrounded,
+    marginparwidth=65pt,
+    marginparsep=10pt,
+    }
+   \else
+\ifsuftesi@supercompact
+    \geometry{
+    textheight=15cm,
+    textwidth=10cm,
+    paperwidth=14cm,
+    paperheight=21cm,
+    hmarginratio=2:3,
+    vmarginratio=2:3,
+    includefoot,
+    includehead,
+    heightrounded,
+    marginparwidth=50pt,
+    marginparsep=9pt,
+}
+   \else
+\ifsuftesi@elements
+\geometry{%
+	textwidth=251pt,
+	textheight=502pt,
+	marginparwidth=60pt,
+	marginparsep=18pt,
+	paperwidth=378pt,
+	paperheight=654pt,
+    heightrounded,
+	outer=90pt,
+	top=64pt,
+}
+
+\else
+	   \fi
+    \fi 
+ \fi
+ \if@twoside
+   \relax
+     \else
+   \geometry{hmarginratio=1:1}
+\fi
 %****************************************
-%		TITLES
+%		SECTION TITLES
 %****************************************
 \RequirePackage{titlesec}
-\RequirePackage{titletoc}
-    \microtypesetup{expansion=false}%
-    \DeclareRobustCommand{\spacedallcaps}[1]%
-    {\textls[160]{\MakeTextUppercase{#1}}}%
+\microtypesetup{expansion=false}%
+    \DeclareRobustCommand{\sufsc}[1]%
+    {\textls{\MakeTextLowercase{\textsc{#1}}}}%
+\DeclareRobustCommand{\sufsmallcaps}%
+    {\ifxetex\scshape\addfontfeature{LetterSpace=6}\else\lsstyle\scshape\fi\expandafter\MakeLowercase}%
+\DeclareRobustCommand{\sufchaptersize}{%
+	\ifsuftesi@supercompact\large\else\ifsuftesi@compact\Large\else\LARGE\fi\fi}
+\ifsuftesi@article% article
+	\renewcommand \thesection {\@arabic\c@section}
+	\renewcommand\thesubsection   {\thesection.\@arabic\c@subsection} 
+	\renewcommand\thesubsubsection{\thesubsection.\@arabic\c@subsubsection}
+	\renewcommand\theparagraph    {\thesubsubsection.\@arabic\c@paragraph}
+	\renewcommand\thesubparagraph {\theparagraph.\@arabic\c@subparagraph}
+\renewcommand\part{%
+   \if@noskipsec \leavevmode \fi
+   \par
+   \addvspace{4ex}%
+   \@afterindentfalse
+   \secdef\@part\@spart}
+\def\@part[#1]#2{%
+    \ifnum \c@secnumdepth >\m@ne
+      \refstepcounter{part}%
+      \addcontentsline{toc}{part}{\thepart\hspace{1em}#1}%
+    \else
+      \addcontentsline{toc}{part}{#1}%
+    \fi
+    {\parindent \z@ \raggedright
+     \interlinepenalty \@M
+     \normalfont
+     \ifnum \c@secnumdepth >\m@ne
+       \normalsize \partname\nobreakspace\thepart
+       \par\nobreak
+     \fi
+     \large  #2%
+     \markboth{}{}\par}%
+    \nobreak
+    \vskip 3ex
+    \@afterheading}
+\def\@spart#1{%
+    {\parindent \z@ \raggedright
+     \interlinepenalty \@M
+     \normalfont
+     \huge \bfseries #1\par}%
+     \nobreak
+     \vskip 3ex
+     \@afterheading}
+\else% book
 \titleformat{\part}[display]
 	  {\LARGE\filcenter}
-	  {\partname~\Roman{part}}
+	  {\sufchaptersize\ifsuftesi@sctitles\scshape\else\fi\partname~\Roman{part}}
 	  {3ex}
-	  {\LARGE}
+	  {\sufchaptersize\ifsuftesi@sctitles\sufsmallcaps\else\fi}
+\fi
+% COMMON SETTINGS
 \ifsuftesi@centertitle
 	\titleformat{\chapter}[display]
 		  {\filcenter}
-		  {\LARGE\thechapter}
+		  {\sufchaptersize\thechapter}
 		  {3ex}
-		  {\LARGE\ifsuftesi@sctitles\scshape\else\fi}
+		  {\sufchaptersize\ifsuftesi@sctitles\sufsmallcaps\else\fi}
     \else
 	\titleformat{\chapter}[hang]
 		  {\filright}
-		  {\LARGE\thechapter.}
+		  {\sufchaptersize\thechapter.}
 		  {3ex}
-		  {\LARGE\ifsuftesi@sctitles\scshape\else\fi}
+		  {\sufchaptersize\ifsuftesi@sctitles\sufsmallcaps\else\fi}
+\fi
+\ifsuftesi@compact
+  \titlespacing*{\chapter}{0em}{0ex}{18ex}
+    \else
+      \ifsuftesi@supercompact 
+        \titlespacing*{\chapter}{0em}{0ex}{18ex}
+         \else
+      \titlespacing*{\chapter}{0em}{6ex}{18ex}
+   \fi
 \fi
-\titlespacing*{\chapter}{0em}{6ex}{18ex}
+% ELEMENTS
+\newcommand{\chapnumfont}[1]{%
+	\ifxetex
+	  \def\@chapnumfont{#1}
+     \else
+       \def\@chapnumfont{\fontfamily{#1}}
+	  \fi}
+\newcommand{\xechapnumfont}{\chapnumfont}
+
+\xechapnumfont{Palatino}
+\chapnumfont{pplj}
+\DeclareRobustCommand{\sectitle}[1]{\textls[160]{\MakeUppercase{#1}}}%
+
+\ifsuftesi@sufelements
+   \titleformat{\chapter}[block]
+		  {\vskip-22pt}%
+		  {\begin{picture}(0,0)
+	\setlength{\unitlength}{1pt}
+	\ifxetex
+	  \fontspec{\@chapnumfont}% Palatino
+	\else
+	  \@chapnumfont
+	  \fi
+		  \ifsuftesi@elements
+		    \fontsize{65}{65}\selectfont
+		  \else
+		    \fontsize{95}{95}\selectfont
+		  \fi
+		    \put(0,-88){%
+		    \hskip\textwidth
+		    \hskip\marginparsep
+		   \textcolor{sufgray}{\thechapter}}%
+		    \end{picture}}
+		  {0pt}
+		  {\sectitle}
+		  [\rule{\textwidth}{.4pt}]
+  	\titlespacing*{\chapter}{0em}{10pt}{10pt}[0em] 
+\else\fi
+\ifsuftesi@elements
 \titleformat{\section}[hang]
 	  {\raggedright}
+	  {\textnormal\thesection}
+	  {1em}
+	  {\small\sufsmallcaps}
+	\titlespacing*{\section}{0em}{10pt}{10pt}[0em] 
+\titleformat{\subsection}[block]
+	  {\filright\normalsize\itshape}
+	  {\textnormal\thesubsection}
+	  {1em}
+	  {}
+	\titlespacing*{\subsection}{0em}{10pt}{10pt}[0em] 
+\titleformat{\subsubsection}[block]
+	  {\filright\normalsize\itshape}
+	  {\textnormal\thesubsubsection}
+	  {1em}
+	  {}
+	\titlespacing*{\subsubsection}{0em}{10pt}{10pt}[0em] 
+\else
+\titleformat{\section}[hang]
+	  {\filright}
 	  {\thesection}
 	  {.5em}
-	  {\ifsuftesi@sctitles\scshape\else\itshape\fi}
-\titlespacing*{\section}{0ex}{\baselineskip}{\baselineskip}[0ex]	  
+	  {\unskip\ifsuftesi@sctitles\sufsmallcaps\else\itshape\fi}
+	\titlespacing*{\section}{0ex}{\baselineskip}{\baselineskip}[0ex]	  
+\fi
 \titleformat{\subsection}[hang]
-	  {\raggedright}
+	  {}
 	  {\textnormal\thesubsection}
 	  {.5em}
-	  {\ifsuftesi@sctitles\itshape\else\fi}
-\titlespacing*{\subsection}{0ex}{\baselineskip}{\baselineskip}[0ex]
+	  {\itshape}
+	\titlespacing*{\subsection}{\parindent}{\baselineskip}{\baselineskip}[0ex]
 \titleformat{\subsubsection}[hang]
-	  {\raggedright}
+	  {}
 	  {\textnormal\thesubsubsection}
 	  {.5em}
 	  {}
-\titlespacing*{\subsubsection}{0ex}{\baselineskip}{\baselineskip}[0ex]	  
+	\titlespacing*{\subsubsection}{\parindent}{\baselineskip}{\baselineskip}[0ex]  
 \titleformat{\paragraph}[runin]
 	  {\itshape}
 	  {}
 	  {}
 	  {}
 	  [\hspace*{1em}]
-\titlespacing*{\paragraph}{\parindent}{.5\baselineskip}{.5\baselineskip}
+	\titlespacing*{\paragraph}{\parindent}{.5\baselineskip}{.5\baselineskip}
 \titleformat{\subparagraph}[runin]
 	  {}
 	  {}
 	  {}
 	  {}
 	  [.\hspace*{1em}]
-\titlespacing*{\subparagraph}{\parindent}{.5\baselineskip}{.5\baselineskip}
+	\titlespacing*{\subparagraph}{\parindent}{.5\baselineskip}{.5\baselineskip}
 %****************************************
 %		TOC, LOF, LOT
 %****************************************
-% table of contents
+\RequirePackage{titletoc}
+\ifsuftesi@article % ARTICLE MODE
+\renewcommand\tableofcontents{%
+	\thispagestyle{empty}
+	    \section*{\contentsname
+	        \@mkboth{%
+	           \contentsname}{\contentsname}}%
+	    \@starttoc{toc}%
+	      \vspace*{2ex}
+	    }
+\else
+\renewcommand\tableofcontents{%
+    \if@twocolumn
+      \@restonecoltrue\onecolumn
+    \else
+      \@restonecolfalse
+    \fi
+    \chapter*{\contentsname
+        \@mkboth{\contentsname}{\contentsname}}%
+    \@starttoc{toc}%
+    \if@restonecol\twocolumn\fi
+    }
+ \fi
 \titlecontents{part}                                                  
 	[0em]                                                                    
 	{\addvspace{3ex}\partname~}                                                 
@@ -227,7 +436,7 @@
 	{}                                                                       
 	{\titlerule*{}\contentspage}
 	[\addvspace{1ex}]
-\titlecontents{section}
+  \titlecontents{section}
 	[1.5em]
 	{} 
 	{\thecontentslabel\hspace*{1em}}
@@ -259,21 +468,25 @@
 	{\thecontentslabel\hspace*{1em}}
 	{} 
 	{\titlerule*{}\contentspage}
-%  appendix
+%****************************************
+%		APPENDIX
+%****************************************
 \newcommand{\appendicesname}[1]{\def\suff@appendices{#1}}
 \appendicesname{Appendici}
+\newcommand{\appendixpage}{\@appendixpage}
 \def\@appendixpage{%
-\titlecontents{chapter}                                                  
+\@mainmattertrue
+\titlecontents{part}                                                  
 	[0em]                                                                    
-	{\addvspace{2ex}}                                                 
-	{\thecontentslabel\hspace*{1em}}                                                    
-	{}                                                                       
+	{\addvspace{3ex}}                                                 
+	{}                                                    
+	{}                                                                      
 	{}
 	[\addvspace{1ex}]
 \let\contentspage\relax
     \cleardoublepage
        \thispagestyle{empty}
-         \addcontentsline{toc}{chapter}{\suff@appendices}
+         \addcontentsline{toc}{part}{\suff@appendices}
 	  \begingroup
 	    \centering
 	       \null\vfil
@@ -281,247 +494,213 @@
 	       \vfil
 	\endgroup
     \cleardoublepage
-    \titlecontents{chapter}                                                  
+\titlecontents{part}                                                  
 	[0em]                                                                    
-	{\addvspace{2ex}}                                                 
+	{\addvspace{3ex}\partname~}                                                 
 	{\thecontentslabel\hspace*{1em}}                                                    
-	{}                                                                       
-	{\titlerule*{}\contentspage}
-	[\addvspace{1ex}]}
+	{}                                                                      
+	{}
+	[\addvspace{1ex}]
+}
+\ifsuftesi@sufelements
 \renewcommand\appendix{\par
-	\@appendixpage
 	  \setcounter{chapter}{0}%
 	  \setcounter{section}{0}%
 	  \gdef\@chapapp{\appendixname}%
-	  \gdef\thechapter{\@Alph\c@chapter}%
-	  \@mainmattertrue}
+	  \gdef\thechapter{\@Alph\c@chapter}
+	  \titleformat{\chapter}[block]
+		  {\vskip-22pt}%
+		  {\small\sectitle{\appendixname}~\Alph{chapter}:\hskip.5em}
+		  {0pt}
+		  {\small\sectitle}
+		  [\rule{\textwidth}{.4pt}]
+	\titlespacing*{\chapter}{0em}{10pt}{10pt}[0em]
+	\titlecontents{chapter}[1em]                                                                  
+	  {\filright\hskip.5em}                                   
+	  {\sufsmallcaps\appendixname~\thecontentslabel:\hskip1em}                                                                   
+	  {}                                                       
+	  {\contentspage\vspace{5pt}}}
+	  \else
+\renewcommand\appendix{\par
+	  \setcounter{chapter}{0}%
+	  \setcounter{section}{0}%
+	  \gdef\@chapapp{\appendixname}%
+	  \gdef\thechapter{\@Alph\c@chapter}}
+\fi
 %****************************************
 % 		HEADINGS
 %****************************************
 \RequirePackage{fancyhdr}
-	\fancypagestyle{plain}{%
-	  \fancyhf{}
-	  \fancyfoot[C]{}
-	  \renewcommand{\headrulewidth}{0pt}
-	  \renewcommand{\footrulewidth}{0pt}}	
-    \pagestyle{fancy} 
-	  \renewcommand{\chaptermark}[1]% 
-	  {\markboth{\chaptertitlename~\thechapter}{#1}} 
-	  \renewcommand{\sectionmark}[1]{} 
-	  \renewcommand{\headrulewidth}{0pt} 
-\ifsuftesi@plain
-	\fancyhf{} 
-	\fancyhead[CO]{\ifsuftesi@sctitles\scshape\else\fi\footnotesize\xheadbreakfalse\nouppercase\rightmark} 
-	\fancyhead[CE]{\ifsuftesi@sctitles\scshape\else\fi\footnotesize\xheadbreakfalse\nouppercase\ivanleftmark} 
-	\fancyfoot[RE,LO]{\ifsuftesi@bozza \footnotesize Versione del \today\else\fi}
-\fancyfoot[C]{\ifsuftesi@sctitles\scshape\else\fi\footnotesize\thepage}
-	\def\ivanleftmark{\if@mainmatter\leftmark\else\rightmark\fi} 
-\else
-    \fancyhf{} 
-	\fancyfoot[RE,LO]{\ifsuftesi@bozza \footnotesize Versione del \today\else\fi}
-	\fancyhead[LE,RO]{\ifsuftesi@sctitles\scshape\else\fi\footnotesize\thepage} 
-\fancyhead[LO]{\ifsuftesi@sctitles\scshape\else\fi\footnotesize\xheadbreakfalse\nouppercase\rightmark}
-	\fancyhead[RE]{\ifsuftesi@sctitles\scshape\else\fi\footnotesize\nouppercase\ivanleftmark} 
-	\def\ivanleftmark{\if@mainmatter\leftmark\else\rightmark\fi} 
-\fi
+\pagestyle{fancy}
+\renewcommand{\headrulewidth}{0pt} 
 \renewcommand{\footnoterule}{}
-%****************************************
-%		TITLE PAGE
-%****************************************
-\def\suftesi@fronterror{%
-	\ClassError{suftesi}{Package 'frontespizio' not loaded.\MessageBreak
-		Load the package to get the 'suftesi' title page\MessageBreak
-		or set the class option 'disablefront'}
-		{Package 'frontespizio' not installed.\MessageBreak
-		Install the package to get the suftesi titlepage\MessageBreak
-		or set the class option 'disablefront'} \@@end}	
-\def\suftesi@logoerror{%
-	\ClassError{suftesi}{Missing \protect\Logo!!!\MessageBreak
-		Insert \protect\Logo{} to get the 'suftesi' title page\MessageBreak
-		or set the class option 'disablefront'}
-		{Missing \protect\Logo!!!\MessageBreak
-		Insert \protect\Logo{} to get the 'suftesi' title page\MessageBreak
-		or set the class option 'disablefront'} \@@end}	
-\AtBeginDocument{%
-\ifsuftesi@nofront
-  \relax
-     \else
-     \@ifpackageloaded{frontespizio}
-     	{}
-	{\suftesi@fronterror}
-	\front@write{
-	\Margini {95pt}{126pt}{140pt}{95pt}
-	\usepackage[svgnames]{xcolor}
-	\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}
-	\parindent0pt
-\makeatletter
-     \def\preparefrontpage{%
-\titlepage\front@font
-
-\moveright.28\textwidth\vbox to \textheight{
-
-   \moveleft.28\textwidth\hbox to \textwidth{%
-   \begin{minipage}{.2\textwidth}
-	\if\@front@{logo}
-	{\includegraphics[height=\textwidth]{\front@logo}}
-	\fi 
-	\end{minipage}%
-	\hskip.08\textwidth
-\begin{minipage}{.72\textwidth}
-{\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}
-	}
-
-	\vspace{\stretch{5}}
-
-% titoletto
-\if\@front@{titoletto}
-
-{\frontpretitlefont\front@titoletto\par}
-\fi
-
-	\vspace{\stretch{2}}
-
-% titolo e sottotitolo
-{\fronttitlefont\color{Maroon}\front@title\par}
-\if\@front@{sottotit}
-\vspace{4ex}
-{\frontsubtitlefont\front@subtitle\par}
+\ifsuftesi@elements
+	\renewcommand{\chaptermark}[1]{\markboth{#1}{#1}} 
+\else
+	\renewcommand{\chaptermark}[1]{\markboth{\chaptertitlename~\thechapter}{#1}}
 \fi
-
-\vspace{\stretch{3}}
-
-% makecandidates
-\def\front@makecandidates{%
-  \begin{tabular}[t]{@{}l}
-  \relax\ifnum\front@candcount<1
-    \PackageWarningNoLine{frontespizio}{Missing candidate name}%
+\ifsuftesi@article\relax
   \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
+    \ifsuftesi@elements
+      \renewcommand{\sectionmark}[1]{\markright{#1}}
+	\else
+    	  \renewcommand{\sectionmark}[1]{}
     \fi
-    \end{tabular}
-  \fi}
-  
-  	\vspace{\stretch{1}}
-
-\parindent\z@
-\frontnamesfont
-\ifdefined\front@swapnames% relatori candidati
-
-     \front@makeadvisors
-
-\vspace{3ex}
-
-     \front@makecandidates
-
-\else% candidati relatori
-
-    \front@makecandidates
-
-\vspace{3ex}
-
-  \front@makeadvisors
  \fi
-\par
-\vfill
-
-\ifdefined\front@signatures\vskip\frontadjustforsignatures\fi
-\unless\ifdefined\front@norules\fi
 
-\vspace{\stretch{5}}
+\def\scart@hookmark{\ifsuftesi@sctitles\sufsc{\rightmark}% article mode
+	\else\nouppercase\rightmark\fi}
+\def\scbook@hookmark{\ifsuftesi@sctitles\sufsc{\ivanleftmark}% book mode
+	\else\nouppercase\ivanleftmark\fi}
+\def\sc@thepagehook{\ifsuftesi@sctitles\sufsc{\thepage}\else\thepage\fi}
+\def\ivanleftmark{\if@mainmatter\leftmark\else\rightmark\fi} 
+    
+\fancypagestyle{plain}{%
+	\fancyhf{}
+	\fancyfoot[C]{}
+	\renewcommand{\headrulewidth}{0pt}
+	\renewcommand{\footrulewidth}{0pt}}	
+\fancypagestyle{suffullplain}{%
+	\fancyhf{}%
+	\fancyfoot[RE,LO]{\ifsuftesi@bozza \footnotesize Versione del \today\else\fi}
+	\fancyfoot[C]{\footnotesize\sc@thepagehook}}
+\fancypagestyle{sufplain}{%
+		\fancyhf{}%
+		\fancyhead[CO]{\footnotesize%
+		\xheadbreakfalse\scart@hookmark} 
+		\fancyhead[CE]{\footnotesize%
+		\xheadbreakfalse\ifsuftesi@article\scart@hookmark\else\scbook@hookmark\fi} 
+		\fancyfoot[RE,LO]{\ifsuftesi@bozza \footnotesize Versione del \today\else\fi}
+		\fancyfoot[C]{\footnotesize\sc@thepagehook}%
+		}
+\fancypagestyle{sufdefault}{%
+		\fancyhf{}%
+		\fancyfoot[RE,LO]{\ifsuftesi@bozza \footnotesize Versione del \today\else\fi}
+		\fancyhead[LE,RO]{\footnotesize\sc@thepagehook} 
+		\fancyhead[LO]{\footnotesize\xheadbreakfalse\scart@hookmark}
+		\fancyhead[RE]{\footnotesize\ifsuftesi@article\scart@hookmark
+			\else\scbook@hookmark\fi}%
+			}
 
-{\frontfootfont%
- \if\@front@{foot}
-   \front@foot
- \else
-Anno Accademico \front@anno
- \fi
- \par}
-}
-\endtitlepage}
+\fancypagestyle{elements}{% elements
+\fancyhf{}
+\fancyfoot[LE,RO]{\thepage} 
+\fancyhead[RO]{%pari
+	\begin{picture}(0,0)
+	   \setlength{\unitlength}{1pt}
+	      \put(0,-104){%
+	\hskip\marginparsep
+	\parbox[t]{\marginparwidth}{\itshape\raggedright\leftmark}}%
+	\end{picture}} 
+\fancyhead[LE]{%
+	\begin{picture}(0,0)
+	   \setlength{\unitlength}{1pt}
+	      \put(0,-104){%
+	\hskip-\marginparwidth
+	\hskip-\marginparsep
+	      \parbox[t]{\marginparwidth}{\itshape\raggedleft\rightmark}}%
+	\end{picture}}	
+	}		
 
-\makeatother
-}
-\fi
-}
+\pagestyle{sufdefault}
+\ifsuftesi@plain\pagestyle{sufplain}\else\fi
+\ifsuftesi@fullplain\pagestyle{suffullplain}\else\fi
+\ifsuftesi@elements\pagestyle{elements}\else\fi
 %****************************************
-% 		PAGE NUMBERS
+%	TITLE PAGE FOR "ARTICLE"
 %****************************************
-\renewcommand\frontmatter{\cleardoublepage\@mainmatterfalse} 
-\renewcommand\mainmatter{\cleardoublepage\@mainmattertrue} 
+\newcommand{\standardtitle}{}
+\let\standardtitle\maketitle
+\ifsuftesi@article
+    \@titlepagefalse
+	\renewcommand\maketitle{\par
+	  \begingroup
+	    \renewcommand\thefootnote{\@fnsymbol\c@footnote}%
+	    \def\@makefnmark{\rlap{\@textsuperscript{\normalfont\@thefnmark}}}%
+	    \long\def\@makefntext##1{\parindent 1em\noindent
+	            \hb@xt@1.8em{%
+	                \hss\@textsuperscript{\normalfont\@thefnmark}}##1}%
+	    \if@twocolumn
+	      \ifnum \col@number=\@ne
+	        \@maketitle
+	      \else
+	        \twocolumn[\@maketitle]%
+	      \fi
+	    \else
+	      \newpage
+	      \global\@topnum\z@   % Prevents figures from going at top of page.
+	      \@maketitle
+	    \fi
+	    \thispagestyle{plain}\@thanks
+	  \endgroup
+	  \setcounter{footnote}{0}%
+	  \global\let\thanks\relax
+	  \global\let\maketitle\relax
+	  \global\let\@maketitle\relax
+	  \global\let\@thanks\@empty
+	  \global\let\@author\@empty
+	  \global\let\@date\@empty
+	  \global\let\@title\@empty
+	  \global\let\title\relax
+	  \global\let\author\relax
+	  \global\let\date\relax
+	  \global\let\and\relax
+	}
+	\def\@maketitle{%
+	  \newpage
+	  \null
+	  \vskip 2em%
+	  \begin{center}%
+	  \let \footnote \thanks
+	    {\sufchaptersize\color{sufred}\sffamily\ifsuftesi@sctitles\sufsc{\@title}\else\@title\fi\par}%
+	    \vskip 1.5em%
+	    {\lineskip .5em%
+	      \begin{tabular}[t]{c}%
+        {\small\@author\par}
+	      \end{tabular}\par}%
+	    \vskip 1em%
+	    {\small\@date\par}%
+	  \end{center}%
+	  \par
+	  \vskip 1.5em}
+  \else
+\renewcommand\maketitle{\begin{titlepage}%
+  \let\footnotesize\small
+  \let\footnoterule\relax
+  \let \footnote \thanks
+  \renewcommand\thefootnote{\@fnsymbol\c@footnote}%
+  \null\vfil
+  \vskip 60\p@
+  \begin{center}%
+    {\sufchaptersize\color{sufred}\sffamily\ifsuftesi@sctitles\sufsc{\@title}\else\@title\fi \par}%
+    \vskip 3em%
+    {\lineskip .75em%
+      \begin{tabular}[t]{c}%
+        {\small\@author\par}
+      \end{tabular}\par}%
+      \vskip 1.5em%
+    {\small\@date\par}%       % Set date in \large size.
+  \end{center}\par
+  \@thanks
+  \vfil\null
+  \end{titlepage}%
+  \setcounter{footnote}{0}%
+  \global\let\thanks\relax
+  \global\let\maketitle\relax
+  \global\let\@thanks\@empty
+  \global\let\@author\@empty
+  \global\let\@date\@empty
+  \global\let\@title\@empty
+  \global\let\title\relax
+  \global\let\author\relax
+  \global\let\date\relax
+  \global\let\and\relax
+}
+\fi
 %****************************************
-%		FOOTNOTES
+%		NOTES
 %****************************************
 \renewcommand\@makefntext{\hskip-2.5em\makebox[2em][r]{\@thefnmark}\hskip.5em}
-%****************************************
-%		MARGINAL NOTES
-%****************************************
 % thanks to Lorenzo Pantieri and Enrico Gregorio
 \def\graffito@setup{%
    \itshape\footnotesize%
@@ -535,6 +714,10 @@ Anno Accademico \front@anno
  [\graffito@setup\raggedleft\hspace{0pt}{#1}]%
  {\graffito@setup\raggedright\hspace{0pt}{#1}}}
 \let\marginpar\graffito
+\ifsuftesi@nomarginpar
+   \renewcommand{\marginpar}[1]{}
+   \renewcommand{\graffito}[1]{}
+\else\fi
 %***************************************
 %		COLOPHON
 %****************************************
@@ -563,60 +746,65 @@ Anno Accademico \front@anno
 	   \def\next{#1}
 	      \ifx\next\@empty\else su #1 
 	    \fi usando la classe \textsf{suftesi} di 
-	    Ivan Valbusa\index{Valbusa, Ivan}. #3\par}}
+	    Ivan Valbusa\index{Valbusa, Ivan}. #3\par}
+	    \cleardoublepage}
 %****************************************
-%		INDEX OF NAMES
+%		INDEX
 %****************************************
 \renewenvironment{theindex}
-{\renewcommand{\indexname}{Indice dei nomi}
-\setlength\columnseprule{0pt}\setlength\columnsep{35pt}%
-\cleardoublepage
-     \@makeschapterhead{\indexname}%
-     \begin{multicols}{2}
-    \markboth{\indexname}{\indexname}%
-    \raggedright\small
-    \setlength\parindent{0pt}%
-    \setlength\parskip{0pt plus 0.3pt}%
-    \thispagestyle{plain}\let\item\@idxitem}
-     {\end{multicols}}
+	{\renewcommand{\indexname}{Indice dei nomi}
+	    \setlength\columnseprule{0pt}
+	      \setlength\columnsep{35pt}%
+	        \cleardoublepage
+		  \@makeschapterhead{\indexname}%
+	\begin{multicols}{2}
+	     \markboth{\indexname}{\indexname}%
+	        \raggedright\small
+	         \setlength\parindent{0pt}%
+	         \setlength\parskip{0pt plus 0.3pt}%
+	      \thispagestyle{plain}\let\item\@idxitem}
+	{\end{multicols}}
 \renewcommand\@idxitem{\par\hangindent 15\p@}
 %****************************************
-%		BIBLIOGRAPHY
+%	BIBLIOGRAPHY AND SHORTHANDS
 %****************************************
 \newenvironment{bibliografia}{%
-\chapter{\bibname}%
-\normalfont \list{}{%
-%\setlength{\labelsep}{0.5em}
-\setlength{\itemindent}{-\parindent}
-\setlength{\leftmargin}{\parindent}
-\setlength{\labelwidth}{\leftmargin}
-%\addtolength{\labelwidth}{-\labelsep}
-%\setlength{\listparindent}{\parindent}
-\setlength{\parsep}{\parskip}
-%\setlength{\itemsep}{0em}
-\let\makelabel}}{\endlist}
-%****************************************
-%		SHORTHANDS
-%****************************************
+  \ifsuftesi@article
+    \section*{\refname}
+     \addcontentsline{toc}{section}{\refname}
+  \else
+	\chapter{\bibname}%
+  \fi
+  		\normalfont \list{}{%
+			%\setlength{\labelsep}{0.5em}
+			\setlength{\itemindent}{-\parindent}
+			\setlength{\leftmargin}{\parindent}
+			\setlength{\labelwidth}{\leftmargin}
+			%\addtolength{\labelwidth}{-\labelsep}
+			%\setlength{\listparindent}{\parindent}
+			\setlength{\parsep}{\parskip}
+			%\setlength{\itemsep}{0em}
+			\let\makelabel}}
+	{\endlist}
 \newcommand{\losname}{Sigle}
-%	elenchi
 \newcommand{\itlabel}[1]{\itshape\hbox to 6em{#1}}
 \newenvironment{sigle}{%
 	\chapter{\losname}
-	\normalfont \list{}{%
-	\setlength{\labelsep}{0.5em}
-	\setlength{\itemindent}{0pt}
-	\setlength{\leftmargin}{6em}
-	\setlength{\labelwidth}{\leftmargin}
-	%\addtolength{\labelwidth}{-\labelsep}
-	\setlength{\listparindent}{\parindent}
-	\setlength{\parsep}{\parskip}
-	%\setlength{\itemsep}{0em}
-	\let\makelabel\itlabel}}{\endlist}
+		\normalfont \list{}{%
+			\setlength{\labelsep}{0.5em}
+			\setlength{\itemindent}{0pt}
+			\setlength{\leftmargin}{6em}
+			\setlength{\labelwidth}{\leftmargin}
+			%\addtolength{\labelwidth}{-\labelsep}
+			\setlength{\listparindent}{\parindent}
+			\setlength{\parsep}{\parskip}
+			%\setlength{\itemsep}{0em}
+			\let\makelabel\itlabel}}
+	{\endlist}
 %*************************************************************
-% 		ENVIRONMENTS AND COMMANDS
+% 		ENVIRONMENTS
 %*************************************************************
-% environments
+% QUOTATIONS
 \renewcommand\labelitemii{\normalfont \textendash}
 \renewenvironment{quotation}
                {\list{}{\listparindent\parindent%
@@ -641,7 +829,36 @@ Anno Accademico \front@anno
                         \advance\leftmargin 1.5em}%
                 \item\relax}
                {\endlist}	
-%	commands
+% ABSTRACT
+\ifsuftesi@article
+\if@titlepage
+  \newenvironment{abstract}{%
+      \titlepage
+      \null\vfil
+      \@beginparpenalty\@lowpenalty
+      \begin{center}%
+         \abstractname
+        \@endparpenalty\@M
+      \end{center}}%
+     {\par\vfil\null\endtitlepage}
+\else
+  \newenvironment{abstract}{%
+      \if@twocolumn
+        \section*{\abstractname}%
+      \else
+        \small
+        \begin{center}%
+          {\abstractname\vspace{-.5em}\vspace{\z@}}%
+        \end{center}%
+        \quotation
+      \fi}
+      {\if@twocolumn\else\endquotation\fi}
+\fi
+    \else
+\fi
+%*************************************************************
+% 		 COMMANDS
+%*************************************************************
 \def\chapterintro{
   \@ifstar{\@tempswafalse\@chapterintro}{\@tempswatrue\@chapterintro}}
 \def\@chapterintro{\phantomsection
@@ -652,21 +869,24 @@ Anno Accademico \front@anno
 \newcommand{\hemph}[1]{\penalty10000\hskip0pt\emph{#1}}
 %	spezza nel toc ma non nel testo e testatina
 \newif\ifheadbreak\headbreakfalse  
-\DeclareRobustCommand{\headbreak}  
-{\ifheadbreak\\\else \fi}
-\newif\ifxheadbreak\xheadbreaktrue
+	\DeclareRobustCommand{\headbreak}  
+		{\ifheadbreak\\\else\fi}
 %	spezza nel testo e testatina ma non nel toc
-\DeclareRobustCommand{\xheadbreak} 
-{\ifxheadbreak\\\else \fi}
+\newif\ifxheadbreak\xheadbreaktrue
+	\DeclareRobustCommand{\xheadbreak} 
+		{\ifxheadbreak\\\else\fi}
 \let\origtableofcontents\tableofcontents
-\renewcommand{\tableofcontents}{\begingroup\headbreaktrue\xheadbreakfalse
-\origtableofcontents\endgroup}
-
+	\renewcommand{\tableofcontents}{%
+		\begingroup\headbreaktrue\xheadbreakfalse%
+	\origtableofcontents\endgroup}
+%****************************************
+% 		PAGE NUMBERS
+%****************************************
+\renewcommand\frontmatter{\cleardoublepage\@mainmatterfalse} 
+\renewcommand\mainmatter{\cleardoublepage\@mainmattertrue} 
 
 \frenchspacing
-\hfuzz=1pt 
-
-
+\hfuzz=1.5pt 
 
 \endinput
 
-- 
cgit v1.2.3

