summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/ncclatex/nccbook.clo
blob: d3c98ad83fc38a309d39ec78cea2e19956f5fef9 (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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
\ProvidesFile{nccbook.clo}
         [2005/06/19 v1.05 Book subclass (NCC)]
%
% \changes{v1.00}{2002/03/24}{This version is uploaded to CTAN}
% \changes{v1.01}{2003/01/12}{Bug in \ChapterPrefixStyle{toc} fixed}
% \changes{v1.02}{2004/12/06}{Replace \NCC@null with \StartFromTextArea}
% \changes{v1.03}{2004/12/12}{Modify part generation commands}
% \changes{v1.04}{2005/03/23}{Remove \skipwritingtoaux in index head}
% \changes{v1.04}{2005/06/08}{Introduce the \DeclarePart command}
% \changes{v1.04}{2005/06/08}{Introduce the \DeclareTOCPart command}
% \changes{v1.05}{2005/06/19}{Page break after \l@part is forbidden}
% \changes{v1.05}{2005/06/19}{New optional parameter in \DeclareTOCPart}
% 
\@addtoreset{footnote}{chapter}
\setcounter{tocdepth}{2}
\setcounter{secnumdepth}{2}
\def\NCC@tochead#1{\noheadingtag\skipwritingtoaux\chapter{#1}}
\def\NCC@idxhead#1{%
  \twocolumn \noheadingtag\chapter{#1}%
}
%
% \frontmatter, \mainmatter, \backmatter
%
\newif\if@mainmatter \@mainmattertrue
\newcommand\frontmatter{%
  \@mainmatterfalse\pagenumbering{roman}%
}
\newcommand\mainmatter{%
  {\@openrighttrue\openrightorany}%
  \@mainmattertrue
  \pagenumbering{arabic}%
}
\newcommand\backmatter{%
  \openrightorany \@mainmatterfalse
}
%
% Control of appearance chapter name in header and toc:
%
% \ChapterPrefixStyle{header,toc}
%
% The parameter list can contain two words: header and/or toc.
% Using them you set prefix style for header and/or toc respectively.
%
\newcommand{\@chapapp}{\chaptername}
\newcommand*{\ChapterPrefixStyle}[1]{%
  \def\NCC@thetocchapter{\thechapter}%
  \def\NCC@theheadchapter{\thechapter}%
  \@for\@tempa:=#1\do
    {\csname NCC@chapin@\@tempa\endcsname}%
}
\def\NCC@chapin@toc{\def\NCC@thetocchapter{\@chapapp\ \thechapter}}
\def\NCC@chapin@header{\def\NCC@theheadchapter{\@chapapp\ \thechapter}}
\@onlypreamble\ChapterPrefixStyle
\@onlypreamble\NCC@chapin@toc
\@onlypreamble\NCC@chapin@header
\ChapterPrefixStyle{} % no prefix by default
%
% \ps@headings, \ps@myheadings
%
\def\ps@headings{\NCC@setpsheading
  \def\partmark##1{%
    \NCC@firstmark{\ifnum \c@secnumdepth>-2\relax
        \partname\ \thepart.\enskip \fi
      \ignorespaces##1}}%
  \def\chaptermark##1{%
    \NCC@firstmark{\ifnum \c@secnumdepth>\m@ne
         \if@mainmatter \NCC@theheadchapter.\enskip \fi \fi
       \ignorespaces##1}}%
  \def\sectionmark##1{%
    \NCC@secondmark{\ifnum\c@secnumdepth>\z@\thesection.\enskip\fi
      \ignorespaces##1}}%
}  
\def\ps@myheadings{\NCC@setpsheading
  \let\partmark   \@gobble
  \let\chaptermark\@gobble
  \let\sectionmark\@gobble
}
%
% \appendix
%
\newcommand{\appendix}{\par
  \setcounter{chapter}{-1}\stepcounter{chapter}%
  \gdef\@chapapp{\appendixname}%
  \gdef\thechapter{\@Alph\c@chapter}%
}
%
% thebibliography
%
\newenvironment{thebibliography}{%
  \noheadingtag \chapter{\bibname}\biblist[0]%
}{\endbiblist}
%
% Redefine start chapter hook
%
\def\NCC@startchap{%
  \openrightorany
  \thispageheading{}%
  \global\@topnum\z@
}
%
% \DeclarePart{BEFORE}{AFTER}{PREFIX}{STYLE}
%
\newcommand\DeclarePart[4]{%
  \def\part{%
    \openrightorany
    \thispageheading{}%
    \def\NCC@makesectag####1{\leavevmode#3\partname\nobreakspace####1}%
    \secdef\@part\@spart
  }%
  \def\NCC@makepart##1##2{%
    \if@twocolumn  \onecolumn \@tempswatrue \else \@tempswafalse \fi
    \begingroup\normalfont
      #1%
      \ifx\@svsec\@empty \else {\@svsec\par}\nobreak \fi
      \interlinepenalty \@M
      #4{##1}\par
    \endgroup
    ##2#2%
    \if@tempswa \twocolumn \fi
  }
}
\@onlypreamble\DeclarePart
\def\@spart#1{%
  \let\@svsec\@empty
  \NCC@makepart{#1}{}%
  \NCC@sec@reset@controls
  \NCC@defaultsectag
}
\def\@part[#1]#2{%
  \def\NCC@make{\NCC@makepart{#2}}%
  \NCC@makesection{part}{\m@ne}{#1}{%
    \addcontentsline{toc}{part}{%
      \ifnum \c@secnumdepth>-2
        \protect\numberline{\partname\ \thepart}\fi
      #1%
    }%
  }%
  \NCC@defaultsectag
}
%
% \DeclareTOCPart{ACTION}[AFTERSKIP]{PREFIX}{PROTOTYPE}{STYLE}
%
\newcommand*\DeclareTOCPart[1]{%
  \@ifnextchar[{\NCC@dtocpart{#1}}{\NCC@dtocpart{#1}[\NCC@runskip]}%
}
\def\NCC@dtocpart#1[#2]#3#4#5{%
  \def\l@part##1##2{%
    \NCC@tocentry{-1}{%
      \setlength\@tempdimb\@tocrmarg
      \edef\@tocrmarg{\the\@tempdimb plus 1fil}%
      \addpenalty{-\@highpenalty}#1%
    }{#3}{#4}{#5}{##1}{\hss##2}%
    \nobreak \vskip #2\relax
    \@nobreaktrue
    \everypar{\@nobreakfalse\everypar{}}%
  }%
}
\@onlypreamble\DeclareTOCPart
\@onlypreamble\NCC@dtocpart
%
% Defaults
%
\ifNCC@small
  \DeclarePart{\StartFromTextArea\vspace{\stretch{.5}}\centering}
              {\vfill\newpage}{\vspace{1.5em}\Large\bff}{\huge\bff}
\else
  \DeclarePart{\StartFromTextArea\vspace{\stretch{.5}}\centering}
              {\vfill\newpage}{\vspace{2em}\LARGE\bff}{\Huge\bff}
\fi
\DeclareTOCPart{\NCC@secskip{4ex \@plus .2ex}\def\@dotsep{1000}}
               {}{\partname\ II}{\large\bff}
\endinput