\ProvidesPackage{ncctitle}
         [2005/12/26 v1.06 Title page (NCC)]
%
% \changes{v1.00}{2002/02/19}{This version is uploaded to CTAN}
% \changes{v1.01}{2004/11/30}{Add the \NCC@titlestyle hook}
% \changes{v1.01}{2004/11/30}{Add the \StartFromHeaderArea command
%                             at the beginning of title and abstract}
% \changes{v1.01}{2004/11/30}{Service title management commands added}
% \changes{v1.02}{2004/12/07}{Add the \NCC@abstractstyle hook}
% \changes{v1.02}{2004/12/07}{Introduce \makelastpage command}
% \changes{v1.02}{2004/12/07}{Add services for the abstract and last page}
% \changes{v1.03}{2004/12/16}{Replace \NCC@gempty with \@empty}
% \changes{v1.04}{2005/06/18}{Use \ExpandTextArea in title pages}
% \changes{v1.04}{2005/06/18}{Introduce \titleareadefault}
% \changes{v1.05}{2005/07/24}{Replace \vfil to \vfill in the \endabstract}
% \changes{v1.06}{2005/12/26}{Change extension from .clo to .sty}
%
% This package provides a title, an abstract, and a last page prepared
% on separate title pages.
%
\RequirePackage{ncctitlepage}
%
% The expansion of the text area on these pages is specified with the
% \titleareadefault macro.
%
\newcommand\titleareadefault{*}
%
% The \maketitle uses the following hooks:
%
% \NCC@titlestyle   a style applied to the title
% \NCC@titlebegin   typed out at the beginning of title
% \@maketitle       prepares a title
% \NCC@titlecomment typed out right after the title
% \NCC@titleend     typed out at the end of title
%
% We do not delete title specific commands because the \@maketitle
% command can be used for preparing other special pages also.
%
\def\maketitle{%
  \begin{titlepage}%
    \NCC@titlestyle
    \ExpandTextArea[\titleareadefault]%
    \let\footnoterule\relax
    \renewcommand\thefootnote{\@fnsymbol\c@footnote}%
    \begingroup
      \def\@makefnmark{\@textsuperscript{\normalfont\@thefnmark}}%
      \NCC@titlebegin
      \@maketitle
      \NCC@titlecomment
      \NCC@titleend
    \endgroup
    \@thanks\setcounter{footnote}{0}\gdef\@thanks{}%
  \end{titlepage}%
}
\let\NCC@titlecomment\@empty
%
% What goes first in title: author or title?
%
\@ifundefined{ifNCC@authorbeforetitle}{%
  \newif\ifNCC@authorbeforetitle
  \newcommand{\AuthorBeforeTitle}{\NCC@authorbeforetitletrue}
  \newcommand{\TitleBeforeAuthor}{\NCC@authorbeforetitlefalse}
  \@onlypreamble\AuthorBeforeTitle
  \@onlypreamble\TitleBeforeAuthor
  \AuthorBeforeTitle
}
%
% \@maketitle makes the title itself. The \@date useless in NCC titles
%
\def\@maketitle{%
  \ifx\@author\@empty {\huge\bff \@title \par}%
  \else
    \ifNCC@authorbeforetitle \else
      {\huge\bff \@title \par}\vskip 3em
    \fi
    {\Large\bfseries \lineskip .75em \@author \par}%
    \ifNCC@authorbeforetitle 
      \vskip 2em {\huge\bff \@title \par}%
    \fi
  \fi
}
%
% Service hooks for the title:
%
% \titlestretch{value}
% \titlestyle{A style}
% \titlehead{A text at the top of title}
% \titlesign{A sign of Publishing House}
% \titlefoot{A text at the bottom of title}
% \titlecomment{A comment below title}
%
% The \titlecomment is also applied to the last page
%
\newcommand*\titlestretch[1]{\def\NCC@titlestretch{#1}}
\newcommand*\titlestyle[1]{\def\NCC@titlestyle{#1}}
\newcommand\titlehead[1]{\def\NCC@titlebegin{{#1\par}\vfill}}
\newcommand\titlesign[1]{\def\NCC@titlesign{#1}}
\newcommand\titlefoot[1]{%
  \def\NCC@titleend{%
    \vspace{\stretch{\NCC@titlestretch}}%
    {\NCC@titlesign\par}%
    \vspace{\stretch{\NCC@titlestretch}}%
    {#1\par}%
  }%
}
\newcommand\titlecomment[1]{%
  \def\@tempa{#1}%
  \ifx\@tempa\@empty
    \let\NCC@titlecomment\@empty
  \else
    \def\NCC@titlecomment{\vskip 1.5em {\large#1\par}}%
  \fi
}
%
% The abstract environment uses the following hooks:
%
% \NCC@abstractstyle a style applied to the abstract
% \NCC@abstractbegin typed out at the beginning of abstract
% \NCC@abstractend   typed out at the end of abstract
%
% The area of the abstract page is specified with \TitleAreaDefault macro.
%
\def\abstract{%
  \titlepage 
  \NCC@abstractstyle
  \ExpandTextArea[\titleareadefault]%
  \NCC@abstractbegin
  \begingroup
}
\def\endabstract{
  \par\endgroup
  \vfill
  \NCC@abstractend
  \endtitlepage
}
%
% Service hooks for the abstract:
%
% \abstractstyle{A style for main part of abstract}
% \bibindex[style]{A bibliography index of the document}
% \copyrighttable[style]{ISBN}{\item copyright\\ \item copyright ...}
%
% \fulltitle[style]{authors}{full title} this command is used inside
% the abstract.
%
% In the \bibindex and \copyrighttable, the default style is \footnotesize.
% In the \fulltitle, the default style is \normalsize.
%
\newcommand*\abstractstyle[1]{%
  \def\NCC@abstractstyle{#1\def\qef{\par\addvspace{2.5ex \@minus .5ex}}}%
}
\newcommand\bibindex[2][\footnotesize]{%
  \if!#2!%
    \let\NCC@abstractbegin\@empty
  \else
    \def\NCC@abstractbegin{{\noindent#1\ignorespaces#2\par}\qef}%
  \fi
}
\newcommand*\copyrighttable[3][\footnotesize]{%
  \def\NCC@abstractend{#1\noindent
    \pbox[lb]{#2}\hfill
    \def\item{\llap{\copyright\ }}%
    \pbox[lb]{#3}%
    \par
  }
}
\newcommand*\fulltitle[3][\normalsize]{%
  {\par#1\normalfont{\bfseries#2} #3\par}%
  \qef%
}
%
% The \makelastpage uses the following hooks:
%
% \NCC@lastpagestyle   a style applied to the last page
% \NCC@lastpagebegin   typed out at the beginning of the last page
% \@maketitle          prepares a title
% \NCC@titlecomment    typed out right after the title on the last page
% \NCC@lastpageend     typed out at the end of the last page
%
% The area of the last page is specified with \TitleAreaDefault macro.
%
\newcommand{\makelastpage}{%
  \begin{titlepage}%
    \NCC@lastpagestyle
    \ExpandTextArea[\titleareadefault]%
    \NCC@lastpagebegin
    \@maketitle
    \NCC@titlecomment
    \NCC@lastpageend
  \end{titlepage}%
}
%
% Service hooks for the last page:
%
% \lastpagestretch{value}
% \lastpagestyle{A style}
% \lastpagehead{A text at the top of the last page}
% \lastpageinfo[style]{Designers}{Publishing attributes}{Publisher}
%
\newcommand*\lastpagestretch[1]{\def\NCC@lastpagestretch{#1}}
\newcommand*\lastpagestyle[1]{\def\NCC@lastpagestyle{#1}}
\newcommand\lastpagehead[1]{\def\NCC@lastpagebegin{{#1\par}\vfill}%
}
\newcommand\lastpageinfo[4][\small]{%
  \def\NCC@lastpageend{#1%
    \vspace{\stretch{\NCC@lastpagestretch}}%
    {#2\par}\bigskip
    \hrule \@height .6pt\@width\linewidth
    {\Strut/.5/\ignorespaces#3\unskip\Strut/-.5/\par}%
    \hrule \@height .6pt\@width\linewidth
    \bigskip{#4\par}%
  }%
}
%
% Defaults
%
\titlestretch{1}
\titlestyle{\centering}
\titlehead{}
\titlesign{}
\titlefoot{}
\titlecomment{}
%
\abstractstyle{\small}
\bibindex{}
\def\NCC@abstractend{}
%
\lastpagestretch{1}
\lastpagestyle{\centering}
\lastpagehead{}
\def\NCC@lastpageend{\vspace{\stretch{\NCC@lastpagestretch}}}
%
\endinput