%%% ====================================================
%%% @LaTeX-file{
%%%    filename  = "TCAM.cls",
%%%    date      = "24/05/2020",
%%%    author    = "Ana Claudia Ribeiro",
%%%    abstract  = "Class for TCAM authors.",
%%% }
%%% ====================================================
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{TCAM}

\RequirePackage{amsthm}

\LoadClass[10pt, a4paper, twoside]{article}
\setlength{\textwidth}{12.7cm}
\setlength{\textheight}{19.0cm}
\setlength{\topmargin}{0cm}
\setlength{\oddsidemargin}{1.61cm}
\setlength{\evensidemargin}{1.61cm}

\renewcommand{\encodingdefault}{T1}

\renewcommand{\theequation}{\thesection.\arabic{equation}}



\usepackage{titlesec}
\titleformat{\section}
            {\normalfont\Large\bfseries}
            {\thesection.\setcounter{equation}{0} 
                                \setcounter{thmTEMA}{0}
                                \setcounter{teoTEMA}{0}
                                \setcounter{lemmaTEMA}{0}
                                \setcounter{lemaTEMA}{0} 
                                \setcounter{defTEMAi}{0}
                                \setcounter{defTEMAp}{0} 
                                \setcounter{propTEMAi}{0}
                                \setcounter{propTEMAp}{0}
                                }{-20mm}{}

\titleformat{\subsection}
            {\normalfont\large\bfseries}{\thesubsection.}{2mm}{}
\titleformat{\subsubsection}
            {\normalfont\normalsize\bfseries}{\thesubsubsection.}{1mm}{}


\newcommand{\newsec}[1]{\section{#1}\setcounter{equation}{0} 
                                    \setcounter{thmTEMA}{0}
                                    \setcounter{teoTEMA}{0}
                                    \setcounter{lemmaTEMA}{0}
                                    \setcounter{lemaTEMA}{0} 
                                    \setcounter{defTEMAi}{0}
                                    \setcounter{defTEMAp}{0} 
                                    \setcounter{propTEMAi}{0}
                                    \setcounter{propTEMAp}{0} }            
                     
                                    
\newtheorem{thmTEMA}{Theorem}
\renewcommand{\thethmTEMA}{\arabic{section}.\arabic{thmTEMA}}
\newtheorem{teoTEMA}{Teorema}
\renewcommand{\theteoTEMA}{\arabic{section}.\arabic{teoTEMA}}

\newtheorem{lemmaTEMA}{Lemma}
\renewcommand{\thelemmaTEMA}{\arabic{section}.\arabic{lemmaTEMA}}
\newtheorem{lemaTEMA}{Lema}
\renewcommand{\thelemaTEMA}{\arabic{section}.\arabic{lemaTEMA}}

\newtheorem{propTEMAi}{Proposition}
\renewcommand{\thepropTEMAi}{\arabic{section}.\arabic{propTEMAi}}
\newtheorem{propTEMAp}{Proposi\c{c}\~{a}o}
\renewcommand{\thepropTEMAp}{\arabic{section}.\arabic{propTEMAp}}

\newtheorem{defTEMAi}{Definition}
\renewcommand{\thedefTEMAi}{\arabic{section}.\arabic{defTEMAi}}
\newtheorem{defTEMAp}{Defini\c{c}\~{a}o}
\newtheorem{remTEMAp}{Observa\c{c}\~{a}o}
\renewcommand{\thedefTEMAp}{\arabic{section}.\arabic{defTEMAp}}

\newtheorem{coroTEMAi}{Corollary}
\renewcommand{\thecoroTEMAi}{\arabic{section}.\arabic{thmTEMA}}
\newtheorem{coroTEMAp}{Corol\'ario}
\renewcommand{\thecoroTEMAp}{\arabic{section}.\arabic{teoTEMA}.\arabic{coroTEMAp}}


% \renewenvironment{abstract}
% {\begin{list}{}{%
%  \setlength{\rightmargin}{0.5cm}
%  \setlength{\leftmargin}{0.5cm}
%  \small} 
%  \item[] }
% {\end{list}}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\renewcommand\maketitle{\par
    \begingroup
      \def\@makefnmark{\rlap{\@textsuperscript{\normalfont\@thefnmark}}}%
      \long\def\@makefntext##1{\parindent 1em\noindent
              \hb@xt@0em{%
                \hss\@textsuperscript{\normalfont\@thefnmark}}##1}%      
          \@maketitle      
      \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\runningtitle#1{\def\@runningtitle{#1}}
\def\keywords#1{\def\@keywords{#1}}
\def\abstracttcam#1{\def\@abstracttcam{#1}}
\def\acknowledgments#1{\def\@acknowledgments{#1}}
\def\aff#1{\def\@aff{#1}}

\renewcommand\aff{\footnote}

\def\@maketitle{%
  \newpage
  \null
  \vskip 2em%
  \begin{center}%
  \let \footnote \thanks
    {\LARGE \@title \par}%
    \vskip 1.5em%
    {\large
      \lineskip .5em%
      \begin{tabular}[t]{c}%
        \@author
      \end{tabular}\par}%
    \vskip 1em%
		\setlength{\rightmargin}{2cm}
		\setlength{\leftmargin}{2cm}
		\raggedright
		{\small {\bf Abstract: }\@abstracttcam \par}%
		\vskip 1em%
		{\small {\bf Keywords: }\@keywords \par}%
		\vskip 1em%	
		{\small {\bf Running title: }\@runningtitle \par}%
		\vskip 1em%
		{\small {\bf Acknowledgments: }\@acknowledgments \par}%
		\setlength{\rightmargin}{0cm}
		\setlength{\leftmargin}{0cm}
  \end{center}%
  \par
  \vskip 1.5em}

\setcounter{page}{1}

\endinput
