%
% Annales Mathematiques Blaise Pascal
% ambp.sty 
%
% Created by:
% 
% Timothy Kohl
% Boston University
% tkohl@bu.edu
% April 6, 2001
%
% Modified for use with french.sty - May 18, 2001
% 

%
% Numbering fix - January 31, 2002
%

\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{ambp}


%
% All theorems are keyed to section number and 
% corollaries etc. are keyed to theorem number.
%

\newcounter{ambpsect}[section]

\newenvironment{theorem}{\medskip\par\noindent{\bf Theorem \thesection.\theambpsect:\bf}\it}{\it\medskip\par\stepcounter{ambpsect}}

\newenvironment{lemma}{\medskip\par\noindent{\bf Lemma \thesection.\theambpsect:\bf}\it}{\it\medskip\par\stepcounter{ambpsect}}

\newenvironment{corollary}{\medskip\par\noindent{\bf Corollary \thesection.\theambpsect:\bf}\it}{\it\medskip\par\stepcounter{ambpsect}}

\newenvironment{proposition}{\medskip\par\noindent{\bf Proposition \thesection.\theambpsect:\bf}\it}{\it\medskip\par\stepcounter{ambpsect}}


% If the French package is used, we have these available.

\newenvironment{theoreme}{\medskip\par\noindent{\bf Th\'eor\`eme \thesection.\theambpsect:\bf}\it}{\it\medskip\par\stepcounter{ambpsect}}

\newenvironment{lemme}{\medskip\par\noindent{\bf Lemme \thesection.\theambpsect:\bf}\it}{\it\medskip\par\stepcounter{ambpsect}}

\newenvironment{corollaire}{\medskip\par\noindent{\bf Corollaire \thesection.\theambpsect:\bf}\it}{\it\medskip\par\stepcounter{ambpsect}}



% proposition is unchanged

%
% Environments for definitions, remarks and such.
%
\newenvironment{definition}{\medskip\noindent{\it Definition: }}{\medskip\par}
\newenvironment{remark}{\medskip\noindent{\it Remark: }}{\medskip\par}
\newenvironment{notation}{\medskip\noindent{\it Notation: }}{\medskip\par}
\newenvironment{example}{\medskip\noindent{\it Example: }}{\medskip\par}


% and for those using the French package

\ifx\defined\frenchname
\renewenvironment{definition}{\medskip\noindent{\it D\'efinition: }}{\medskip\par}
\fi
\newenvironment{remarque}{\medskip\noindent{\it Remarque: }}{\medskip\par}
\newenvironment{exemple}{\medskip\noindent{\it Exemple: }}{\medskip\par}

% notation is the same in French


%
% Proof environment
%
\newcommand{\qedbox}{ \fbox{}}
\newenvironment{proof}{\noindent\textsc{Proof: }}{\hfill$\qedbox$\par\medskip\par}

% and for those using the French package
\newenvironment{preuve}{\noindent\textsc{Preuve: }}{\hfill$\qedbox$\par\medskip\par}


%
% Provide for equation numbering keyed to section.
% 
\renewcommand{\theequation}{\thesection.\arabic{equation}}

%
% All this is for the author info, for the title page and the address 
% blocks on the last page.
%
\newif\ifFirstAuthor
\newif\ifFirstInstitution
\newif\ifFirstDepartment
\newif\ifLongFirstDepartment
\newif\ifFirstStreetAddress
\newif\ifFirstCity
\newif\ifFirstCountry
\newif\ifFirstEmail
\newif\ifFirstSupport
%
\newif\ifSecondAuthor
\newif\ifSecondInstitution
\newif\ifSecondDepartment
\newif\ifLongSecondDepartment
\newif\ifSecondStreetAddress
\newif\ifSecondCity
\newif\ifSecondCountry
\newif\ifSecondEmail
\newif\ifSecondSupport
%
\newif\ifThirdAuthor
\newif\ifThirdInstitution
\newif\ifThirdDepartment
\newif\ifLongThirdDepartment
\newif\ifThirdStreetAddress
\newif\ifThirdCity
\newif\ifThirdCountry
\newif\ifThirdEmail
\newif\ifThirdSupport
%
\newif\ifLongFirstSecond
\newif\ifLongFirstOnly
\newif\ifLongSecondOnly
\newif\ifLongNeither
\LongFirstSecondfalse
\LongFirstOnlyfalse
\LongSecondOnlyfalse
\LongNeithertrue



%
% For running headers
%
\newcommand\ShortAuthor[1]{\gdef\@ShortAuthor{#1}}
\ShortAuthor{}
\newcommand\ShortTitle[1]{\gdef\@ShortTitle{#1}}
\ShortTitle{}
%
%
\newcommand\FirstAuthor[1]{\gdef\@FirstAuthor{#1}\FirstAuthortrue}
\newcommand\FirstEmail[1]{\gdef\@FirstEmail{#1}\FirstEmailtrue}
\newcommand\FirstInstitution[1]{\gdef\@FirstInstitution{#1}\FirstInstitutiontrue}
\newcommand\FirstDepartment[1]{\gdef\@FirstDepartment{#1}\FirstDepartmenttrue}
\newcommand\LongFirstDepartment[1]{
  \gdef\@LongFirstDepartment{#1}
  \LongFirstDepartmenttrue
  \LongNeitherfalse
  \LongFirstOnlytrue
}
\newcommand\FirstStreetAddress[1]{\gdef\@FirstStreetAddress{#1}\FirstStreetAddresstrue}
\newcommand\FirstCity[1]{\gdef\@FirstCity{#1}\FirstCitytrue}
\newcommand\FirstCountry[1]{\gdef\@FirstCountry{#1}\FirstCountrytrue}
\newcommand\FirstSupport[1]{\gdef\@FirstSupport{#1}\FirstSupporttrue} 
%
\newcommand\SecondAuthor[1]{\gdef\@SecondAuthor{#1}\SecondAuthortrue}
\newcommand\SecondEmail[1]{\gdef\@SecondEmail{#1}\SecondEmailtrue}
\newcommand\SecondInstitution[1]{\gdef\@SecondInstitution{#1}\SecondInstitutiontrue}
\newcommand\SecondDepartment[1]{\gdef\@SecondDepartment{#1}\SecondDepartmenttrue}
\newcommand\LongSecondDepartment[1]{
  \gdef\@LongSecondDepartment{#1}
  \LongSecondDepartmenttrue
  \LongNeitherfalse
  \ifLongFirstDepartment
     \LongFirstOnlyfalse
     \LongFirstSecondtrue
  \else
  \LongSecondOnlytrue
\fi}
\newcommand\SecondStreetAddress[1]{\gdef\@SecondStreetAddress{#1}\SecondStreetAddresstrue}
\newcommand\SecondCity[1]{\gdef\@SecondCity{#1}\SecondCitytrue}
\newcommand\SecondCountry[1]{\gdef\@SecondCountry{#1}\SecondCountrytrue}
\newcommand\SecondSupport[1]{\gdef\@SecondSupport{#1}\SecondSupporttrue} 
%
\newcommand\ThirdAuthor[1]{\gdef\@ThirdAuthor{#1}\ThirdAuthortrue}
\newcommand\ThirdEmail[1]{\gdef\@ThirdEmail{#1}\ThirdEmailtrue}
\newcommand\ThirdInstitution[1]{\gdef\@ThirdInstitution{#1}\ThirdInstitutiontrue}
\newcommand\ThirdDepartment[1]{\gdef\@ThirdDepartment{#1}\ThirdDepartmenttrue}
\newcommand\LongThirdDepartment[1]{\gdef\@LongThirdDepartment{#1}\LongThirdDepartmenttrue}
\newcommand\ThirdStreetAddress[1]{\gdef\@ThirdStreetAddress{#1}\ThirdStreetAddresstrue}
\newcommand\ThirdCity[1]{\gdef\@ThirdCity{#1}\ThirdCitytrue}
\newcommand\ThirdCountry[1]{\gdef\@ThirdCountry{#1}\ThirdCountrytrue}
\newcommand\ThirdSupport[1]{\gdef\@ThirdSupport{#1}\ThirdSupporttrue} 

%
% These are set by editor when ready to publish.
%
\newcommand\JournalVolume[1]{\gdef\@JournalVolume{#1}}
\newcommand\JournalYear[1]{\gdef\@JournalYear{#1}}
\newcommand\ArticlePages[1]{\gdef\@ArticlePages{#1}}

% defaults until set by editor
\JournalVolume{0}
\JournalYear{2001}
\ArticlePages{0-0}
%
%
\def\@maketitle{
  \newpage\null\vskip-4em
  \noindent\scriptsize{\textsc{Annales Mathematiques Blaise Pascal}}
  \scriptsize{\textbf{\@JournalVolume}, \@ArticlePages\ (\@JournalYear)}
  \vskip 2em
  \begin{center}
    {\Large \textbf \@title \par}
    \vskip 1.5em
    {\large
      \lineskip .5em
      \begin{tabular}[t]{c}
        \@FirstAuthor\ifFirstSupport$^{1}$\fi \\
        \ifSecondAuthor \@SecondAuthor \ifSecondSupport$^{2}$\fi \fi \\
        \ifThirdAuthor \@ThirdAuthor \ifThirdSupport$^{3}$\fi\fi \\
      \end{tabular}
      \par}
    \vskip 1em
  \end{center}
  \par
  \vskip 1.5em
\def\@makefnmark{}
%\renewcommand{\thefootnote}{\fnsymbol{footnote}}
\ifFirstSupport\footnote[0]{\small $^{1}$\@FirstSupport}\fi
\ifSecondSupport\footnote[0]{\small $^{2}$\@SecondSupport}\fi
\ifThirdSupport\footnote[0]{\small $^{3}$\@ThirdSupport}\fi
}
%
% This is for the running headers.
%
\def\ps@headings{ 
      \def\@oddhead{\hfil\textsc{\@ShortTitle}\hfil}%
      \def\@evenhead{\hfil\textsc{\@ShortAuthor}\hfil}%
      \def\@oddfoot{\hfil\thepage\hfil}%
}
\pagestyle{headings}

%


%
% This is so editors can set the correct page number 
% for the start of the article in the given issue
% in which the article appears.
%
\newcommand\setpagenumber[1]{\setcounter{page}{#1}}


%
% Make section headings have smaller fonts.
% and make sure theorems etc. are numbered starting
% with 1 instead of 0. 
%
\renewcommand\section{\@startsection {section}{1}{\z@}%
                                   {-3.5ex \@plus -1ex \@minus -.2ex}%
                                   {2.3ex \@plus.2ex}%
                                   {\normalfont\large\bfseries\setcounter{ambpsect}{1}}}
%
% This is for the address blocks at the end of the article.
%
\newcommand\PFA{\ifFirstAuthor\textsc{\footnotesize\@FirstAuthor}\fi }
\newcommand\PFI{\ifFirstInstitution\textsc{\footnotesize\@FirstInstitution}\fi }
\newcommand\PFD{\ifFirstDepartment\textsc{\footnotesize\@FirstDepartment}\fi}
\newcommand\PLFD{\ifLongFirstDepartment\textsc{\footnotesize \ \ \@LongFirstDepartment}\fi}
\newcommand\PFS{\ifFirstStreetAddress\textsc{\footnotesize\@FirstStreetAddress}\fi  }
\newcommand\PFCi{\ifFirstCity\textsc{\footnotesize\@FirstCity}\fi }
\newcommand\PFCo{\ifFirstCountry\textsc{\footnotesize\@FirstCountry}\fi}
\newcommand\PFE{\ifFirstEmail\texttt{\footnotesize\@FirstEmail}\fi}
%%
\newcommand\PSA{\ifSecondAuthor\textsc{\footnotesize\@SecondAuthor}\fi }
\newcommand\PSI{\ifSecondInstitution\textsc{\footnotesize\@SecondInstitution}\fi}
\newcommand\PSD{\ifSecondDepartment\textsc{\footnotesize\@SecondDepartment}\fi}
\newcommand\PLSD{\ifLongSecondDepartment\textsc{\footnotesize \ \ \@LongSecondDepartment}\fi}
\newcommand\PSS{\ifSecondStreetAddress\textsc{\footnotesize\@SecondStreetAddress}\fi}
\newcommand\PSCi{\ifSecondCity\textsc{\footnotesize\@SecondCity}\fi}
\newcommand\PSCo{\ifSecondCountry\textsc{\footnotesize\@SecondCountry}\fi}
\newcommand\PSE{\ifSecondEmail\texttt{\footnotesize\@SecondEmail}\fi}
%%
\newcommand\PTA{\ifThirdAuthor\textsc{\footnotesize\@ThirdAuthor}\fi }
\newcommand\PTI{\ifThirdInstitution\textsc{\footnotesize\@ThirdInstitution}\fi}
\newcommand\PTD{\ifThirdDepartment\textsc{\footnotesize\@ThirdDepartment}\fi}
\newcommand\PLTD{\ifLongThirdDepartment\textsc{\footnotesize \ \ \@LongThirdDepartment}\fi}
\newcommand\PTS{\ifThirdStreetAddress\textsc{\footnotesize\@ThirdStreetAddress}\fi}
\newcommand\PTCi{\ifThirdCity\textsc{\footnotesize\@ThirdCity}\fi}
\newcommand\PTCo{\ifThirdCountry\textsc{\footnotesize\@ThirdCountry}\fi}
\newcommand\PTE{\ifThirdEmail\texttt{\footnotesize\@ThirdEmail}\fi}
%%
\newif\ifPrintThird
\newif\ifPrintSecond
\newif\ifPrintFirst
\PrintThirdtrue
\PrintSecondtrue
\PrintFirsttrue
%
%
\AtEndDocument{
%
% Decide whether there are one, two, or three addresses to print. 
%
\ifThirdAuthor\PrintThirdtrue\PrintSecondfalse\PrintFirstfalse\fi
\ifPrintSecond\ifSecondAuthor\PrintThirdfalse\PrintFirstfalse\fi\fi
%
%

\vspace{0.125in}
%
\ifPrintThird

\ifLongFirstOnly
\begin{tabular}{p{15em}p{15em}}
\PFA  & \PSA  \\
\PFI  & \PSI  \\
\PFD  & \PSD  \\ 
\PLFD & \PSS  \\
\PFS  & \PSCi \\
\PFCi & \PSCo \\
\PFCo & \PSE  \\
\PFE  & \\ 
\end{tabular}\\ \\ \\ 
\fi %LFO

\ifLongSecondOnly
\begin{tabular}{p{15em}p{15em}}
\PFA  & \PSA  \\
\PFI  & \PSI  \\
\PFD  & \PSD  \\ 
\PFS  & \PLSD \\
\PFCi & \PSS  \\
\PFCo & \PSCi \\
\PFE  & \PSCo \\
      & \PSE  \\
\end{tabular}\\ \\ \\ 
\fi %LSO

\ifLongFirstSecond
\begin{tabular}{p{15em}p{15em}}
\PFA   & \PSA \\
\PFI   & \PSI  \\
\PFD   & \PSD  \\ 
\PLFD  & \PLSD  \\ 
\PFS   & \PSS  \\
\PFCi  & \PSCi \\
\PFCo  & \PSCo \\
\PFE   & \PSE  \\
\end{tabular}\\ \\ \\ 
\fi %LFS

\ifLongNeither
\begin{tabular}{p{15em}p{15em}}
\PFA  & \PSA  \\
\PFI  & \PSI  \\
\PFD  & \PSD  \\ 
\PFS  & \PSS  \\
\PFCi & \PSCi \\
\PFCo & \PSCo \\
\PFE  & \PSE  \\
\end{tabular}\\ \\ \\ 
\fi %LN

\ifLongThirdDepartment
\begin{tabular}{l}
\PTA \\
\PTI \\
\PTD \\
\PLTD \\
\PTS \\
\PTCi \\
\PTCo \\
\PTE \\
\end{tabular}
\else
\begin{tabular}{l}
\PTA \\
\PTI \\
\PTD \\
\PTS \\
\PTCi \\
\PTCo \\
\PTE \\
\end{tabular}
\fi

\fi %PT
%
\ifPrintSecond

\ifLongFirstOnly
\begin{tabular}{p{15em}p{15em}}
\PFA  & \PSA \\
\PFI  & \PSI  \\
\PFD  & \PSD  \\ 
\PLFD & \PSS  \\
\PFS  & \PSCi \\
\PFCi & \PSCo \\
\PFCo & \PSE  \\
\PFE  & \\ 
\end{tabular}\\ \\ \\ 
\fi % LFO

\ifLongSecondOnly
\begin{tabular}{p{15em}p{15em}}
\PFA  & \PSA \\
\PFI  & \PSI  \\
\PFD  & \PSD  \\ 
\PFS  & \PLSD \\
\PFCi  & \PSS  \\
\PFCo & \PSCi \\
\PFE & \PSCo \\
     & \PSE  \\
\end{tabular}\\ \\ \\ 
\fi %LSO

\ifLongFirstSecond
\begin{tabular}{p{15em}p{15em}}
\PFA  & \PSA \\
\PFI  & \PSI  \\
\PFD  & \PSD  \\ 
\PLFD  & \PLSD  \\ 
\PFS  & \PSS  \\
\PFCi & \PSCi \\
\PFCo & \PSCo \\
\PFE  & \PSE  \\
\end{tabular}\\ \\ \\ 
\fi %LFS

\ifLongNeither
\begin{tabular}{p{15em}p{15em}}
\PFA  & \PSA \\
\PFI  & \PSI  \\
\PFD  & \PSD  \\ 
\PFS  & \PSS  \\
\PFCi & \PSCi \\
\PFCo & \PSCo \\
\PFE  & \PSE  \\
\end{tabular}\\ \\ \\ 
\fi %LN

\begin{tabular}{l}
\PTA \\
\PTI \\
\PTD \\
\PTS \\
\PTCi \\
\PTCo \\
\PTE \\
\end{tabular}
\fi
%
\ifPrintFirst
\begin{tabular}{l}
\PTA  \\
\PFI  \\
\PFD  \\
\PFS  \\
\PFCi \\
\PFCo \\
\PFE  \\
\end{tabular}
\fi
}
%------------------------------------------------------------------------