\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{nccdefaults}
         [2006/01/17 v1.03 NCC-LaTeX default settings (NCC)]
%
% \changes{v1.01}{2006/01/05}{This version is uploaded to CTAN}
% \changes{v1.02}{2006/01/06}{Remove \SetTOCStyle and \ChapterPrefixStyle}
% \changes{v1.03}{2006/01/17}{addtopackage -> afterpackage}
%
% The package specifies default settings to be applied to some packages
% from ncctools collection when they will be loaded. All this technique
% is based on the `afterpackage' package from ncctools.
%
\RequirePackage{afterpackage}
%
% Declare the equation counter to be dynamic and specify the default
% count style depending on class in use.
%
\AfterPackage{dcounter}{%
  \DeclareDynamicCounter{equation}
  \@ifundefined{chapter}{\countstyle{}}{\countstyle{chapter}}
}
%
% The default style of table headers is \scriptsize
%
\AfterPackage{nccboxes}{\renewcommand{\cboxstyle}{\scriptsize}}
%
% Change defaults for the nccsect package
%
\AfterPackage{nccsect}{%
%
% Specify section, toc, and caption syffices and default section style.
%
  \SectionTagSuffix{.\hskip .6em}
  \CaptionTagSuffix{.\hskip .6em \@plus .2em \@minus .1em}
  \NumberlineSuffix{.\hskip .6em}{.\hskip .4em}
  \sectionstyle{hangindent*}
%
% \openrightorany clears page or double page depending on openright
% mode selected.
%
  \@ifundefined{if@openright}{%
    \newcommand\openrightorany{\clearpage}%
  }{%
    \newcommand\openrightorany{\clearpage
      \if@openright \if@twoside
        \begingroup\let\leftmark\relax \cleardoublepage\endgroup
      \fi\fi
    }%
  }
  \@ifundefined{chapter}{}{%
%
% The following hooks are specified in books and reports only. 
%
% Redefine the start-part and start-chapter hooks:
%
    \RequirePackage{watermark}
    \def\NCC@startpart{\openrightorany\thispageheading{}}
    \def\NCC@startchap{\openrightorany\thispageheading{}%
      \global\@topnum\z@
    }
%
% Specify the appearance of part and chapter prefices
%
    \def\NCC@thetocpart{\partname\ \thepart}
    \ChapterPrefixStyle{}% no prefix by default
%
% Provide \frontmatter, \mainmatter, and \backmatter commands
%
    \@ifundefined{if@mainmatter}{%
      \newif\if@mainmatter \@mainmattertrue
    }{}
    \providecommand\frontmatter{%
      \@mainmatterfalse\pagenumbering{roman}%
    }
    \providecommand\mainmatter{%
      {\@openrighttrue\openrightorany}%
      \@mainmattertrue
      \pagenumbering{arabic}%
    }
    \providecommand\backmatter{%
      \openrightorany \@mainmatterfalse
    }
  }
}
%
% Specify default styles for theorems
%
\AfterPackage{nccthm}{%
  \renewtheoremtype{remark}{\bfseries}{}{}
  \TheoremCommentDelimiters{}{}
  \AfterTheoremHeaderChar{.}
  \AfterTheoremHeaderSkip{\hskip .7em \@plus .2em \@minus .1em}
  \AparStyleParameters{\bfseries\mathversion{bold}}%
                      {\bfseries\mathversion{bold}}{.\enskip}
  \ProofStyleParameters{\bfseries\mathversion{bold}}{\proofname}
  \newcommand\proofname{Proof}
  \AfterPackage{babel}{%
    \addto\captionsrussian{%
      \def\proofname{%
        {\cyr\CYRD\cyro\cyrk\cyra\cyrz\cyra\cyrt\cyre\cyrl\cyrsftsn%
         \cyrs\cyrt\cyrv\cyro}}%
    }
  }
}
%
% Patch to the russian style of babel
%
\AfterPackage{babel}{%
  \ifx\cyrillicencoding\undefined \else
%
% Add a small kern to German left double quote shorthand
%
    \declare@shorthand{russian}{"`}{\glqq\nobreak\hskip.0166667em }
%
% Remove last Babel's ``improvements'' to \flqq and \frqq commands.
% The result of these improvements is that russian corner quotes
% are taken from another font encoding than T2 and look very bad.
%
    \DeclareRobustCommand{\flqq}{%
      \textormath{\guillemotleft}{\mbox{\guillemotleft}}}
    \DeclareRobustCommand{\frqq}{%
      \textormath{\guillemotright}{\mbox{\guillemotright}}}
%
% Redefine the numero sign to work in any encoding
%
    \DeclareRobustCommand{\No}{%
      \ifmmode{\nfss@text{\textnumero}}\else{\cyr\textnumero}\fi
    }
  \fi
}
\endinput
