%%
%% This is file `tocenter.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% tocenter.dtx  (with options: `package')
%% 
%% IMPORTANT NOTICE:
%% 
%% This file is a generated file from the sources of the `ncctools'
%% bundle.
%% 
%% You are not allowed to modify this file.
%% 
%% You are allowed to distribute this file if and only if
%% it is distributed with the corresponding source files in
%% the `ncctools' bundle.
%% 
%% For the copying and distribution conditions of the source files,
%% see the README file distributed with the ncctools bundle.
%%
%% File: tocenter.dtx Copyright (C) 2002--2004 by Alexander I. Rozhenko
%%
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{tocenter}
         [2004/12/09 v1.1 Centering Page Layout (NCC)]
\def\NCC@pos#1{%
  \let\NCC@h\@gobble \let\NCC@f\@gobble \let\NCC@m\@gobble
  \@tfor\@tempa:=#1\do{%
    \if h\@tempa
      \def\NCC@h##1{\advance##1\headsep \advance##1\headheight}%
     \else
      \if f\@tempa
        \def\NCC@f##1{\advance##1\footskip}%
       \else
        \if m\@tempa
          \def\NCC@m##1{\advance##1\marginparwidth
            \advance##1\marginparsep}%
        \fi
      \fi
    \fi
  }%
}
\newcommand{\ToCenter}{%
  \@ifstar{\pagestyle{empty}\nofiles\NCC@center[]}{\NCC@center}%
}
\@onlypreamble\ToCenter
\newcommand*{\NCC@center}[3][]{\NCC@pos{#1}%
  \setlength\textwidth{#2}%
  \@tempdima\textwidth \NCC@m\@tempdima
  \if@twocolumn
    \NCC@m\@tempdima
    \@tempdimb\paperwidth
    \advance\@tempdimb -\@tempdima
    \@tempdima .5\@tempdimb \NCC@m\@tempdima
    \oddsidemargin\@tempdima
    \evensidemargin\@tempdima
  \else
    \@tempdimb\paperwidth
    \advance\@tempdimb -\@tempdima \@tempdima .5\@tempdimb
    \if@reversemargin
      \evensidemargin\@tempdima
      \NCC@m\@tempdima
      \oddsidemargin\@tempdima
    \else
      \oddsidemargin\@tempdima
      \NCC@m\@tempdima
      \evensidemargin\@tempdima
    \fi
  \fi
  \setlength\textheight{#3}%
  \@tempdima\textheight \NCC@h\@tempdima \NCC@f\@tempdima
  \@tempdimb\paperheight
  \advance\@tempdimb -\@tempdima
  \topmargin .5\@tempdimb
  \ifx\NCC@h\@gobble
    \advance\topmargin -\headsep
    \advance\topmargin -\headheight
  \fi
  \advance \oddsidemargin  -1in
  \advance \evensidemargin -1in
  \advance \topmargin      -1in
}
\@onlypreamble\NCC@center
\newcommand{\FromMargins}{%
  \@ifstar{\pagestyle{empty}\nofiles\NCC@margin[]}{\NCC@margin}%
}
\@onlypreamble\FromMargins
\newcommand*{\NCC@margin}[5][]{\NCC@pos{#1}%
  \setlength\oddsidemargin{#2}%
  \setlength\evensidemargin{#3}%
  \@tempdima\oddsidemargin \advance\@tempdima\evensidemargin
  \NCC@m\@tempdima
  \if@twocolumn
    \NCC@m\@tempdima
    \textwidth\paperwidth
    \advance\textwidth -\@tempdima
    \NCC@m\oddsidemargin \NCC@m\evensidemargin
  \else
    \textwidth\paperwidth
    \advance\textwidth -\@tempdima
    \if@reversemargin
      \NCC@m\oddsidemargin
    \else
      \NCC@m\evensidemargin
    \fi
  \fi
  \setlength\topmargin{#4}%
  \setlength\@tempdima{#5}\advance\@tempdima\topmargin
  \NCC@h\@tempdima \NCC@f\@tempdima
  \textheight\paperheight
  \advance\textheight -\@tempdima
  \ifx\NCC@h\@gobble
    \advance\topmargin -\headsep
    \advance\topmargin -\headheight
  \fi
  \advance \oddsidemargin  -1in
  \advance \evensidemargin -1in
  \advance \topmargin      -1in
}
\@onlypreamble\NCC@margin
\endinput
%%
%% End of file `tocenter.sty'.
