%.........LateX format for the mathematical journal Annales Mathematiques Blaise Pascal
\NeedsTeXFormat{LaTeX2e}%.........LaTeX 2.09 can't be used (nor non-LaTeX)
[1995/06/01]%...................................LaTeX date must be June 1995 or later
\ProvidesClass{cedram-ambp-new}[2017/12/31 v1.0]
%........Language option
%.............francais, french, anglais or english
%.............Default is english
\newif\if@francais\@francaisfalse
\DeclareOption{francais}{\@francaistrue}
\DeclareOption{french}{\@francaistrue}
\DeclareOption{anglais}{\@francaisfalse}
\DeclareOption{english}{\@francaisfalse}
\ProcessOptions\relax
%............amsart class and amsthm package are loaded
\LoadClass[centertags,portrait,10pt,twoside,reqno,onecolumn]{amsart}[2004/08/06 v2.20]
\RequirePackage{mathtools,amsthm}
%.........Fonts packages are loaded
\RequirePackage[T1]{fontenc}
\RequirePackage{newtxtext,newtxmath}
%.........Babel package is loaded
\if@francais
	\RequirePackage[english,french]{babel}
	\AtBeginDocument{\selectlanguage{french}}
\else
	\RequirePackage[french,english]{babel}
	\AtBeginDocument{\selectlanguage{english}}	
\fi
%.........Typography packages are loaded	
\RequirePackage{xspace}
\RequirePackage[babel]{microtype}
\RequirePackage[all]{nowidow}
%...........We modify amsart for CEDRAM compatibility
\AtBeginDocument{%
  \@for\@tempa:=-1,0,1,2,3,4\do{%
    \@ifundefined{r@tocindent\@tempa}{%
      \@xp\gdef\csname r@tocindent\@tempa\endcsname{0pt}}{}%
  }%
}
\def\@writetocindents{%
  \begingroup
  \@for\@tempa:=-1,0,1,2,3\do{%
    \immediate\write\@auxout{%
      \string\newlabel{tocindent\@tempa}{%
        \csname r@tocindent\@tempa\endcsname}}%
  }%
  \endgroup}
%................We load array and longtable packages to write the addresses
\RequirePackage{array,longtable}
%..................amsart write titles in uppercase: we do not want that
\renewcommand{\uppercasenonmath}[1]{}
%.................we redefine the author command
\renewcommand{\author}[2][]{%
  \ifx\@empty\authors
    \gdef\authors{\@nx#2}%
    \g@addto@macro\addresses{\author{#2}}%
  \else
    \g@addto@macro\authors{\and\@nx#2}%
    \g@addto@macro\addresses{\author{#2}}%
  \fi
  \@ifnotempty{#1}{%
    \ifx\@empty\shortauthors
      \gdef\shortauthors{#1}%
    \else
      \g@addto@macro\shortauthors{\and#1}%
    \fi
  }%
}
\edef\author{\@nx\@dblarg
  \@xp\@nx\csname\string\author\endcsname}
%...............................Predefined.theorems.see.documentation
\newcommand*{\nommer}[3]{%
\if@francais
\expandafter\newcommand\csname #1name\endcsname{#2}
\else
\expandafter\newcommand\csname #1name\endcsname{#3}
\fi
}
%...................................
\newcommand*{\nouvthm}[3]{%
	\expandafter\newtheorem{#1}[theo]{\csname#1name\endcsname}
	\expandafter\newtheorem{#1s}[theo]{\csname#1sname\endcsname}
	\expandafter\newtheorem*{#1*}{\csname#1name\endcsname}
	\expandafter\newtheorem*{#1s*}{\csname#1sname\endcsname}
	\nommer{#1}{#2}{#3}
	\nommer{#1s}{#2s}{#3s}
}
%...................................
\theoremstyle{plain}
%...................
\newtheorem{theo}{\theoname}[section]\nommer{theo}{Th\'eor\`eme}{Theorem}
\newtheorem*{theo*}{\theoname}
\nouvthm{prop}{Proposition}{Proposition}
\nouvthm{lemm}{Lemme}{Lemma}
\nouvthm{coro}{Corollaire}{Corollary}
\nouvthm{conj}{Conjecture}{Conjecture}
\nouvthm{heur}{Heuristique}{Heuristic}
%...................
\theoremstyle{remark}
\nouvthm{rema}{Remarque}{Remark}
\nouvthm{nota}{Notation}{Notation}
\nouvthm{exem}{Exemples}{Examples}
%...................
\theoremstyle{definition}
\nouvthm{defi}{D\'efinition}{Definition}
%...........Equivalent names for theorems
\newcommand*\equalenv[2]{%
	\expandafter\newenvironment{#1}{\begin{#2}}{\end{#2}}
	\expandafter\newenvironment{#1*}{\begin{#2*}}{\end{#2*}}
	\expandafter\newenvironment{#1s}{\begin{#2s}}{\end{#2s}}
	\expandafter\newenvironment{#1s*}{\begin{#2s*}}{\end{#2s*}}
}
\equalenv{cor}{coro}
\equalenv{corollaire}{coro}
\equalenv{corollary}{coro}
\equalenv{dfn}{defi}
\equalenv{definition}{defi}
\equalenv{example}{exem}
\equalenv{exemple}{exem}
\equalenv{lemme}{lemm}
\equalenv{lem}{lemm}
\equalenv{lemma}{lemm}
\equalenv{notation}{nota}
\equalenv{preuve}{proof}
\equalenv{proposition}{prop}
\equalenv{remark}{rema}
\equalenv{remarque}{rema}
\equalenv{theorem}{theo}
\equalenv{theoreme}{theo}
\equalenv{thm}{theo}
%....................................................
%............Metadata for the website
%.............Journal title
\newcommand{\setpublname}[2][Titre abr\'eg\'e absent]{%
\gdef\shortpublname{#1}\gdef\publname{#2}}
\setpublname[Ann. Math. Blaise Pascal]{Annales Math\'ematiques Blaise Pascal}%
\def\currentjournaltitle{Annales math\'ematiques Blaise Pascal}%
%............editor of the journal
\edef\currentjournalpublisher{Université Clermont Auvergne, Laboratoire de mathématiques Blaise Pascal} 
%.............short title of the journal
\def\currentjournalshorttitle{Ann. Math. Blaise Pascal}
%..............acronym
\def\cdr@journalacro{AMBP}
%...............ISSN
\def\@issn{1259-1734}
%..............article metadata
\let\@altabstract\@empty
\let\@alttitle\@empty
\newcommand*{\alttitle}[1]{\gdef\@alttitle{#1}}%
\newcommand*{\altkeywords}[1]{\gdef\@altkeywords{#1}}%
\newbox\altabstractbox
\newenvironment{altabstract}{%
 \if@francais\begin{otherlanguage}{english}\else\begin{otherlanguage}{french}\fi
  \ifx\maketitle\relax
    \ClassWarning{\@classname}{Altabstract should precede
      \protect\maketitle\space in AMS document classes; reported}%
  \fi
  \global\setbox\altabstractbox=\vtop \bgroup 
    \normalfont\Small
    \list{}{\labelwidth\z@
      \leftmargin3pc \rightmargin\leftmargin
      \listparindent\normalparindent \itemindent\z@
      \parsep\z@ \@plus\p@
      \let\fullwidthdisplay\relax
    }%
    \item[\hskip\labelsep\scshape\altabstractname.]%
}{%
  \endlist\egroup
  \ifx\@setaltabstract\relax \@setaltabstracta \fi
 \if@francais\end{otherlanguage}\else\end{otherlanguage}\fi
}
\def\@setaltabstract{\@setaltabstracta \global\let\@setaltabstract\relax}
\def\@setaltabstracta{%
\ifx\@empty\@alttitle\else
\begin{center}%
\large\itshape  \@alttitle  
\end{center}%
\fi
  \ifvoid\altabstractbox
  \else
%     \skip@20\p@ \advance\skip@-\lastskip
%     \advance\skip@-\baselineskip \vskip\skip@
    \box\altabstractbox
    \prevdepth\z@ % because \altabstractbox is a vtop
  \fi
}
\def\@setabstract{\@setabstracta \global\let\@setabstract\relax
\@setaltabstract}
%% geometry
\paperwidth=175truemm
\paperheight=250truemm
% of article.cls + size12.clo in letter:
\textwidth=351pt
\textheight=494pt
\ifx\undefined\pdfpagewidth\else
\pdfpagewidth\paperwidth
\pdfpageheight\paperheight
\fi
\topmargin4truemm
\oddsidemargin2truemm
\evensidemargin3truemm
\headheight11pt
\headsep22pt
\footskip27pt
\frenchspacing
%
%.....11pt...................................    
%\def\@mainsize{11}\def\@ptsize{1}%
%  \def\@typesizes{%
%    \or{6}{7}\or{7}{8}\or{8}{10}\or{9}{11}\or{10}{12}%
%    \or{\@xipt}{13}% normalsize
%    \or{\@xiipt}{14}\or{\@xivpt}{17}\or{\@xviipt}{20}%
%    \or{\@xxpt}{24}\or{\@xxvpt}{30}}%
%.....10pt...................................    
\def\@mainsize{10}\def\@ptsize{0}%
  \def\@typesizes{%
    \or{5}{6}\or{6}{7}\or{7}{8}\or{8}{9}\or{9}{11}%
    \or{10}{13}% normalsize
    \or{\@xipt}{13}\or{\@xiipt}{14}\or{\@xivpt}{17}%
    \or{\@xviipt}{20}\or{\@xxpt}{24}}%
%........................................        
  \normalsize \linespacing=\baselineskip
  \def\@listi{\leftmargin\leftmargini
            \parsep 5\p@  \@plus2.5\p@ \@minus\p@
            \topsep 10\p@ \@plus4\p@   \@minus6\p@
            \itemsep5\p@  \@plus2.5\p@ \@minus\p@
            \labelwidth=\leftmargini \advance\labelwidth-\labelsep }%
%
\let\@listI\@listi
\@listi
%...........................
\def\@mainsize{10}\def\@ptsize{0}%
  \def\@typesizes{%
    \or{5}{6}\or{6}{7}\or{7}{8}\or{8}{9}\or{9}{11}%
    \or{10}{13}% normalsize
    \or{\@xipt}{13}\or{\@xiipt}{14}\or{\@xivpt}{17}%
    \or{\@xviipt}{20}\or{\@xxpt}{24}}%
  \normalsize \linespacing=\baselineskip
%............................
%....No unwanted roman numerotation
\def\@upn#1{#1}
\let\cdr@up\relax
%
%..............Structure of the page
%.............1st page
\pagenumbering{arabic}%
%.....Copyright mention
\def\@setcopyright{}%
%....Current pages
\def\ps@headings{ 
      \def\@oddhead{{\footnotesize\hfil\shorttitle}}%
      \def\@evenhead{{\footnotesize\shortauthors\hfil}}%
      \def\@oddfoot{\hfil\thepage}%
      \def\@evenfoot{\thepage\hfil}%
}
\pagestyle{headings}%
%...1st page
\def\ps@firstpage{\ps@plain
      \def\@oddfoot{\hfil\thepage\hfil
\global\topskip\normaltopskip}%
        \let\@evenfoot\@oddfoot
  \def\@oddhead{\@serieslogo\hss}%
  \let\@evenhead\@oddhead % in case an article starts on a left-hand page
}
%
%.....article identification 1st page
\def\@logofont{\tiny}
\let\currentvolume\@empty
\def\article@logo{%
  \set@logo{%
    \textsc{\publname}
    \ifx\@empty\currentvolume \textbf{\if@francais Version de
       travail\else Working version\fi\ -- \today}
    \else \textbf{\currentvolume}, \pageinfo\ (\currentyear)%
    \fi
  }%
}
%
%..........Title presentation
\def\@settitle{%
  \begin{center}%
    \vspace*{-48pt}
    \Large
    \bfseries
    \@title
  \end{center}%
}
%......Authors presentation
\def\@@and{\&}
\def\author@andify{%
  \nxandlist {\unskip ,\penalty-2 \space\ignorespaces}%
    {\unskip {} \@@and~}%
    {\unskip {} \penalty-1  \@@and~}%
}
\def\ambp@author@andify{%
  \nxandlist{\unskip\\}{\unskip\\}{\unskip\\}}
\def\initial#1{#1}
\def\lastname#1{#1}
\def\firstname#1{#1}
\def\middlename#1{#1}
\def\vonname#1{#1}
\def\@setauthors{%
  \begingroup
  \def\thanks{\protect\thanks@warning}%
  \trivlist
  \centering\footnotesize \@topsep22\p@\relax
  \advance\@topsep by -\baselineskip
  \item\relax
  \ambp@author@andify\authors
  \def\\{\protect\linebreak}%
  \large\textsc{\authors}%
 % \authors%
  \ifx\@empty\contribs
  \else
    \\\penalty-3 \space \@setcontribs
    \@closetoccontribs
    \fi
    \linebreak
  \endtrivlist
  \endgroup
}
%........1st page notes
\def\@adminfootnotes{%
  \let\@makefnmark\relax  \let\@thefnmark\relax
  \begingroup\parindent=0pt\normalparindent=0pt
  \ifx\@empty\thankses\else \@footnotetext{%
    \def\par{\let\par\@par}\@setthanks}%
  \fi
 % \ifx\@empty\@date\else \@footnotetext{\@setdate}\fi
  \ifx\@empty\@keywords\else \@footnotetext{\@setkeywords}\fi
  \ifx\@empty\@subjclass\else \@footnotetext{\@setsubjclass}\fi
\endgroup}
\def\@setthanks{\def\thanks##1{\par##1\@addpunct.}%
  \thankses}% 
\def\@setsubjclass{%
  {\itshape\subjclassname{}:}\space\@subjclass\@addpunct.}
\def\@setkeywords{%
  {\itshape \keywordsname{}:}\space \@keywords\@addpunct.}
\AtBeginDocument{%
\if@francais
 \def\keywordsname{Mots-cl\'es}
 \def\subjclassname{Classification math.}
 \renewcommand{\abstractname}{R\'esum\'e}
 \newcommand{\altabstractname}{Abstract}
\else
 \def\keywordsname{Keywords}
 \def\subjclassname{Math. classification}
 \newcommand{\altabstractname}{R\'esum\'e}
\fi
}
\@xp\let\csname subjclassname@2000\endcsname \subjclassname
\@xp\let\csname subjclassname@1991\endcsname \subjclassname
%..........Lastpage
\newcount\auth@count
\auth@count0
\AtBeginDocument{\@ifpackageloaded{hyperref}{}{\def\url#1{#1}%
  \def\href#1#2{#2}}}
\def\@setaddresses{\par
  \begingroup
  \def\author##1{\ifcase\auth@count
    \def\tab@@what{}\or
    \def\tab@@what{&}\or
    \def\tab@@what{\tabularnewline[.4\baselineskip]}\or
    \def\tab@@what{&}\or
    \def\tab@@what{\tabularnewline[.4\baselineskip]}\or
    \def\tab@@what{&}\or
    \def\tab@@what{\tabularnewline[.4\baselineskip]}\fi
	\tab@@what
%	\message{**\the\auth@count**}
    \global\advance\auth@count1\relax
    \@ifnotempty{##1}\textsc{##1}\\}%
  \def\noauthor##1##2{\ifcase\auth@count
	    \def\tab@@what{}\or
    \def\tab@@what{&}\or
    \def\tab@@what{\tabularnewline[.4\baselineskip]}\or
    \def\tab@@what{&}\or
    \def\tab@@what{\tabularnewline[.4\baselineskip]}\or
    \def\tab@@what{&}\or
    \def\tab@@what{\tabularnewline[.4\baselineskip]}\fi
	\tab@@what
%	\message{**\the\auth@count**}
    \global\advance\auth@count1\relax
    \@ifnotempty{##2}\textsc{##2}\\}%
   \def\address##1##2{%
     \@ifnotempty{##1}{(\ignorespaces##1\unskip)\\}%
     \ignorespaces##2\unskip\\}%
 \def\curraddr##1##2{%
     \@ifnotempty{##2}{\curraddrname{}%
       \@ifnotempty{##1}{(\ignorespaces##1\unskip)}:\\
       ##2\\}}%
   \def\email##1##2{%
     \@ifnotempty{##2}{%
       \href{mailto:##2}{##2}\\}}%
   \def\urladdr##1##2{%
%     \def~{\char`\~}%
     \@ifnotempty{##2}{%\nobreak\urladdrname
%       \@ifnotempty{##1}{, \ignorespaces##1\unskip}\/:\space
       \url{##2}\\}}%
   \footnotesize
   \begin{longtable}[t]{*{2}{>{\raggedright}p{.48\textwidth}}}%
     \addresses
   \end{longtable}
   \endgroup}%
%% final
\def\enddoc@text{%
\nobreak\addvspace{.7cm}\parindent=0pt\parskip0pt\relax
\ifx\@empty\addresses \else\@setaddresses\fi\@@par}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% sections
\renewcommand\section{\@startsection {section}{1}{\z@}%
                                   {-3.5ex \@plus -1ex \@minus -.2ex}%
                                   {2.3ex \@plus.2ex}%
                                   {\normalfont\large\bfseries}}
\renewcommand\subsection{\@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\bfseries}}
\renewcommand\paragraph{\@startsection{paragraph}{4}{\z@}%
                                    {3.25ex \@plus1ex \@minus.2ex}%
                                    {-1em}%
                                    {\normalfont\normalsize\bfseries}}
\renewcommand\subparagraph{\@startsection{subparagraph}{5}{\parindent}%
                                       {3.25ex \@plus1ex \@minus .2ex}%
                                       {-1em}%
                                      {\normalfont\normalsize\bfseries}}
\let\paragraphc\paragraph
\let\subparagraphc\subparagraph
\setcounter{secnumdepth}{3}
\setcounter{tocdepth}{3}
\numberwithin{equation}{section}
%..........................
\newcommand{\MakeBibliography}[1]{%
\if@francais\begin{otherlanguage}{english}\fi
\bibliographystyle{ambp}
\nocite{*}
\bibliography{#1}
\if@francais\end{otherlanguage}\fi
}
%..............Biblio
\renewcommand{\@bibtitlestyle}{%
 \if@francais\section*{R\'ef\'erences}\else\section*{Bibliography}\fi%
}
\let\bibliofont\normalfont
\endinput
