%**********************************************************************************************************
%**********************************************************************************************************
%**********************************************************************************************************
%***********             `amans.cls' for Applied Mathematics and Nonlinear Sciences        ***********
%**********************************************************************************************************
%**********************************************************************************************************
%**********************************************************************************************************
\NeedsTeXFormat{LaTeX2e}[1995/12/01]
\ProvidesClass{amans}
  [2015/12/15 v0.2 Applied Mathematics and Nonlinear Sciences
   article document class]
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{article}}
\PassOptionsToClass{11pt,twoside}{article}
\ProcessOptions
\LoadClass{article}
\def\amans@beginCJK{
  \begin{CJK*}{GBK}{rm}\CJKtilde
}
\def\amans@endCJK{
  \label{lastpage}
  \clearpage
  \end{CJK*}
}
\let\amans@begindocumenthook\@begindocumenthook
\let\amans@enddocumenthook\@enddocumenthook
\def\AtBeginDocument{\g@addto@macro\amans@begindocumenthook}
\def\AtEndDocument{\g@addto@macro\amans@enddocumenthook}
\def\@begindocumenthook{\amans@begindocumenthook\amans@beginCJK}
\def\@enddocumenthook{\amans@endCJK\amans@enddocumenthook}
\RequirePackage{CJK,indentfirst,url}% Lo utilizamos para la escritura en Japon�s/Chino/Coreano
\RequirePackage{multicol,float,fancyhdr}
\RequirePackage{graphicx,subfigure,picins}
\RequirePackage{amsmath,amsthm,amssymb,amsfonts}
\RequirePackage{textcomp}
\RequirePackage{booktabs, tabularx}
\RequirePackage[colorlinks=true,linkcolor=blue,citecolor=moradorevista]{hyperref}

% DIMENSIONES DE LA PAGINA--->A4
\paperheight 297mm
\paperwidth  210mm
\ifx\pdfoutput\undefined
  \AtBeginDvi{\special{papersize=\the\paperwidth,\the\paperheight}}
\else
  \setlength\pdfpagewidth{\paperwidth}
  \setlength\pdfpageheight{\paperheight}
\fi
 %% DIMENSIONES DE LA MANCHA
\textheight      231.78mm
\textwidth       171.45mm
\voffset 		0 mm 
\topmargin       1.77mm
\oddsidemargin     -4.175mm
\evensidemargin    -4.175mm
\columnsep         5mm
\headheight 15pt
\headsep 12pt
\parskip \z@ plus \z@ minus \z@


%**********************************************************************************************************
%**********************************************************************************************************
%% DEFINICIONES DE A�O VOLUMEN Y N�MERO
%**********************************************************************************************************
%**********************************************************************************************************
\def\amans@year{2015}
\def\amans@volume{1}
\def\amans@number{1}
\newcommand*\Volume[3][\the\year]{
  \def\amans@year{#1}
  \def\amans@volume{#2}
  \def\amans@number{#3}
}

\def\ps@preface
{
\def\@oddhead{}
\def\@evenhead{}
\def\@oddfoot{\hfill \thepage \hfill}
\def\@evenfoot{\hfill \thepage \hfill}
}

\newcommand*\Month[1]{
  \def\amans@month{#1}
}
\newcommand*\Page[1]{\setcounter{page}{#1}}
\fancypagestyle{plain}{
  \fancyhf{}
  \renewcommand{\headrulewidth}{0pt}
  \renewcommand{\footrulewidth}{0pt}
}

%%%%
%%%% Debido al choque con hyperref, probamos la variante \pageref*
%%%%
\let\amans@titlemark\@empty
\newcommand\titlemark[1]{\gdef\amans@titlemark{#1}}
\let\amans@authormark\@empty
\newcommand\authormark[1]{\gdef\amans@authormark{#1 Applied Mathematics and Nonlinear Sciences \amans@volume (\amans@year) \pageref{firstpage}--\pageref{lastpage}}}

\pagestyle{fancy}
\fancyhf{}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}

%%% Prueba

%\fancyhead[RE]{\footnotesize 
%%VOL. \amans@volume
%\it }
%\fancyhead[LO]{
%%NO. \amans@number
%\it 
%}
%\fancyhead[CE]{\ifnum\value{page}>\pageref{firstpage}\footnotesize
%\it\centering \amans@authormark\fi}
%\fancyhead[CO]{\ifnum\value{page}>\pageref{firstpage}\footnotesize
%\it\centering \amans@titlemark\fi}
%\fancyhead[LE,RO]{{\ifnum\value{page}>\pageref{firstpage}\footnotesize{\thepage}\fi}}
%%**********************************************************************************************************%**********************************************************************************************************%**********************************************************************************************************
%%Pie de pagina: poner definitivo
%%**********************************************************************************************************%**********************************************************************************************************%**********************************************************************************************************
%\fancyfoot[LO]{\ifnum\value{page}=\pageref{firstpage}\footnotesize{\raisebox{-3pt}{\mbox{ \includegraphics[width=1.5cm]{recorte.eps}}}
%ISSN~2444-8656 
%\hfill \rm DOI:{\color{blue}{xx.xxxx/AMANS.xxxx.xx.xxx}} \ \mbox{ \includegraphics[width=1.5cm]{recorte.eps}}
%}\fi}
%\fancyfoot[RO]{\ifnum\value{page}>\pageref{firstpage}\footnotesize{\mbox{ \includegraphics[width=1.5cm]{recorte.eps}}
%}\fi}
%
%\fancyfoot[LE]{\ifnum\value{page}=\pageref{firstpage}\footnotesize{\raisebox{-3pt}{\mbox{ \includegraphics[width=1.5cm]{recorte.eps}}}
%ISSN~2444-8656
%\hfill \rm DOI:{\color{blue}{xx.xxxx/AMANS.xxxx.xx.xxx}} \ \mbox{ \includegraphics[width=1.5cm]{recorte.eps}}
%}\fi}
%
%\fancyfoot[LE]{\ifnum\value{page}>\pageref{firstpage}\footnotesize{ \mbox{ \includegraphics[width=1.5cm]{recorte.eps}}
%}\fi}

%%%FinPrueba


%Otra prueba sin pageref

\fancyhead[RE]{\footnotesize 
%VOL. \amans@volume
\it }
\fancyhead[LO]{
%NO. \amans@number
\it 
}
\fancyhead[CE]{\ifnum\value{page}>\primera\footnotesize
\it\centering \amans@authormark\fi}
\fancyhead[CO]{\ifnum\value{page}>\primera\footnotesize
\it\centering \amans@titlemark\fi}
\fancyhead[LE,RO]{{\ifnum\value{page}>\primera\footnotesize{\thepage}\fi}}

\fancyfoot[LO]{\ifnum\value{page}=\primera\footnotesize{\raisebox{-3pt}{\mbox{ \includegraphics[width=3.5cm]{sciendo.eps}}}
ISSN~2444-8656 
\hfill 
%\rm DOI:{\color{blue}{xx.xxxx/AMANS.xxxx.xx.xxx}} 
\DOI\hspace{1cm}
 \mbox{ \href{https://www.sciendo.com}{\includegraphics[width=1.5cm]{sciendo.eps}}}
}\fi}
\fancyfoot[RO]{\ifnum\value{page}>\primera\footnotesize{\mbox{ \href{https://www.sciendo.com}{\includegraphics[width=1.5cm]{sciendo.eps}}}
}\fi}

\fancyfoot[LE]{\ifnum\value{page}=\primera\footnotesize{\raisebox{-3pt}{\mbox{ \includegraphics[width=1.5cm]{sciendo.eps}}}
ISSN~2444-8656
%\hfill \rm DOI:{\color{blue}{xx.xxxx/AMANS.xxxx.xx.xxx}} 
{\mbox{ \href{https://www.sciendo.com}{\includegraphics[width=0.5cm]{sciendo.eps}}}}
}\fi}

\fancyfoot[LE]{\ifnum\value{page}>\primera\footnotesize{ \mbox{ \href{https://www.sciendo.com}{\includegraphics[width=1.5cm]{sciendo.eps}}}
}\fi}


%% Fin prueba
\renewcommand\@makefntext[1]{
    \parindent 0\p@
    \noindent
    \mbox{\@makefnmark} #1}
    
\renewcommand\thefootnote{\@alph\c@footnote}

\def\amans@pubinfo#1#2{
\centering Applied Mathematics and Nonlinear Sciences \amans@volume (\amans@number) (\amans@year) #1--#2
}

\newcommand\address[1]{\gdef\@address{\noindent\rm #1}}
\def\@address{\@latex@warning@no@line{No \noexpand\address given}}
\let\@date\@empty
\newcommand\zipcode[1]{\mbox{\rm #1}}
\def\@maketitle{
  \begingroup
    \let\footnote\thanks
    \noindent
    \raisebox{25\p@}[0\p@][0\p@]{\parbox[t]{\textwidth}
      {\footnotesize\amans@pubinfo{\thepage}{\pageref*{lastpage}}}}
    \vskip -10\p@\bfseries\Large
      \@title
      \vskip 12\p@
      \normalfont\normalsize
      \@author\vskip 5\p@
      \it\small\renewcommand{\baselinestretch}{1.5}\selectfont
      \@address\vskip 9\p@
      \normalfont\@date\par
  \endgroup
  \@abstract
  \mainrule
}
\renewcommand\maketitle{\par
  \begingroup
    \renewcommand\thefootnote{\@fnsymbol\c@footnote}
    \def\@makefnmark{\rlap{\@textsuperscript{\normalfont\@thefnmark}}}
    \long\def\@makefntext##1{\parindent 1em\noindent
            \hb@xt@0em{
                \hss\@textsuperscript{\normalfont\@thefnmark}}##1}
    \if@twocolumn
      \ifnum \col@number=\@ne
        \@maketitle
      \else
        \twocolumn[\@maketitle]
      \fi
    \else
      \newpage
      \global\@topnum\z@   
      \@maketitle
    \fi
    \thispagestyle{plain}\@thanks
  \endgroup
  \setcounter{footnote}{0}
  \global\let\@thanks\@empty
  \global\let\@title\@empty
  \global\let\@author\@empty
  \global\let\@address\@empty
  \global\let\@date\@empty
  \global\let\thanks\relax
  \global\let\title\relax
  \global\let\author\relax
  \global\let\address\relax
  \global\let\date\relax
  \global\let\@abstract\@empty
  \global\let\@keywords\@empty
  \global\let\abstract\relax
  \global\let\keywords\relax
  \global\let\@maketitle\relax
  \global\let\maketitle\relax
  \global\let\and\relax
}
\let\@abstract\@empty
\let\@keywords\@empty
\let\@doi\@empty
\renewcommand\abstract[1]{
  \def\@abstract{
    \quotation\item\relax\small
    \vskip -50\p@\centerline{\bf }\vskip 0\p@
    #1\par
    \vskip 0\p@\@keywords\@doi
    \vskip\baselineskip\endquotation}}
    
\newcommand\keywords[1]{
  \def\@keywords{
    \begingroup
    \settowidth{\@tempdima}{\textbf{Key words}:}
    \list{}{\leftmargin\@tempdima
            \itemindent-\leftmargin
            \labelwidth\z@
            \advance\leftmargin\labelsep}
    \item[\textbf{Key words}:]
    #1\par\endlist
    \endgroup}}
\newcommand\doi[1]{
  \def\@doi{
    \noindent\text{DOI}: #1\par}}
\newcommand\mainrule{\vspace*{-13mm}}
\def\amans@xdblfloat#1[#2]{\@dblfloat{#1}[#2]\small}
\def\amans@dblfloat#1{\@dblfloat{#1}\small}
\newenvironment{widetabular}[2][\linewidth]
  {\begin{tabular*}{#1}{@{\space\extracolsep{\fill}}#2@{\space}}}
  {\end{tabular*}}
\renewcommand\figurename{\bf Fig.}
\renewcommand\tablename{\bf Table}
\long\def\amans@makefigcaption#1#2{
  \abovecaptionskip \baselineskip
  \belowcaptionskip \z@
  \vskip\abovecaptionskip\small
  \list{}{\leftmargin \amans@figmargin\rightmargin\leftmargin
          \topsep\z@\partopsep\z@\itemsep\z@\parsep\z@}
  \item\relax
  \sbox\@tempboxa{\mbox{\bf #1.} #2}
  \ifdim \wd\@tempboxa >\hsize
    \mbox{\bf #1.} #2\par
  \else
    \global \@minipagefalse
    {\hfil\box\@tempboxa\hfil}
  \fi
  \endlist
  \vskip\belowcaptionskip}
\long\def\amans@maketabcaption#1#2{
  \abovecaptionskip \z@
  \belowcaptionskip .5\baselineskip
  \vskip\abovecaptionskip\small
  \mbox{\bf #1.} #2\par
  \vskip\belowcaptionskip}
\newdimen\amans@figwidth
\newdimen\amans@figmargin
\newcommand\figcaption[2][\linewidth]{
  \setlength\amans@figwidth{#1}
  \amans@figmargin\linewidth
  \advance\amans@figmargin-\amans@figwidth
  \divide\amans@figmargin 2
  \let\amans@makecaption\@makecaption
  \let\@makecaption\amans@makefigcaption
  \caption{#2}
  \let\@makecaption\amans@makecaption
}
\newcommand\tabcaption[1]{
  \let\amans@makecaption\@makecaption
  \let\@makecaption\amans@maketabcaption
  \caption{#1}
  \let\@makecaption\amans@makecaption
}
\newcommand\figcontinue{\addtocounter{figure}{-1}}
\newcommand\tabnote[1]{
  \begingroup
    \footnotesize
    \vskip\baselineskip
    \parindent\z@
    #1
  \endgroup
}
\def\toprule{\noalign{\ifnum0=`}\fi \hrule \@height 0.75pt \hrule \@height 3pt \@width 0pt \futurelet
   \@tempa\@xhline}
\def\midrule{\noalign{\ifnum0=`}\fi \hrule \@height 3.25pt \@width 0pt \hrule \@height 0.5pt
    \hrule \@height 3pt \@width 0pt \futurelet \@tempa\@xhline}
\def\botrule{\noalign{\ifnum0=`}\fi \hrule \@height 2.75pt \@width 0pt \hrule \@height 0.75pt \futurelet
   \@tempa\@xhline}
\renewcommand{\textfraction}{0.15}
\renewcommand{\topfraction}{0.85}
\renewcommand{\bottomfraction}{0.65}
\renewcommand{\floatpagefraction}{0.60}
\textfloatsep \baselineskip
\intextsep \baselineskip
\floatsep \baselineskip
\dbltextfloatsep \baselineskip
\dblfloatsep \baselineskip
\abovedisplayskip .5\baselineskip
\belowdisplayskip .5\baselineskip
\newenvironment{acknowledgements}{
  \vskip\baselineskip
  \small\bfseries\itshape Acknowledgements.\quad
  \small\normalfont\baselineskip=11pt}
  {\normalsize\normalfont}
\renewcommand\refname{References}




\renewenvironment{thebibliography}[1]
     {\section*{\refname}
      \small\baselineskip=11pt
      \@mkboth{\MakeUppercase\refname}{\MakeUppercase\refname}
      \list{\@biblabel{\@arabic\c@enumiv}}
           {\settowidth\labelwidth{\@biblabel{#1}}
            \leftmargin 0em\itemindent 0em \leftmargin 1em
            \parsep\z@\itemsep\z@
            \advance\leftmargin\labelsep
            \@openbib@code
            \usecounter{enumiv}
            \let\p@enumiv\@empty
            \renewcommand\theenumiv{\@arabic\c@enumiv}}
      \sloppy
      \clubpenalty4000
      \@clubpenalty \clubpenalty
      \widowpenalty4000
      \sfcode`\.\@m}
     {\def\@noitemerr
       {\@latex@warning{Empty `thebibliography' environment}}
      \endlist}
\renewcommand\appendix{\par
  \section*{\centering\small\rm APPENDIX}
  \normalsize
  \setcounter{equation}{0}
  \def\cl@section{\@elt{subsection}}
  \renewcommand\theequation{A\@arabic\c@equation}
  \setcounter{secnumdepth}{0}
  \renewcommand\section{\@startsection {section}{1}{\z@}
                                   {-\baselineskip}
                                   {\baselineskip}
                                   {\centering\normalfont\normalsize\bfseries}}
  \renewcommand\subsection{\@startsection{subsection}{2}{\z@}
                                     {-.5\baselineskip}
                                     {.5\baselineskip}
                                     {\centering\normalfont\normalsize\bfseries\itshape}}
  \renewcommand\subsubsection{\@startsection{subsubsection}{3}{\z@}
                                     {-.5\baselineskip}
                                     {.25\baselineskip}
                                     {\centering\normalfont\normalsize\itshape}}
}


\endinput

