\NeedsTeXFormat{LaTeX2e}[1995/12/01]
\ProvidesClass{jaca}[2012/11/05, v 4.1.1]
\typeout{(c) 2003-18 J. J. Torrens, UPNA, Spain}
\typeout{}

% ==================================================================
% Option declarations
% ==================================================================

\DeclareOption{draft}{\PassOptionsToClass{draft}{article}}
\DeclareOption{final}{\PassOptionsToClass{final}{article}}
\newif\ifjaca@txfonts\jaca@txfontstrue
\newif\ifjaca@CM\jaca@CMfalse
\DeclareOption{CM}{\jaca@CMtrue\jaca@txfontsfalse}
\newif\ifjaca@Adobe\jaca@Adobefalse
\DeclareOption{Adobe}{\jaca@Adobetrue\jaca@txfontsfalse}
\newif\ifjaca@afourpaper\jaca@afourpaperfalse
\DeclareOption{a4paper}{\jaca@afourpapertrue}
\newif\ifjaca@evennpages\jaca@evennpagesfalse
\DeclareOption{evennpages}{\jaca@evennpagestrue}

% Options for specific Jaca conferences
\newcounter{jaca@version}
\DeclareOption{IXConf}{\setcounter{jaca@version}{2}%
   \jaca@Adobetrue\jaca@txfontsfalse}
\DeclareOption{XConf}{\setcounter{jaca@version}{3}}
\DeclareOption{XIConf}{\setcounter{jaca@version}{4}}
\DeclareOption{Last}{\setcounter{jaca@version}{4}} % added in v. 4.1

% ==================================================================
% Loading the article documentclass and processing the options
% ==================================================================

\ExecuteOptions{final,Last}
\ProcessOptions

\LoadClass[10pt,twoside]{article}

% ==================================================================
% Loading packages
% ==================================================================
% Mathematics
\RequirePackage{amsmath}
\RequirePackage{amsthm}
\ifnum\value{jaca@version}>2 % from v. 3 on
  \RequirePackage[eqnarray]{onlyamsmath}
\fi

% Fonts and mathematical symbols
\RequirePackage[T1]{fontenc}
\ifjaca@txfonts
   \RequirePackage[varg]{txfonts}
\else
   \RequirePackage{amssymb}
   \ifjaca@Adobe
      \RequirePackage{mathptmx}
      \RequirePackage[scaled=.90]{helvet}
      \RequirePackage{courier}
      \renewcommand{\boldsymbol}{\pmb}
   \fi
\fi

% Definition of \ifpdf to check if pdfLaTeX is running
\RequirePackage{ifpdf}

% Support for bibstyles including \url and \href commands
% in the bibliography when hyperref is not loaded.
\AtBeginDocument{%
   \@ifpackageloaded{hyperref}{\relax}{%
      \let\href\@secondoftwo%
      \@ifpackageloaded{url}{\relax}{\RequirePackage{url}}}}

% ==================================================================
% Mathematical notation
% ==================================================================
% Notations for sets
\newcommand{\Nset}{\ensuremath{\mathbb{N}}}
\newcommand{\Zset}{\ensuremath{\mathbb{Z}}}
\newcommand{\Qset}{\ensuremath{\mathbb{Q}}}
\newcommand{\Rset}{\ensuremath{\mathbb{R}}}
\newcommand{\Cset}{\ensuremath{\mathbb{C}}}

% log-like functions
\let\Div\div
\renewcommand{\div}{\operatorname{div}}
\newcommand{\grad}{\operatorname{grad}}
\newcommand{\rot}{\operatorname{rot}}
\newcommand{\curl}{\operatorname{curl}}
\newcommand{\diam}{\operatorname{diam}}
\newcommand{\meas}{\operatorname{meas}}
\newcommand{\supp}{\operatorname{supp}}
\newcommand{\sign}{\operatorname{sign}}

% Notation for vectors
\ifnum\value{jaca@version}>3 % from v. 4 on
   \let\Vec\vec
   \renewcommand{\vec}{\@ifstar{\boldsymbol}{\mathbf}}
\fi

% Delimiters
\newcommand{\jaca@PutDelim}[4]{%
  \ifcase#1 \mathopen{#3}#2\mathclose{#4} \or \bigl#3#2\bigr#4% 
    \or \Bigl#3#2\Bigr#4%
    \or \biggl#3#2\biggr#4 \or \Biggl#3#2\Biggr#4% 
  \else \left#3#2\right#4\fi}
\newcommand{\pdelim}[2][5]{\jaca@PutDelim{#1}{#2}{(}{)}}
\newcommand{\bdelim}[2][5]{\jaca@PutDelim{#1}{#2}{[}{]}}
\newcommand{\Bdelim}[2][5]{\jaca@PutDelim{#1}{#2}{\{}{\}}}
\newcommand{\vdelim}[2][5]{\jaca@PutDelim{#1}{#2}{\lvert}{\rvert}}
\newcommand{\Vdelim}[2][5]{\jaca@PutDelim{#1}{#2}{\lVert}{\rVert}}
\newcommand{\adelim}[2][5]{\jaca@PutDelim{#1}{#2}{\langle}{\rangle}}
\let\abs\vdelim
\let\norm\Vdelim
    
\ifnum\value{jaca@version}<3 % v. 2
    \renewcommand{\abs}[2][]{\def\@temp{#1}%
      \ifx\@temp\@empty\left\lvert#2\right\rvert\else%
      \csname#1l\endcsname\lvert#2%
      \csname#1r\endcsname\rvert\fi}

    \renewcommand{\norm}[2][]{\def\@temp{#1}%
      \ifx\@temp\@empty\left\lVert#2\right\rVert\else%
      \csname#1l\endcsname\lVert#2%
      \csname#1r\endcsname\rVert\fi}
\fi

% Intervals in French notation
\newcommand{\ooi}[2][5]{\jaca@PutDelim{#1}{#2}{]}{[}}
\newcommand{\coi}[2][5]{\jaca@PutDelim{#1}{#2}{[}{[}}
\newcommand{\oci}[2][5]{\jaca@PutDelim{#1}{#2}{]}{]}}
\let\cci\bdelim
\let\idelim\ooi % \idelim is deprecated; only used in v 3.1

% ==================================================================
% Theorem-like environments
% ==================================================================

\theoremstyle{plain}
\newtheorem{thm}{Theorem}
\newtheorem{cor}[thm]{Corollary}
\newtheorem{lem}[thm]{Lemma}
\newtheorem{prop}[thm]{Proposition}
\newtheorem{claim}[thm]{Claim}
\newtheorem{axiom}[thm]{Axiom}
\newtheorem{conj}[thm]{Conjecture}
\newtheorem{fact}[thm]{Fact}
\newtheorem{hypo}[thm]{Hypothesis}
\newtheorem{assum}[thm]{Assumption}
\newtheorem{crit}[thm]{Criterion}

\theoremstyle{definition}
\newtheorem{defn}{Definition}
\newtheorem{exmp}{Example}
\newtheorem{prob}{Problem}
\newtheorem{alg}{Algorithm}
\newtheorem{case}{Case}

\theoremstyle{remark}
\newtheorem{rem}{Remark}
\newtheorem{note}[rem]{Note}

% ==================================================================
% Lists
% ==================================================================
% An itemize-like environment
\newenvironment{myitemize}[1][$\bullet$]%
   {\begin{list}{#1}{\def\@temp{#1}
      \ifx\@temp\@empty
         \setlength{\labelwidth}{0pt}\setlength{\leftmargin}{-\labelsep}
      \else
         \settowidth{\labelwidth}{#1}\setlength{\leftmargin}{\labelwidth}
      \fi
      \addtolength{\leftmargin}{\labelsep}}}%
   {\end{list}}
	      
% Compact lists: \partosep= 60% original value; the remaining
% lengths are halved.
\ifnum\value{jaca@version}>2 % from v. 3 on
\setlength\partopsep{1.2\p@ \@plus 0.6\p@ \@minus 0.6\p@}
\def\@listi{\leftmargin\leftmargini
            \parsep 2\p@ \@plus1\p@ \@minus0.5\p@
            \topsep 4\p@ \@plus1\p@ \@minus2\p@
            \itemsep2\p@ \@plus1\p@ \@minus0.5\p@}
\let\@listI\@listi
\@listi
\def\@listii {\leftmargin\leftmarginii
              \labelwidth\leftmarginii
              \advance\labelwidth-\labelsep
              \topsep    2\p@ \@plus1\p@    \@minus0.5\p@
              \parsep    1\p@ \@plus0.5\p@  \@minus0.5\p@
              \itemsep   \parsep}
\def\@listiii{\leftmargin\leftmarginiii
              \labelwidth\leftmarginiii
              \advance\labelwidth-\labelsep
              \topsep    1\p@ \@plus0.5\p@\@minus0.5\p@
              \parsep    \z@
              \partopsep 0.6\p@ \@plus\z@ \@minus0.6\p@
              \itemsep   \topsep}
\fi

% ==================================================================
% Sectioning commands
% ==================================================================

\renewcommand{\section}{%
   \renewcommand{\@seccntformat}[1]{%
      \textbf{\S \csname the##1\endcsname.}\ }
   \@startsection {section}{1}{\z@}%
   {-3.5ex \@plus -1ex \@minus -.2ex}{2.3ex \@plus.2ex}%
   {\normalfont\centering\large\bfseries}}
\renewcommand{\subsection}{%
   \renewcommand{\@seccntformat}[1]{\csname the##1\endcsname.\ }
   \@startsection{subsection}{2}{\z@}%
   {-3.25ex\@plus -1ex \@minus -.2ex}{1.5ex \@plus .2ex}%
   {\normalfont\large\bfseries}}
\renewcommand{\subsubsection}{\@startsection{subsubsection}{3}{\z@}%
   {-3.25ex\@plus -1ex \@minus -.2ex}{1.5ex \@plus .2ex}%
   {\normalfont\normalsize\itshape}}
   
\ifnum\value{jaca@version}>2 % from v. 3 on
\renewcommand{\paragraph}{\@startsection{paragraph}{4}{\z@}%
%  {3.25ex\@plus -1ex \@minus -.2ex}{-0.5em}%
   {3.25ex\@plus 1ex \@minus .2ex}{-0.5em}% corrected in v. 4
   {\normalfont\normalsize\bfseries}}
\fi
\newcommand{\ack}{\section*{Acknowledgements}}

% ==================================================================
% Page layout
% ==================================================================
% The proceedings will be printed on 170 mm x 240 mm sheets.
% A4 paper is accepted while preparing articles

\ifjaca@afourpaper
  \setlength{\paperheight}{297mm}
  \setlength{\paperwidth}{210mm}
\else
  \setlength{\paperheight}{240mm}
  \setlength{\paperwidth}{170mm}
\fi

\ifpdf     % pdfLaTeX is running
  \setlength{\pdfpagewidth}{\paperwidth}
  \setlength{\pdfpageheight}{\paperheight}
\fi

% Horizontal and vertical lengths
\setlength{\oddsidemargin}{20 mm}
\ifjaca@afourpaper\addtolength{\oddsidemargin}{20mm}\fi
\addtolength{\oddsidemargin}{-1in}
\setlength{\evensidemargin}{\oddsidemargin}
\setlength{\textwidth}{130 mm}

\setlength{\topmargin}{30 mm}
\ifjaca@afourpaper\addtolength{\topmargin}{28.5mm}\fi
\setlength{\headsep}{7 mm}
\addtolength{\topmargin}{-1in}
\addtolength{\topmargin}{-\headheight}% \headheight keeps its default value
\addtolength{\topmargin}{-\headsep}
\setlength{\textheight}{190 mm}

% Format of headings and footers
\newcommand{\jaca@vol}{vv}
\newcommand{\jaca@year}{yyyy}

\ifnum\value{jaca@version}<3 % v. 2
   \newcommand{\jaca@Monog}{Monograf\'ias del Seminario Matem\'atico
                            Garc\'ia de Galdeano}
\else                        % from v. 3 on
   \newcommand{\jaca@Monog}{Monograf\'ias Matem\'aticas 
                            \emph{Garc\'ia de Galdeano}}
\fi                          
\newcommand{\ps@myplain}{%
    \renewcommand{\@oddfoot}{}
    \renewcommand{\@evenfoot}{}
    \renewcommand{\@oddhead}{%
      {\small\jaca@Monog\ \textbf{\jaca@vol}, 
       \thepage--\pageref{LastPage} (\jaca@year)\hfill\mbox{}}}
    \renewcommand{\@evenhead}{}}

\newcommand{\ps@jacaheadings}{%
    \renewcommand{\@oddfoot}{}
    \renewcommand{\@evenfoot}{}
    \renewcommand{\@oddhead}{%
       {\slshape\small\jaca@shorttitle}\hfill\thepage}
    \renewcommand{\@evenhead}{%
       \thepage\hfill{\slshape\small\jaca@shortauthor}}}

\pagestyle{jacaheadings}

% For the final editing of the proceedings, the class option
% evennpages should be used. Thus, every paper has an even number
% of pages for correct two-side printing, adding a blank page if
% required.

\ifjaca@evennpages
  \AtEndDocument{\label{LastPage}\newpage{\pagestyle{empty}%
     \cleardoublepage}}
\else
  \AtEndDocument{\label{LastPage}}
\fi

% ==================================================================
% Commands \title, \author, \KeysAndCodes and address environment
% ==================================================================

\ifjaca@CM
   \newcommand{\jaca@titlefont}{\sffamily\huge\scshape}
\else
  \newcommand{\jaca@titlefont}{\fontfamily{phv}\huge\scshape}
\fi
\renewcommand{\title}[2][]{%
  \thispagestyle{myplain}
  \vspace*{-\topsep}
  \begin{center}\jaca@titlefont #2\end{center}\def\@temp{#1}
  \ifx\@temp\@empty\newcommand{\jaca@shorttitle}{#2}
  \else\newcommand{\jaca@shorttitle}{#1}\fi}
  
\renewcommand{\author}[2][]{%
  \vspace*{-\topsep}
  \begin{center}\Large #2\end{center}\def\@temp{#1}
  \ifx\@temp\@empty\newcommand{\jaca@shortauthor}{#2}
  \else\newcommand{\jaca@shortauthor}{#1}\fi}
  
\renewenvironment{abstract}{%
  \vspace*{0ex}
  \begin{quotation} \small
  \noindent \textbf{Abstract.} \ignorespaces}%
  {\end{quotation}}
 
\renewcommand{\maketitle}{\relax}
 
\newcommand{\KeysAndCodes}[2]{%
  \begin{quote} \small
   \textit{Keywords:} #1.% 
   \def\@temp{#2}
   \ifx\@temp\@empty\relax  % <--- 2006/11/03
   \else \par\textit{AMS classification:} #2.\fi
  \end{quote}} 
  
\newif\ifjaca@FirstAddress\jaca@FirstAddresstrue

\newenvironment{address}[1][1]{%
  \ifjaca@FirstAddress
    \vspace*{2ex minus 2ex}\global\jaca@FirstAddressfalse
  \fi
  \setlength{\@tempdima}{0.48\textwidth}
  \ifvmode 
    \setlength{\parindent}{0pt} \vspace*{2ex minus 0.5ex}
    \ifnum#1=1 \setlength{\@tempdima}{\textwidth} \fi
  \else \hfill \fi
  \begin{minipage}[t]{\@tempdima}\raggedright\small}%
  {\end{minipage}\medskip}
  
% ==================================================================
% End of file
% ==================================================================

\endinput

% ==================================================================
% History
% v 1.0 (2003/10/10): VIII Conference Zaragoza-Pau
% v 2.0 (2005/09/28): IX Conference Zaragoza-Pau
% v 2.1 (2006/11/10): Revision during the proceedings edition
% v 3.0 (2008/09/20): X Conference Zaragoza-Pau
% v 3.1 (2010/08/06): Revision during the proceedings edition
% v 4.0 (2010/10/17): XI Conference Zaragoza-Pau
% v 4.1 (2012/11/05): XII and forthcoming Conference Zaragoza-Pau
% ==================================================================