% Latex style for dissertations (Departamento de Informatica, Universidade de Evora)
% Versão 1.5
%
% With the contributes of fc, jsaias, tcg, dmendes, ... well, almost everyone @di.uevora.pt
%
%	Free as in freedom
%


\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{teseue}[
2014/12/01
Style for DI/UE dissertations, v1.5
]

% Language adjustment

% Hyperref adjustments
% \RequirePackage{hyperref}
% \hypersetup{
% 	colorlinks=true,
% 	%pdfstartview=FitV,
% 	%pdfpagelabels=true,
% 	linkcolor=[rgb]{0.4 0.1 0.1},
% 	citecolor=[rgb]{0.1 0.4 0.1},
% 	urlcolor=[rgb]{0.1 0.1 0.4}
% }

% Document adjustment
\LoadClass[11pt,a4paper]{book}
\RequirePackage[top=3cm, bottom=3cm, left=2cm, right=2cm]{geometry} 
\RequirePackage{setspace} % for spacing environment
\RequirePackage{graphicx}
\RequirePackage{acronym}
\RequirePackage{tikz}
\RequirePackage{makeidx}
\RequirePackage{fontspec}
\setmainfont{Source Sans Pro}[
	UprightFont = {* Light},
	ItalicFont = {* Light Italic},
	BoldFont = {*}
]
% \setsansfont{Source Sans Pro}[
% 	UprightFont = {* Light},
% 	ItalicFont = {* Italic},
% 	BoldFont = {* Semibold}
% ]
\newfontfamily\xlightfont{Source Sans Pro}[
	UprightFont = {* ExtraLight},
	ItalicFont = {* ExtraLight Italic},
	BoldFont = {* Light}
]
%\newfontfamily\lightfont{Source Sans Pro}[UprightFont = {* Light}]
%\RequirePackage[rgb]{xcolor}
\definecolor{uered}{RGB}{158 27 50}
\definecolor{uegray}{RGB}{88 89 91}
\definecolor{uegrey}{RGB}{88 89 91}
\definecolor{ueblack}{RGB}{0 0 0}

% Paragraph ajustement
\setlength{\parindent}{0mm}
\setlength{\parskip}{3mm}
\renewcommand{\baselinestretch}{1.0} % 1.5 for double-space

%
%\RequirePackage{anyfontsize}

%%%%%%%%%%%%%%%%%%
% Style definition
%%%%%%%%%%%%%%%%%%
\newcommand{\@Monografia}{Disserta\c{c}\~{a}o}
\newcommand{\@monografia}{disserta\c{c}\~{a}o}


\DeclareOption{doutoramento}{
	\newcommand{\@Grau}{Doutor}
	\newcommand{\@grau}{doutor}
}
\DeclareOption{mestrado}{
	\newcommand{\@Grau}{Mestre}
	\newcommand{\@grau}{mestre}
}


\DeclareOption*{\PassOptionsToClass{\CurrentOption}{book}}
\ProcessOptions
%
% ----------------------------------------------------------------
%
\renewcommand{\familydefault}{\sfdefault}
%
%
% ================================================================
%
%	Primeira pagina de rosto
%
% ================================================================
%
\DeclareRobustCommand{\primeirapaginarosto}{   % v.2013: capa uniforme, jsaias
	\thispagestyle{empty}
		\vspace*{-2.1cm}
		\begin{flushright}
			\includegraphics[width=6cm]{teseue-logo.pdf}
		\end{flushright}
		\vspace{0.2cm}		
		\begin{flushright}
			%
			{\Huge \textbf{\teseueTituloPT}}
			%
			\vspace{0.2cm}\par		
			%
			{\LARGE \teseueTituloEN}
			%
			\vspace{-0.2cm}
			\par
			%
			\rule{\textwidth}{1pt}
			%
			{\Large \textit{\teseueNomeCandidato}}
			\par
			%
			\vspace{0.3cm}		
			%
			{Tese apresentada \`{a} Universidade de \'{E}vora}\\
			{para obten\c{c}\~{a}o do Grau de \@Grau\ em \teseueCurso}
			\par 
			%
			\vspace{0.5cm}		
			%
			%{Especialidade: \ESPECIALIDADE} %Comentar no caso de não ter
			%
			{\teseueOrientadorOuOrientadora: \textit{\teseueNomeOrientador}}
			\par
			%
			\vspace{1cm}	
			\textit{Esta \@monografia\ n\~{a}o inclui as cr\'{i}ticas e sugest\~{o}es feitas pelo J\'{u}ri}
			\par
			%
			{\teseueData}
			\par
			%
			\begin{centering}
			  \begin{figure}[!h]
			    \includegraphics[trim=0.89cm 0cm 0.38cm 0cm, clip, width=17cm]{azulejos}
			  \end{figure}
			\end{centering}
			\par
			%
			\vspace{-0.3cm}
			\par
			{INSTITUTO DE INVESTIGA\c{C}\~{A}O E FORMA\c{C}\~{A}O AVAN\c{C}ADA}
		\end{flushright}
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
	\newpage\hspace{1mm}\thispagestyle{empty}
	\cleardoublepage
}
%
% ================================================================
%
%	Segunda pagina de rosto
%
% ================================================================
%
\DeclareRobustCommand{\segundapaginarosto}{   % v.2013: capa uniforme, jsaias
	\thispagestyle{empty}
	%\vspace*{-0.8cm}
	\begin{tabular}{lcr}
	    \vspace*{-1.5cm}\parbox[t][\textheight][t]{2.63cm}{\includegraphics[width=2.6cm]{teseue-pomba} \\ } 
	    & 
	  	\parbox[t][\textheight][t]{0.4cm}{
	  		\vspace*{-3.2cm}
	  		\begin{tikzpicture}
	  			\foreach \y in {1, ..., 46} {
	  				\fill[fill=uegrey] (0,\y*0.5) circle (0.05cm);
	  			}
	  		\end{tikzpicture}
	  	}
	  	& 
	    \vspace*{-1.5cm}\parbox[t][0.9\textheight][t]{10.1cm}{
			\vspace{-2.8cm} % recuo vertical igual ao comprimento da imagem
			{\Large \textbf{{\color{uered} UNIVERSIDADE DE ÉVORA}}}\\

			{\large \textbf{\teseueEscola}} \\

			{\large \teseueDepartamento} \\
			%

			%
			\vspace*{4.1cm}
			{\Large \textbf{\teseueTituloPT}}

			\vspace{1.5cm}
			{\large \textbf{\teseueNomeCandidato}}

			\vspace{0.45cm}
			{Orientação: \teseueNomeOrientador \\}

			% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
			\vspace{4.1cm}
			{\large \textbf{\teseueCurso}}
			%

			%
			\vspace{0.4cm}
			{\normalsize \@Monografia}
			%

			%
			\vspace{2.1cm}
			{\small \teseueData}
			%

			%
			\vspace*{1.0cm}
			{\footnotesize\textit{Esta \@monografia\ n\~{a}o inclui as cr\'{i}ticas e sugest\~{o}es feitas pelo J\'{u}ri}\\}
			%\newpage
		}
	\end{tabular} 
	% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
	\newpage\hspace{1mm}\thispagestyle{empty}
	\cleardoublepage
}

\DeclareRobustCommand{\paginadedicatoria}{
	\@blankoddpage
	\thispagestyle{empty}
	\begin{flushright}
		\ \\
		\vspace{5cm}
		\it \teseueDedicatoria
	\end{flushright}
	\@blankoddpage
}

% Tables of contents, figues and tables
\newcommand{\thecontents}{
	\begin{spacing}{.5}

		\@blankoddpage
		\cleardoublepage

		%\phantomsection
		\tableofcontents
		\addcontentsline{toc}{chapter}{Conte\'{u}do}

		\@blankoddpage
		\cleardoublepage

		%\phantomsection
		\listoffigures
		\addcontentsline{toc}{chapter}{Lista de Figuras}

		\@blankoddpage
		\cleardoublepage

		%\phantomsection
		\listoftables
		\addcontentsline{toc}{chapter}{Lista de Tabelas}

		\@blankoddpage
	\end{spacing}
}


% Annexes
\newcommand{\theappendix}{
	\renewcommand{\chaptername}{Annexes}
	\@blankoddpage
	\thispagestyle{empty}
	\vspace*{7cm}
	\begin{center}
	{\bf \Huge Annexes}
	\end{center}
	\vfill
}


% Blank page for odd terminating chapters
\def\blankpage{\pagestyle{empty}\cleardoublepage\pagestyle{headings}}
\newcommand{\@blankoddpage}{
	\if@openright
		\clearpage
		\blankpage
	\else
		\clearpage
	\fi
}


% Section style
\renewcommand{\section}{\@startsection
	{section}%                   % the name
	{1}%                         % the level
	{0mm}%                       % the indent
	{-\baselineskip}%            % the before skip
	{0.5\baselineskip}%          % the after skip
	{\normalfont\Large\bfseries}	% the style
}
%
% ================================================================
%
% Chapter style
%
% ================================================================
%
% ----------------------------------------------------------------
% Chapter style
% ----------------------------------------------------------------
\renewcommand\chapter{%
	\@blankoddpage
	\thispagestyle{plain}
	\global\@topnum\z@
	\@afterindentfalse
	\secdef\@chapter\@schapter
}
% ----------------------------------------------------------------
% Numbered chapter
% ----------------------------------------------------------------
\renewcommand{\@makechapterhead}[1]{
	\@blankoddpage
	\vspace*{100\p@}
  	{
		\parindent
		\z@
		\raggedright
		%\normalfont
		\vspace{5pt}
		%\hrule 
		%
		%	Chapter Number
		%
		\ifnum \c@secnumdepth >\m@ne
			%\bf \Huge \chaptername\space \thechapter	% Chapter number
			\begin{flushright}
				{\fontsize{256}{307}\selectfont \color{uegray} \thechapter}
			\end{flushright}
			%\par\nobreak
			%\vskip 20\p@
			\vspace{.75cm}
			%\\
		\fi
		%
		%	Chapter title
		%
		\begin{flushright}
			{\fontsize{32}{38}\selectfont \color{uegray} #1}
		\end{flushright}		
		%\par
		\vspace{5pt}
		%\hrule
		\nobreak
		\vskip 40\p@
	}
}
% ----------------------------------------------------------------
% Not numbered chapter
% ----------------------------------------------------------------
\renewcommand{\@makeschapterhead}[1]{
	\@blankoddpage
	\vspace*{100\p@}
	{
		\parindent
		\z@
		\raggedright
		\vspace{5pt}
		\interlinepenalty\@M
		%
		%	Chapter title
		%
		\begin{flushright}
			{\fontsize{32}{38}\selectfont \color{uegray} #1}
		\end{flushright}
		\vspace{5pt}
		\nobreak
		\vskip 40\p@
	}
}


\endinput
