%%
%% This is file `fei.cls',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% fei.dtx  (with options: `class')
%% -----------------------------------------------------------------------------------------------------
%% fei --- Class for the creation of academic works under the typographic rules of FEI University Center
%% Author: Douglas De Rizzo Meneghetti
%% E-mail: douglasrizzo@fei.edu.br
%% 
%% Released under the LaTeX Project Public License v1.3c or later
%% See http://www.latex-project.org/lppl.txt
%% -----------------------------------------------------------------------------------------------------
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{fei}[2014/05/06 0.9 Modelo da FEI]
\LoadClass{report}
\DeclareOption{xindy}{
  \PassOptionsToPackage{\CurrentOption}{imakeidx}
  \PassOptionsToPackage{\CurrentOption}{glossaries}
}

\DeclareOption{rascunho}
{
\newif\iflogvar
}

\DeclareOption{final}
{
\newif\iflogvar
\logvartrue
}

\ExecuteOptions{final} % final ^^c3^^a9 padr^^c3^^a3o

\ProcessOptions\relax % processa todas as op^^c3^^a7^^c3^^b5es

\setlength{\paperheight}{297mm}
\setlength{\paperwidth}{210mm}
\RequirePackage[top=3cm,bottom=2cm,left=3cm,right=2cm]{geometry}

\RequirePackage{fancyhdr}
\fancyhf{}
\rhead{\thepage}
\renewcommand{\footrulewidth}{0pt}
\renewcommand{\headrulewidth}{0pt}
\setlength{\headheight}{14.4pt}

\RequirePackage[english,brazil]{babel}
\RequirePackage[T1]{fontenc}

\RequirePackage{setspace}      % pacote para controlar o espacamento
\onehalfspace                  % espacamento de 1,5 (segundo manual)
\setlength{\parindent}{1.25cm} % recuo do paragrafo

\renewcommand{\normalsize}{\fontsize{12pt}{14.4pt}\selectfont} % fonte do texto
\renewcommand{\footnotesize}{\fontsize{10pt}{12pt}\selectfont} % fonte das notas de rodap^^c3^^a9
\RequirePackage[font={small,singlespacing},justification=justified,labelsep=endash]{caption} % fontes das legendas

\pagenumbering{arabic} % estilo da numera^^c3^^a7^^c3^^a3o das p^^c3^^a1ginas
\pagestyle{fancy} % estilo dos cabe^^c3^^a7alhos/rodap^^c3^^a9s
\selectlanguage{brazil} % idioma do documento

\widowpenalty=10000
\clubpenalty=10000

\RequirePackage{mathtools}     % matematica
\RequirePackage{lmodern}       % Latin Modern, fontes tipogr^^c3^^a1ficas mais recentes que as do Knuth (Computer Modern)
\RequirePackage{times}         % Times New Roman como fonte de tudo
\RequirePackage{graphicx}      % figuras
\RequirePackage{morewrites}    % permite ao LaTeX escrever em mais de 16 arquivos auxiliares simultaneamente

\RequirePackage[plain,portuguese,algochapter,linesnumbered,inoutnumbered]{algorithm2e}
\SetKwInput{Entrada}{Entrada}
\SetKwInput{Saida}{Sa\'ida}
\SetKwInput{Dados}{Dados}
\SetKwInput{Resultado}{Resultado}
\SetKw{Ate}{at\'e}
\SetKw{KwRetorna}{retorna}
\SetKw{Retorna}{retorna}
\SetKwBlock{Inicio}{in\'icio}{fim}
\SetKwIF{Se}{SenaoSe}{Senao}{se}{ent\~ao}{sen\~ao se}{sen\~ao}{fim se}
\SetKwSwitch{Selec}{Caso}{Outro}{selecione}{fa^^c3^^a7a}{caso}{sen\~ao}{fim caso}{fim selec}
\SetKwFor{Para}{para}{fa\c{c}a}{fim para}
\SetKwFor{ParaPar}{para}{fa\c{c}a em paralelo}{fim para}
\SetKwFor{ParaCada}{para cada}{fa\c{c}a}{fim para cada}
\SetKwFor{ParaTodo}{para todo}{fa\c{c}a}{fim para todo}
\SetKwFor{Enqto}{enquanto}{fa\c{c}a}{fim enqto}
\SetKwRepeat{Repita}{repita}{at\'e}

\SetAlgoCaptionSeparator{--} % separador da legenda
\SetAlCapFnt{\normalfont} % fonte da legenda
\SetAlCapSkip{10pt} % espa^^c3^^a7amento entre algoritmo e legenda
\RequirePackage{amsthm,thmtools}
\renewcommand{\listtheoremname}{Lista de Teoremas} % traduz nome da lista de teoremas

\declaretheoremstyle[
spaceabove=6pt, spacebelow=6pt,
headfont=\normalfont\bfseries,
notefont=\normalfont\bfseries, notebraces={-- }{},
bodyfont=\normalfont,
postheadspace=1em,
qed=\qedsymbol
]{feistyle}

\declaretheorem[style=feistyle,name=Axioma]{axioma}
\declaretheorem[style=feistyle,name=Teorema]{teorema}
\declaretheorem[style=feistyle,name=Lema]{lema}
\declaretheorem[style=feistyle,name=Hip\'otese]{hipotese}
\declaretheorem[style=feistyle,name=Proposi\c{c}\~ao]{proposicao}
\declaretheorem[style=feistyle,name=Conjectura]{conjectura}
\declaretheorem[style=feistyle,name=Paradoxo]{paradoxo}
\declaretheorem[style=feistyle,name=Corol\'ario]{corolario}
\declaretheorem[style=feistyle,name=Defini\c{c}\~ao]{definicao}
\declaretheorem[style=feistyle,name=Exemplo]{exemplo}
\declaretheorem[style=remark,name=Demonstra\c{c}\~ao,qed=\qedsymbol,numbered=no]{prova}

\usepackage{chngcntr}
\counterwithout{figure}{chapter}
\counterwithout{table}{chapter}
\counterwithout{algocf}{chapter}
\counterwithout{equation}{chapter}

\renewcommand{\figurename}{\fontsize{10pt}{10pt}\selectfont Figura}
\renewcommand{\tablename}{\fontsize{10pt}{10pt}\selectfont Tabela}
\renewenvironment{itemize}{\begin{enumerate}}{\end{enumerate}} % troca o itemize pelo enumerate (seguindo o manual da biblioteca)
\renewcommand{\theenumi}{\alph{enumi})}                        % deixa as listas com letras no lugar do numero
\renewcommand{\labelenumi}{\theenumi}                          % continuacao

 % troca a numeracao no segundo nivel para letras
\renewcommand{\theenumii}{--}
\renewcommand{\labelenumii}{\theenumii}

\renewcommand{\part}{% n^^c3^^a3o usado no texto, s^^c3^^b3 para algumas p^^c3^^a1ginas (resumo, abstract, agradecimentos...)
\@startsection{part}{-1}{0pt}{2\baselineskip}{2\baselineskip}{\clearpage\fontsize{12pt}{14.4pt}\centering\bf\MakeUppercase}}

\renewcommand{\chapter}{%
\@startsection{chapter}{0}{0pt}{12pt}{2\baselineskip}{\clearpage\thispagestyle{fancy}\fontsize{12pt}{14.4pt}\bf\MakeUppercase}}

\renewcommand{\section}{%
\@startsection{section}{1}{0pt}{2\baselineskip}{2\baselineskip}{\fontsize{12pt}{14.4pt}\bf}}

\renewcommand{\subsection}{%
\@startsection{subsection}{2}{0pt}{2\baselineskip}{2\baselineskip}{\fontsize{12pt}{14.4pt}}}

\renewcommand{\subsubsection}{%
\@startsection{subsubsection}{3}{0pt}{2\baselineskip}{2\baselineskip}{\fontsize{12pt}{14.4pt}}}

\setcounter{secnumdepth}{3} % numerar divis^^c3^^b5es at^^c3^^a9 o terceiro n^^c3^^advel (subsubsection)
\setcounter{tocdepth}{3} % incluir divis^^c3^^b5es no sum^^c3^^a1rio at^^c3^^a9 o terceiro n^^c3^^advel (subsubsection)

\RequirePackage{tocloft} % para poder fazer mais coisas no sumario e nas listas

%% configuracao do sumario e listas de tabelas e figuras
\renewcommand{\cfttoctitlefont}{\clearpage\thispagestyle{empty}\hfil\bf\MakeUppercase}
\renewcommand{\cftloftitlefont}{\clearpage\thispagestyle{empty}\hfill\bf\MakeUppercase}
\renewcommand{\cftlottitlefont}{\clearpage\thispagestyle{empty}\hfill\bf\MakeUppercase}
\renewcommand{\cftafterloftitle}{\hfill}
\renewcommand{\cftafterlottitle}{\hfill}

\renewcommand{\cftchapindent}{0pt}
\renewcommand{\cftsecindent}{0pt}
\renewcommand{\cftsubsecindent}{0pt}
\renewcommand{\cftsubsubsecindent}{0pt}

\renewcommand{\cftchapfont}{\bfseries} % coloca o titulo do cap^^c3^^adtulo em negrito
\renewcommand{\cftchappagefont}{} % o n^^c3^^bamero da p^^c3^^a1gina do cap^^c3^^adtulo n^^c3^^a3o ^^c3^^a9 em negrito
\renewcommand{\cftsecfont}{\bfseries} % coloca o titulo da secao emm negrito
\renewcommand{\cftpartleader}{\cftdotfill{\cftdotsep}} % pontos no sum^^c3^^a1rio para partes
\renewcommand{\cftchapleader}{\cftdotfill{\cftdotsep}} % pontos no sum^^c3^^a1rio para cap^^c3^^adtulos

\renewcommand{\listofalgorithms}{\part*{\listalgorithmcfname}\thispagestyle{empty}\@starttoc{loa}}
\renewcommand{\listoftheorems}{\part*{\listtheoremname}\thispagestyle{empty}\@starttoc{loe}}

\def\and{\\} % modifica fun^^c3^^a7^^c3^^a3o do comando \and para ele ser usado na declara^^c3^^a7^^c3^^a3o de m^^c3^^baltiplos autores

\renewcommand{\maketitle}{
\clearpage
\thispagestyle{empty}
\begin{center}
\textbf{
\MakeUppercase{\@instituicao}\\[\baselineskip]
\uppercase\expandafter{\@author}
\vfill
\MakeUppercase{\@title}\ifthenelse{\isundefined{\@subtitulo}}{}{: \@subtitulo}}
\vfill
\@cidade\\
\number\year
\end{center}
}

\newenvironment{folhaderosto}{
\clearpage
\thispagestyle{empty}
\begin{center}
\uppercase\expandafter{\@author}\\
\vspace*{0.45\textheight}
\textbf{\MakeUppercase{\@title}}\ifthenelse{\isundefined{\@subtitulo}}{}{: \@subtitulo}
\vfill
\begin{flushright}
\begin{minipage}{0.55\textwidth}}{\end{minipage}{}
\end{flushright}
\vfill
\@cidade\\
\number\year
\end{center}}

\RequirePackage{pdfpages}
\RequirePackage{ifthen}
\newcommand{\folhadeaprovacao}{
\iflogvar
  \includepdf{ata.pdf}
\else
  \clearpage\thispagestyle{empty}\mbox{}\vfill\begin{center}\begin{Huge}Folha de aprova\c{c}\~{a}o\end{Huge}\vfill\end{center}
\fi
}

\newcommand{\fichacatalografica}{
    \addtocounter{page}{-1}
\iflogvar
\includepdf{ficha.pdf}
\else
\clearpage\thispagestyle{empty}\mbox{}\vfill\begin{center}\begin{Huge}Ficha catalogr\'{a}fica\end{Huge}\vfill\end{center}
\fi
}

\newcommand{\subtitulo}[1]{\def\@subtitulo{#1}}

\def\@cidade{S\~ao Bernardo do Campo}
\newcommand{\cidade}[1]{\def\@cidade{#1}}

\def\@instituicao{Centro Universit\'ario da FEI}
\newcommand{\instituicao}[1]{\def\@instituicao{#1}}

\newcommand{\dedicatoria}[1]{
\clearpage
\thispagestyle{empty}
\begin{flushleft}
\vspace*{0.5\paperheight\relax}
\hspace*{0.5\paperwidth\relax}
\begin{minipage}[l]{0.35 \textwidth}
#1
\end{minipage}
\end{flushleft}
}

\newcommand{\epigrafe}[2]{
\clearpage
\thispagestyle{empty}
\begin{flushleft}
\vspace*{0.5\paperheight\relax}
\hspace*{0.4\paperwidth\relax}
\begin{minipage}[l]{0.5\textwidth}
\textit{``{#1}''
\\
#2}
\end{minipage}
\end{flushleft}
}

\newenvironment{resumo}{\part*{Resumo}\thispagestyle{empty}\begin{singlespace}\noindent\normalsize}{\end{singlespace}}

\renewenvironment{abstract}{\selectlanguage{english}\part*{Abstract}\thispagestyle{empty}\begin{singlespace}\noindent\normalsize}{\end{singlespace}\selectlanguage{brazil}}

\newenvironment{agradecimentos}{\part*{Agradecimentos}\thispagestyle{empty}}{}

\RequirePackage{imakeidx}
\renewcommand{\indexname}{\'Indice}
\let\oldmakeindex\makeindex
\let\oldprintindex\printindex
\renewcommand{\makeindex}{\oldmakeindex[title=\hfill \'INDICE \hfill \mbox{}]}
\renewcommand{\printindex}{\addcontentsline{toc}{chapter}{\'INDICE}%
\renewcommand{\chapter}{%
\@startsection{chapter}{0}{0pt}{12pt}{2\baselineskip}{\clearpage\fontsize{12pt}{14.4pt}\bf\MakeUppercase}}%
\oldprintindex}%

\RequirePackage[nogroupskip,nomain,acronym,nonumberlist]{glossaries}
\renewcommand*{\acronymname}{\hfill Lista de Abreviaturas \hfill \mbox{}}
\newglossary{simbolos}{sym}{sbl}{\hfill Lista de S\'imbolos \hfill \mbox{}}

\newcommand{\palavraschave}[1]{\mbox{}\\\noindent Palavras-chave: #1}% o resumo pede palavras chave no final
\newcommand{\keywords}[1]{\mbox{}\\\noindent Keywords: #1}% mesma coisa, mas pro abstract

\renewcommand{\appendix}{%
\renewcommand{\chaptername}{\appendixname}%
\setcounter{chapter}{0}% zera o contador do cap^^c3^^adtulo
\renewcommand{\thechapter}{\Alph{chapter}}% deixa o contador do cap^^c3^^adtulo em alfab^^c3^^a9tico
\renewcommand{\chapter}[1]{% redefine o comando do cap^^c3^^adtulo
\stepcounter{chapter}% soma 1 ao contador do cap^^c3^^adtulo
\clearpage\thispagestyle{empty}\mbox{}\vfill\begin{center}\MakeUppercase{AP\^ENDICE \thechapter\ -- ##1}\end{center}\vfill% adiciona uma folha com a letra e t^^c3^^adtulo do ap^^c3^^aandice
\addcontentsline{toc}{chapter}{AP\^ENDICE \Alph{chapter} -- ##1}%
\newpage%
}%
}%

\newcommand{\anexos}{%
\renewcommand{\chaptername}{Anexo}%
\setcounter{chapter}{0}%
\renewcommand{\thechapter}{\Alph{chapter}}%
\renewcommand{\chapter}[1]{%
\stepcounter{chapter}%
\clearpage\thispagestyle{empty}\mbox{}\vfill\begin{center}\MakeUppercase{ANEXO \thechapter\ -- ##1}\end{center}\vfill%
\addcontentsline{toc}{chapter}{ANEXO \Alph{chapter} -- ##1}%
\newpage%
}%
}%

\RequirePackage[pdftex,pdfborder={0 0 0},colorlinks={false}]{hyperref}

\RequirePackage[alf,abnt-emphasize=bf]{abntex2cite} %abnTeX alfab^^c3^^a9tico com t^^c3^^adtulos das publica^^c3^^a7^^c3^^b5es em negrito nas refer^^c3^^aancias (como no modelo antigo da ABNT)

\renewenvironment{quote}
               {\begin{singlespace}\list{}{%
               \fontsize{10pt}{1em}%
               \leftmargin=2cm \rightmargin=2cm}%
               \item\relax\ignorespaces}
               {\endlist\end{singlespace}}

\renewenvironment{quotation}
               {\begin{singlespace}\list{}{%
               \fontsize{10pt}{1em}%
               \leftmargin=2cm \rightmargin=2cm%
               \listparindent .5cm \itemindent}%
                \item\relax}
               {\endlist\end{singlespace}}

\let\oldbibliography\bibliography
\renewcommand{\bibliography}[1]{%
\renewcommand{\bibname}{\hfill Refer\^encias \hfill\mbox{}}% muda o nome do titulo (modelo da biblioteca)
\clearpage
\addcontentsline{toc}{chapter}{REFER\^ENCIAS}% adiciona o titulo ao sumario
\begin{singlespace}
\oldbibliography{#1}% adiciona realmente a bibliografia
\end{singlespace}
}
%% 
%% Copyright (C) 2014 by Douglas De Rizzo Meneghetti <douglasrizzo@fei.edu.br>
%% 
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License (LPPL), either
%% version 1.3c of this license or (at your option) any later
%% version.  The latest version of this license is in the file:
%% 
%% http://www.latex-project.org/lppl.txt
%% 
%% This work is "maintained" (as per LPPL maintenance status) by
%% Douglas De Rizzo Meneghetti.
%% 
%% This work consists of the file  fei.dtx,
%% and the derived files           fei.pdf and
%%                                 fei.cls.
%% 
%%
%% End of file `fei.cls'.
