%%%  TITLE PAGE ENHANCEMENTS
%%%  Brett Presnell (presnell@stat.ufl.edu)
%%%  Created: 1997/07/16
%%%  Last modified: 1999/03/02
%%% 
%%%  Copyright  1999 Brett Presnell
%%%  This program can be redistributed and/or modified under the terms
%%%  of the LaTeX Project Public License Distributed from CTAN
%%%  archives in directory macros/latex/base/lppl.txt; either
%%%  version 1 of the License, or any later version.
%%%
%%%  Gives the capability of adding keywords, a running title, AMS
%%%  subject classifications, and an ``authors footnote'' as footnotes
%%%  to the title or first page of a document.  I use it with the
%%%  article class, but I hope it will work with any class for which
%%%  the ``\thanks'' macro works.  Suggestions are welcome.
%%%
%%%  Keywords are set by, e.g., \keywords{Smoothing, bootstrap.}.
%%%
%%%  The running title is set by, e.g., \runningtitle{A few words.}.
%%%
%%%  AMS subject classifications are set by, e.g.,
%%%    \amssubj{Primary 62G07, Secondary 62G09.}
%%%
%%%  To change the phrase before the keywords, short title, or AMS
%%%   subject classifications, just use \renewcommand{\keywordsname}{...},
%%%  \renewcommand{\runningtitlename}{...}, and
%%%  \renewcommand{\amssubjname}{...}.  Similarly use
%%%  \renewcommand{\authorfnname}{...} to add a generic phrase before
%%%  the author's footnote.
%%%
%%%  I've also included a simple macro to insert a comma between
%%%  footnote marks.  Mainly this is for use with multiple "thanks"
%%%  for a single author, so it seems to fit in with the general
%%%  purposes of this package.  There must be a better way to do this
%%%  though.
%%%
%%%  CHANGES
%%%
%%%  1999/03/02: Added free-latex copyright notice.
%%%
%%%  1998/03/17: Fixed a small bug that deleted the mark on footnotes
%%%              after the title.
%%%
\ProvidesPackage{titlefoot}[1999/03/02]
%%
%%  I'm not actually sure if this needs LaTeX2e, but it might.
%%
\NeedsTeXFormat{LaTeX2e}
%%
%%  A funny little macro to insert a comma between footnote marks.
%%  It would be nice to fix this up to swallow extra spaces on either
%%  side of the comma, but for now ...
%%
\newcommand{\footnotecomma}{\hbox{\@textsuperscript{\normalfont,}}}
%%
%%  Define macros for creating keywords and AMS subject
%%  classifications:
%%
\newcommand{\keywordsname}{\textit{Key words and phrases. }}
\newcommand{\runningtitlename}{\textit{Running title. }}
\newcommand{\amssubjname}{\textit{AMS 1991 subject classifications. }}
\newcommand{\authorfnname}{}
\newcommand{\unmarkedfntext}[1]{{
  \renewcommand{\@makefnmark}{\mbox{}}
  \footnotetext{#1}
}}
\def\keywords#1{
    \protected@xdef\@keywords{\@keywords
        \protect\unmarkedfntext{{\keywordsname}#1}}%
}
\def\runningtitle#1{
    \protected@xdef\@runningtitle{\@runningtitle
        \protect\unmarkedfntext{{\runningtitlename}#1}}%
}
\def\amssubj#1{
    \protected@xdef\@amssubj{\@amssubj
        \protect\unmarkedfntext{{\amssubjname}#1}}%
}
\def\authorfootnote#1{
    \protected@xdef\@authorfootnote{\@authorfootnote
        \protect\unmarkedfntext{{\authorfnname}#1}}%
}
\let\@keywords\@empty
\let\@runningtitle\@empty
\let\@amssubj\@empty
\let\@authorfootnote\@empty
%%
%%  The rest is just a simple modification of the \maketitle stuff from
%%  the classes.dtx file in the latex2e base distribution. Alterations
%%  are highlighted.
%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%  BEGIN MATERIAL TAKEN FROM CLASSES.DTX
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  \if@titlepage
  \renewcommand\maketitle{\begin{titlepage}%
  \let\footnotesize\small
  \let\footnoterule\relax
  \let \footnote \thanks
  \null\vfil
  \vskip 60\p@
  \begin{center}%
    {\LARGE \@title \par}%
    \vskip 3em%
    {\large
     \lineskip .75em%
      \begin{tabular}[t]{c}%
        \@author
      \end{tabular}\par}%
      \vskip 1.5em%
    {\large \@date \par}%       % Set date in \large size.
  \end{center}\par
  \@thanks
%%%%%%%%% (presnell 1997/7/16) %%%%%%%%%
  \@authorfootnote                     %
  \@keywords                           %
  \@runningtitle                       %
  \@amssubj                            %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  \vfil\null
  \end{titlepage}%
  \setcounter{footnote}{0}%
  \global\let\thanks\relax
  \global\let\maketitle\relax
  \global\let\@thanks\@empty
%%%%%%%%% (presnell 1997/7/16) %%%%%%%%%
  \global\let\@authorfootnote\@empty   %
  \global\let\@keywords\@empty         %
  \global\let\@runningtitle\@empty     %
  \global\let\@amssubj\@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
}
\else
\renewcommand\maketitle{\par
  \begingroup
    \renewcommand\thefootnote{\@fnsymbol\c@footnote}%
%% This rlap is a bad idea if you use multiple thanks for one author,
%% so I'm removing it.  Could be an option, but I just think it was
%% a bad idea in the first place.
%%%%%%%%% (presnell 1998/03/12) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%    \def\@makefnmark{\rlap{\@textsuperscript{\normalfont\@thefnmark}}}% %
    \def\@makefnmark{\@textsuperscript{\normalfont\@thefnmark}}%         %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    \long\def\@makefntext##1{\parindent 1em\noindent
            \hb@xt@1.8em{%
                \hss\@textsuperscript{\normalfont\@thefnmark}}##1}%
    \if@twocolumn
      \ifnum \col@number=\@ne
        \@maketitle
      \else
        \twocolumn[\@maketitle]%
      \fi
    \else
      \newpage
      \global\@topnum\z@   % Prevents figures from going at top of page.
      \@maketitle
    \fi
    \thispagestyle{plain}\@thanks                    %
  \endgroup
%%%%%%%%% (presnell 1997/7/16) %%%%%%%%%%%%%%%%%%%%%%%
  \@authorfootnote\@runningtitle\@keywords\@amssubj  %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  \setcounter{footnote}{0}%
  \global\let\thanks\relax
%%%%%%%% (presnell 1997/7/16) %%%%%%%%%%
  \global\let\authorfootnote\relax     %
  \global\let\keywords\relax           %
  \global\let\runningtitle\relax       %
  \global\let\amssubj\relax            %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  \global\let\maketitle\relax
  \global\let\@maketitle\relax
  \global\let\@thanks\@empty
%%%%%%%%% (presnell 1997/7/16) %%%%%%%%%
  \global\let\@authorfootnote\@empty   %
  \global\let\@keywords\@empty         %
  \global\let\@runningtitle\@empty     %
  \global\let\@amssubj\@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\@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%
    {\large \@date}%
  \end{center}%
  \par
  \vskip 1.5em}
\fi

%\if@titlepage{
%  \renewenvironment{abstract}{%
%      \null\vfil\if@abstractontitlepage\else\titlepage\fi
%      \@beginparpenalty\@lowpenalty
%      \begin{center}%
%        \bfseries \abstractname
%        \@endparpenalty\@M
%      \end{center}}%
%     {\par\vfil\null\if@abstractontitlepage\else\endtitlepage\fi}
%\else
%  \renewenvironment{abstract}{%
%      \if@twocolumn
%        \section*{\abstractname}%
%      \else
%        \small
%        \begin{center}%
%          {\bfseries \abstractname\vspace{-.5em}\vspace{\z@}}%
%        \end{center}%
%        \quotation
%      \fi}
%      {\if@twocolumn\else\endquotation\fi}
%\fi

%\if@compatibility
%\renewenvironment{titlepage}
%    {%
%      \if@twocolumn
%        \@restonecoltrue\onecolumn
%      \else
%        \@restonecolfalse\newpage
%      \fi
%      \thispagestyle{empty}%
%      \setcounter{page}\z@
%    }%
%    {\if@restonecol\twocolumn \else \newpage \fi
%    }
%\else
%\renewenvironment{titlepage}
%    {%
%      \if@twocolumn
%        \@restonecoltrue\onecolumn
%      \else
%        \@restonecolfalse\newpage
%      \fi
%      \thispagestyle{empty}%
%      \setcounter{page}\@ne
%    }%
%    {\if@restonecol\twocolumn \else \newpage \fi
%     \if@twoside\else
%        \setcounter{page}\@ne
%     \fi
%    }
%\fi