\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{ncclatex}
         [2006/01/17 v1.07 NCC-LaTeX Extension Package (NCC)]
%
% \changes{v1.00}{2002/03/16}{This version is uploaded to CTAN}
% \changes{v1.01}{2002/05/17}{Package extdash is loaded with cyremdash}
% \changes{v1.01}{2002/05/17}{The equation counter is dynamic now}
% \changes{v1.02}{2002/05/19}{Vskip after table's caption is reduced}
% \changes{v1.03}{2004/04/08}{The processing of 'russian' option is improved}
% \changes{v1.04}{2004/12/12}{Require the latest version of nccsect}
% \changes{v1.05}{2005/01/09}{Add options T2A, T2B, T2C}
% \changes{v1.05}{2005/02/07}{Remove |\tr|, |\tl|, and |\tc| commands}
% \changes{v1.05}{2005/02/15}{Prepare equations tag in |\mathrm|)
% \changes{v1.05}{2005/03/23}{Add \NCC logo}
% \changes{v1.05}{2005/04/25}{Declare equation counter as dynamic one}
% \changes{v1.05}{2005/05/20}{Change nccsect package date to 2005/05/20}
% \changes{v1.06}{2005/12/27}{Reorganize the package!!!}
% \changes{v1.06}{2005/12/27}{The `minimize' option is introduced}
% \changes{v1.06}{2005/12/29}{Add defaults for parts in books}
% \changes{v1.06}{2006/01/01}{Minor changes}
% \changes{v1.07}{2006/01/17}{addtopackage -> afterpackage}
%
% Load basic packages
%
\RequirePackage{nccdefaults}
\RequirePackage{dcounter}[2005/04/25]
\RequirePackage{desclist}
\RequirePackage[shortcuts,cyremdash]{extdash}
\RequirePackage{nccmath}
\def\maketag@@@#1{\hbox{$\m@th\mathrm{#1}$}}
\RequirePackage{nccsect}[2005/05/20]
%
% Russian headings (Babel needed)
%
\newif\ifNCC@rus \NCC@rusfalse
\DeclareOption{russian}{\NCC@rustrue}
\DeclareOption{T2C}{\def\NCC@cyrenc{T2C}}
\DeclareOption{T2B}{\def\NCC@cyrenc{T2B}}
\DeclareOption{T2A}{\def\NCC@cyrenc{T2A}}
%
% Smaller section titles
%
\newif\ifNCC@small \NCC@smallfalse
\DeclareOption{small}{\NCC@smalltrue}
%
% The `minimize' option  does not load the optional packages:
%
\def\NCC@temp{%
  \RequirePackage{ncctheorems}
  \RequirePackage{nccthm}
  \RequirePackage{nccboxes}
  \RequirePackage{nccfoots}
  \RequirePackage{nccpic}
  \RequirePackage{nccfloats}
}
\DeclareOption{minimize}{\let\NCC@temp\relax}
%
% Process options
%
\ExecuteOptions{T2A}
\ProcessOptions\relax
\NCC@temp \let\NCC@temp\relax
%
% \acknow starts acknowledgements
%
\newcommand\acknowname{Acknowledgements}
\AfterPackage{babel}{%
  \addto\captionsrussian{%
    \def\acknowname{%
      {\cyr\CYRB\cyrl\cyra\cyrg\cyro\cyrd\cyra\cyrr\cyrn\cyro\cyrs\cyrt\cyri}}%
  }
}
\newcommand{\acknow}{%
  \NCC@secskip{\NCC@runskip}\@nobreakfalse
  \noindent\normalfont\textit\acknowname.\enskip
}
%
% Language specific actions
%
\ifNCC@rus
  \RequirePackage[\NCC@cyrenc]{fontenc}
  \RequirePackage[russian]{nccltrus}
\else
  \def\tg{\qopname\relax o{tg}}
  \def\arctg{\qopname\relax o{arctg}}
  \def\ctg{\qopname\relax o{ctg}}
  \def\arcctg{\qopname\relax o{arcctg}}
  \@ifundefined{No}{\def\No{\mbox{No.}}}{}
\fi
\let\NCC@cyrenc\relax
%
% \cref{label} is cite without square brackets
%
\newcommand*{\cref}[1]{{\def\@cite##1##2{##1}\cite{#1}}}
%
% \mop{FOO} is equivalent to \operatorname{FOO}
%
\newcommand{\mop}{\operatorname}
%
% Define NCC logo
%
\DeclareRobustCommand{\NCC}{{\protect\AmSfont
  N\kern-.05em\lower.5ex\hbox{C}\kern.05emC}%
}
%
% Customize sections and captions
%
\def\NCC@runskip{2.3ex \@plus 1ex \@minus .2ex}
\DeclareSection{-2}{table}{\bfseries}{\z@}{1.3ex}{\small}
\DeclareSection{-1}{figure}{\bfseries}{2ex}{\z@}{\small}
\ifNCC@small
  \@ifundefined{chapter}{%
    \DeclareSection*0{part}{\large\bff}%
                    {4ex \@plus 1ex \@minus .2ex}%
                    {2.8ex \@plus .2ex}{\LARGE\bff}
  }{%
    \DeclarePart{\StartFromTextArea\vspace{\stretch{.5}}\centering}%
                {\vfill\newpage}{\vspace{1.5em}\Large\bff}{\huge\bff}
    \DeclareSection*0{chapter}{\vspace{1.5ex}\large\bff}{\z@}%
                    {6ex \@plus .2ex}{\LARGE\bff}
  }
  \DeclareSection*1{section}{}%
                  {3.1ex \@plus 1ex \@minus .2ex}%
                  {1.5ex \@plus .2ex}{\large\bff}
  \DeclareSection*2{subsection}{}%
                  {2.7ex \@plus 1ex \@minus .2ex}%
                  {1.5ex \@plus .2ex}{\normalsize\bff}
  \DeclareSection*3{subsubsection}{}%
                  {\NCC@runskip}%
                  {1.5ex \@plus .2ex}{\normalsize\bff\itshape}
\else
  \@ifundefined{chapter}{%
    \DeclareSection*0{part}{\Large\bff}%
                    {5ex \@plus 1ex \@minus .2ex}%
                    {3.8ex \@plus .2ex}{\huge\bff}
  }{%
    \DeclarePart{\StartFromTextArea\vspace{\stretch{.5}}\centering}%
                {\vfill\newpage}{\vspace{2em}\LARGE\bff}{\Huge\bff}
    \DeclareSection*0{chapter}{\vspace{2ex}\Large\bff}{\z@}%
                    {8ex \@plus .2ex}{\huge\bff}
  }
  \DeclareSection*1{section}{}%
                  {3.5ex \@plus 1ex \@minus .2ex}%
                  {2.3ex \@plus .2ex}{\Large\bff}
  \DeclareSection*2{subsection}{}%
                  {3.1ex \@plus 1ex \@minus .2ex}%
                  {1.5ex \@plus .2ex}{\large\bff}
  \DeclareSection*3{subsubsection}{}%
                  {2.7ex \@plus 1ex \@minus .2ex}%
                  {1.5ex \@plus .2ex}{\normalsize\bff}
\fi
\DeclareSection4{paragraph}{}{\NCC@runskip}%
                {-.6em \@plus -.2em \@minus -.1em}{\normalsize\bff}
\DeclareSection5{subparagraph}[\parindent]{}{\NCC@runskip}%
                {-.6em \@plus -.2em \@minus -.1em}{\normalsize\bff}
%
% Millimeters are default units in NCC-LaTeX
%
\unitlength=1mm
\endinput