summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/ncctools/tocenter.sty
blob: 572ffff8b07759acf60eab833d618bfb3067ab63 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
%%
%% 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'.