%%
%% This is file `promec-ufrgs.cls'.
%%
%% promec-ufrgs.cls
%% Classe para teses e dissertacoes do PROMEC/UFRGS conforme ABNT.
%% Baseada em abntex2, concentra toda a maquinaria de formato do
%% template (carregamento de pacotes, capa, folha de aprovacao,
%% elementos pre-textuais) para que o usuario final edite apenas
%% os arquivos de conteudo (tex/Cover.tex, cap/*.tex, etc.) e nao
%% precise tocar neste arquivo.
%%
%% Copyright 2026 Boris N. Rojo Tanzi, Barbara Minosso
%%
%% 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
%%   https://www.latex-project.org/lppl.txt
%% and version 1.3c or later is part of all distributions of
%% LaTeX version 2008 or later.
%%
%% This work has the LPPL maintenance status `maintained'.
%%
%% The Current Maintainers of this work are Boris N. Rojo Tanzi
%% and Barbara Minosso.
%%
%% This work consists of the file promec-ufrgs.cls.
%%
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{promec-ufrgs}[2026/07/16 v0.1 Classe para teses e dissertacoes do PROMEC/UFRGS conforme ABNT]

%---------------------------------------
%	CLASSE BASE (abntex2)
%---------------------------------------
\LoadClass[
		12pt,				% tamanho da fonte
		openright,			% capitulos comecam em pag impar (insere pagina vazia caso preciso)
		oneside,			% para impressao em recto e verso. Oposto a oneside: twoside
		a4paper,			% tamanho do papel.
		sumario=tradicional,
		% -- opcoes do pacote babel --
		english,			% idioma adicional para hifenizacao
		french,				% idioma adicional para hifenizacao
		spanish,			% idioma adicional para hifenizacao
		brazil,				% o ultimo idioma e o principal do documento
	]{abntex2}

%---------------------------------------
%	CRIACAO DE VARIAVEIS DE CAPA
%---------------------------------------
\newcommand{\datacompleta}[1]{\newcommand{\imprimirdatacompleta}{#1\xspace}}
\newcommand{\autortitle}[1]{\newcommand{\imprimirautortitle}{#1\xspace}}
\newcommand{\area}[1]{\newcommand{\imprimirarea}{#1\xspace}}
\newcommand{\status}[1]{\newcommand{\statusdeff}{#1}}
\newcommand{\banca}[1]{\newcommand{\imprimirbanca}{#1\xspace}}
\newcommand{\coordinador}[1]{\newcommand{\imprimircoordinador}{#1\xspace}}

\newcommand{\numcoorientador}[1]{\newcommand{\coorientadornum}{#1\xspace}}

\renewcommand{\tipotrabalho}[1]{\newcommand{\tipodocumento}{#1\xspace}}

\renewcommand{\imprimirtipotrabalho}{
	\ifthenelse{\equal{\tipodocumento}{Mestre\xspace}}
		{Disserta\c{c}\~{a}o\xspace}%
		{%
		\ifthenelse{\equal{\tipodocumento}{Proposta\xspace}}%
		{Proposta de Doutorado\xspace}%
		{%
		\ifthenelse{\equal{\tipodocumento}{Qualifica\xspace}}%
		{Exame de Qualifica\c{c}\~{a}o\xspace}%
		{%
		\ifthenelse{\equal{\tipodocumento}{Doutor\xspace}}%
		{Tese\xspace}%
		{{\color{red}-- ERROR: tipotrabalho --}
		}}}}%
	}

\newcommand{\imprimirmd}{
	\ifthenelse{\equal{\tipodocumento}{Mestre\xspace}}%
		{Mestre em Engenharia\xspace}%
		{%
		\ifthenelse{\equal{\tipodocumento}{Proposta\xspace}}%
		{Doutorado em Engenharia\xspace}%
		{%
		\ifthenelse{\equal{\tipodocumento}{Qualifica\xspace}}%
		{Doutorado em Engenharia\xspace}
		{%
		\ifthenelse{\equal{\tipodocumento}{Doutor\xspace}}%
		{Doutor em Engenharia\xspace}%
		{{\color{red}-- ERROR: tipotrabalho --}}
		}}}%
	}

\newcommand{\imprimircapatipodocumento}{
	\ifthenelse{\equal{\tipodocumento}{Mestre\xspace}}%
		{Disserta\c{c}\~{a}o para obten\c{c}\~{a}o do T\'{i}tulo de\\%
			\imprimirmd\xspace}%
		{%
		\ifthenelse{\equal{\tipodocumento}{Proposta\xspace}}%
			{Proposta de Doutorado\\%
				UFRGS - PROMEC\xspace}%
			{%
			\ifthenelse{\equal{\tipodocumento}{Qualifica\xspace}}%
				{Exame de Qualifica\c{c}\~{a}o para obten\c{c}\~{a}o do T\'{i}tulo de\\%
					\imprimirmd\xspace}%
				{%
				\ifthenelse{\equal{\tipodocumento}{Doutor\xspace}}%
				{Tese para obten\c{c}\~{a}o do T\'{i}tulo de\\%
					\imprimirmd\xspace}%
				{{\color{red}-- ERROR: tipotrabalho --}}
				}%
			}%
	}%
}%

\newcommand{\imprimirstatus}{
	\ifthenelse{\equal{\statusdeff}{Avaliacao}}%
		{Comiss\~{a}o de Avalia\c{c}\~{a}o:\xspace}%
		{Aprovada por:\xspace}
}

\renewcommand{\pretextual}{
	\pagenumbering{roman} %%% ou \pagenumbering{Roman}
	\aliaspagestyle{chapter}{plain}% customizing chapter pagestyle
	\pagestyle{plain}
	\aliaspagestyle{cleared}{empty}
	\aliaspagestyle{part}{plain}
}

\renewcommand{\textual}{
	\pagenumbering{arabic}
	\aliaspagestyle{chapter}{plain}
	\pagestyle{plain}
	\aliaspagestyle{cleared}{empty}
	\aliaspagestyle{part}{plain}
}

%---------------------------------------
%	FUNDAMENTAL
%---------------------------------------
\RequirePackage{lmodern}			% Usa a fonte Latin Modern
\RequirePackage[T1]{fontenc}		% Selecao de codigos de fonte.
\RequirePackage[utf8]{inputenc}		% Codificacao do documento (conversao automatica dos acentos)
\RequirePackage{indentfirst}		% Indenta o primeiro paragrafo de cada secao.
\RequirePackage{color,xcolor}		% Controle das cores
\RequirePackage{graphicx}			% Inclusao de graficos
\RequirePackage{microtype} 			% para melhorias de justificacao
\RequirePackage{ifthen}
\RequirePackage{xspace}			% usado pelas macros de dados da capa (\datacompleta, \autortitle, etc.)

%---------------------------------------
%	GRAFICOS E TABELAS
%---------------------------------------
\RequirePackage{graphicx,epstopdf,rotating,adjustbox}
\RequirePackage{pgfplots,pgfplotstable}
\RequirePackage{pgfgantt}
\usepgfplotslibrary{statistics,groupplots}
\pgfplotsset{width=0.95\linewidth,/pgfplots/tick scale binop=\times,compat=1.13}
\pgfplotstableset{use comma,every mark/.append style={solid}}
\ganttset{%group/.append style={orange},
	milestone/.append style={red},
	progress label node anchor/.append style={text=red}}
\RequirePackage{tabularx,tabulary,multirow,makecell,booktabs,multicol,colortbl,longtable}
\RequirePackage{tikz}
\usetikzlibrary{shapes,arrows,plotmarks,patterns,spy,chains,backgrounds}
\DeclareGraphicsExtensions{.pdf,.png,.jpg,.eps}
\RequirePackage{import}
\RequirePackage{pdfpages}
\RequirePackage{float}
\RequirePackage{longfigure}
\renewcommand{\arraystretch}{1.3}
\RequirePackage{ncccomma}

\RequirePackage{svg}
\svgsetup{inkscapeexe=inkscape, inkscape=inkscape -z -D}

%---------------------------------------
%	MATEMATICA
%---------------------------------------
\RequirePackage{amsfonts,amsmath,amsthm,amssymb}
\RequirePackage{bm}
\RequirePackage{mathtools,xparse}
\RequirePackage{dsfont}

%---------------------------------------
%	FLUTUANTES (FIGURAS/TABELAS)
%---------------------------------------
\RequirePackage[justification=centering]{caption}
\RequirePackage{subcaption}
\RequirePackage[para]{threeparttable}
\RequirePackage{capt-of}
\RequirePackage{standalone}
\RequirePackage{cleveref}

%---------------------------------------
%	CODIGO FONTE
%---------------------------------------
\RequirePackage{listings} % imprime codigo fonte (ex.: C/C++/Python/Fortran/MATLAB...)
\lstset{literate=
	{á}{{\'a}}1 {é}{{\'e}}1 {í}{{\'i}}1 {ó}{{\'o}}1 {ú}{{\'u}}1
	{Á}{{\'A}}1 {É}{{\'E}}1 {Í}{{\'I}}1 {Ó}{{\'O}}1 {Ú}{{\'U}}1
	{à}{{\`a}}1 {è}{{\`e}}1 {ì}{{\`i}}1 {ò}{{\`o}}1 {ù}{{\`u}}1
	{À}{{\`A}}1 {È}{{\'E}}1 {Ì}{{\`I}}1 {Ò}{{\`O}}1 {Ù}{{\`U}}1
	{ä}{{\"a}}1 {ë}{{\"e}}1 {ï}{{\"i}}1 {ö}{{\"o}}1 {ü}{{\"u}}1
	{Ä}{{\"A}}1 {Ë}{{\"E}}1 {Ï}{{\"I}}1 {Ö}{{\"O}}1 {Ü}{{\"U}}1
	{â}{{\^a}}1 {ê}{{\^e}}1 {î}{{\^i}}1 {ô}{{\^o}}1 {û}{{\^u}}1
	{Â}{{\^A}}1 {Ê}{{\^E}}1 {Î}{{\^I}}1 {Ô}{{\^O}}1 {Û}{{\^U}}1
	{ã}{{\~a}}1 {ẽ}{{\~e}}1 {ĩ}{{\~i}}1 {õ}{{\~o}}1 {ũ}{{\~u}}1
	{Ã}{{\~A}}1 {Ẽ}{{\~E}}1 {Ĩ}{{\~I}}1 {Õ}{{\~O}}1 {Ũ}{{\~U}}1
	{œ}{{\oe}}1 {Œ}{{\OE}}1 {æ}{{\ae}}1 {Æ}{{\AE}}1 {ß}{{\ss}}1
	{ű}{{\H{u}}}1 {Ű}{{\H{U}}}1 {ő}{{\H{o}}}1 {Ő}{{\H{O}}}1
	{ç}{{\c c}}1 {Ç}{{\c C}}1 {ø}{{\o}}1 {å}{{\r a}}1 {Å}{{\r A}}1
	{€}{{\euro}}1 {£}{{\pounds}}1
}
\RequirePackage{mfirstuc}

%---------------------------------------
%	REFERENCIAS E GLOSSARIO (padrao ABNT)
%---------------------------------------
\RequirePackage[symbols,acronyms,abbreviations,automake,acronym, nomain, nonumberlist, style=super, style=alttreegroup,]{glossaries-extra}
\setabbreviationstyle[acronym]{long-short-user}
\RequirePackage{breakurl}
\RequirePackage[alf,abnt-etal-cite=2,abnt-etal-list=2,]{abntex2cite}	% Citacoes padrao ABNT
\RequirePackage{glossary-longbooktabs}
\RequirePackage{nomencl}
\RequirePackage{url}

\glssetcategoryattribute{acronym}{glossdesc}{title}
\MFUhyphentrue
\renewcommand{\glsxtrpostdescacronym}{%
	\ifglshasfield{\glsxtruserfield}{\glscurrententrylabel}%
	{\newline \textit{\glscurrentfieldvalue}}%
	{}%
}

%---------------------------------------
%	UNIDADES SI
%---------------------------------------
\RequirePackage{siunitx}
\sisetup{detect-all}
\sisetup{output-decimal-marker={,},round-precision=2}

\DeclareSIUnit \voltampere {VA}
\DeclareSIUnit \var {VAr}
\DeclareSIUnit \rpm {rpm}
\DeclareSIUnit \gmm {gmm}
\DeclareSIUnit \angstrom {\protect \text{Å}}
\DeclareSIUnit \sample {S}

%---------------------------------------
%	DIVERSOS
%---------------------------------------
\RequirePackage{soul}
\RequirePackage{lipsum}

%---------------------------------------
%	FIGURAS
%---------------------------------------
\newenvironment{subsubfigure}[2][]{%
	\begin{subfigure}[#1]{#2}%
		\stepcounter{subsubfigure}%
		\renewcommand{\thesubfigure}{\alph{subfigure}.\arabic{subsubfigure}}%
	}{%
		\addtocounter{subfigure}{-1}%
	\end{subfigure}%
}
\newcounter{subsubfigure}

%---------------------------------------
%	CAPA E FOLHA DE APROVACAO
%	(usam \titulo, \autor, \orientador etc.,
%	definidos pelo usuario em tex/Cover.tex)
%---------------------------------------
\AtBeginDocument{%
	\hypersetup{
		pdftitle={\@title},
		pdfauthor={\@author},
		pdfsubject={\imprimirpreambulo},
		pdfcreator={PROMEC/UFRGS},
		pdfkeywords={PROMEC, UFRGS, ABNT},
		colorlinks=true,       		% false: boxed links; true: colored links (no box)
		linkcolor=black,          	% color of internal links
		citecolor=black,        		% color of links to bibliography
		filecolor=black,      		% color of file links
		urlcolor=black,
		bookmarksdepth=4,
		unicode=true,
	}
}

\makeindex
\makeglossaries

\renewcommand{\imprimircapa}{
	\begin{capa}
		\begin{center}
			\ABNTEXchapterfont
			{MINIST\'ERIO DA EDUCA\c{C}\~AO\\
				UNIVERSIDADE FEDERAL DO RIO GRANDE DO SUL\\
				PROGRAMA DE  P\'OS-GRADUA\c{C}\~AO EM ENGENHARIA MEC\^ANICA}
		\end{center}
		%
		\vspace{45mm}
		%
		\begin{center}
			{\ABNTEXchapterfont\MakeUppercase{\imprimirtitulo}}
		\end{center}
		%
		\vspace{12pt}
		%
		\begin{center}
			por \\ \vspace{15mm}
			\imprimirautor
		\end{center}
		%
		\vfill
		%
		\begin{center}
			\imprimircapatipodocumento
		\end{center}
		%
		\vfill
		\begin{center}
			\imprimirlocal, \imprimirdata
		\end{center}
	\end{capa}
}

\newcommand{\imprimirfolhadeaprovacao}{
	\setcounter{page}{2}
	\begin{folhadeaprovacao}
		\begin{center}
			{\ABNTEXchapterfont\MakeUppercase{\imprimirtitulo}}\\
			\null\vspace{12pt plus 0pt minus 12pt}
			por \\
			\null\vspace{0cm}
			\imprimirautor\\
			\imprimirautortitle
		\end{center}
		%
		\null \vfill
		{%
		\imprimirtipotrabalho~\ifthenelse{\equal{\tipodocumento}{Qualifica\xspace}}{submetido\xspace}{submetida\xspace}
		ao Corpo Docente do Programa de P\'{o}s-Gradua\c{c}\~{a}o em Engenharia Mec\^{a}nica, PROMEC, da Escola de Engenharia da Universidade Federal do Rio Grande do Sul, como parte dos requisitos necess\'{a}rios para a obten\c{c}\~{a}o do T\'{i}tulo de
		\vspace{24pt plus 0pt minus 24pt}
		}
		%
		\begin{center} \imprimirmd \end{center}
		%
		\vfill\noindent\'{A}rea de Concentra\c{c}\~{a}o: \imprimirarea\vspace{18pt}

		\noindent Orientador: \imprimirorientador
		\vspace{6pt}
		\ifthenelse{\equal{\coorientadornum}{0\xspace}}{}%
			{%
			\ifthenelse{\equal{\coorientadornum}{1\xspace}}
				{\vfill\noindent Co-Orientador: %
					\begin{minipage}[t]{13.3cm}
						\imprimircoorientador\\
					\end{minipage}}%
				{\vfill%
				\noindent Co-Orientadores: %
					\begin{minipage}[t]{13.3cm}
						\imprimircoorientador\\
					\end{minipage}}}
		%
		\vspace{12pt}
		\begin{flushleft}
			\imprimirstatus
		\end{flushleft}
		\vspace{12pt}
		{\hfill
		\begin{minipage}[t]{14cm}
				\imprimirbanca\\
		\end{minipage}
		}%
		%
		\vspace{18pt plus 0pt minus 18pt}
		\begin{flushright}
			\imprimircoordinador\\
			Coordenador do PROMEC
		\end{flushright}
		\vfill
		%
		\begin{center}
			\imprimirlocal, \imprimirdatacompleta
		\end{center}

	\end{folhadeaprovacao}
}

%---------------------------------------
%	SEQUENCIA DE ELEMENTOS PRE-TEXTUAIS
%	(equivalente ao antigo tex/format.tex)
%---------------------------------------
\newcommand{\promecfrontmatter}{%
	\selectlanguage{brazil}
	\sloppy
	\frenchspacing % Retira espaco extra obsoleto entre as frases.

	% Capa
	\imprimircapa

	\pretextual
	% Folha de rosto (o * indica que havera a ficha bibliografica)
	\imprimirfolhadeaprovacao

	% Folha de Publicacoes (opcional: so' e' gerada se o arquivo existir)
	\IfFileExists{tex/Publication.tex}{%
		\input{tex/Publication.tex}
		\cleardoublepage
	}{}

	% Folha de dedicacoes (opcional)
	\IfFileExists{tex/Dedication.tex}{\input{tex/Dedication.tex}}{}

	% Agradecimentos (opcional)
	\IfFileExists{tex/Acknowledgment.tex}{\input{tex/Acknowledgment.tex}}{}

	% Resumo (opcional)
	\IfFileExists{tex/Abstract.tex}{\input{tex/Abstract.tex}}{}

	%% Lista de ilustracoes
	\pdfbookmark[0]{\listfigurename}{lof}
	\listoffigures*
	\cleardoublepage

	% Lista de tabelas
	\pdfbookmark[0]{\listtablename}{lot}
	\listoftables*
	\cleardoublepage

	% Lista de acronimos, abreviaturas, siglas e simbolos
	\frontmatter
	%
	\printglossary[type=abbreviations,
				   title={Lista de Abreviaturas e Siglas},
				   nopostdot,
				   style=super,
				   nonumberlist,
				   ]
	\cleardoublepage
	%
	\printglossary[type=symbols,title={Lista de S\'{i}mbolos},nopostdot,style=super,nonumberlist,style=long4col,]
	\cleardoublepage
	%
	\pdfbookmark[0]{\contentsname}{toc}
	\tableofcontents*
	\cleardoublepage
	%
	\mainmatter
	\textual
}

\endinput
%%
%% End of file `promec-ufrgs.cls'.
