summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/disser/chapter.dtx
blob: d85b16a6c663024f639aade6040fdf66f9d756b0 (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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
%    \begin{macrocode}

%<*chapter>
%    \end{macrocode}
%
% \subsection{Ãëàâà}
%
% Ïóñòîå îïðåäåëåíèå ìàðêåðà ãëàâû.
%    \begin{macrocode}
\newcommand*\chaptermark[1]{}
%    \end{macrocode}
% Äàëåå èäóò ïàðàìåòðû àíàëîãè÷íûå òåì, ÷òî èñïîëüçîâàëèñü â
% ïðåäûäóùåì ðàçäåëå.
%    \begin{macrocode}
\providecommand\tocprethechapter{\protect\chaptername~}
\providecommand\tocpostthechapter{.\@postskip}
\providecommand\tocchapterfill{\tocfill{.}}

\providecommand\tocchapterfont{\bfseries}
\providecommand\tocchapterfillfont{\normalfont}
\providecommand\tocchapternumfont{\normalfont}

\providecommand\thechapteralign{\centering}
\providecommand\thechapterfont{\Large}
\providecommand\prethechapter{\protect\chaptername~}
\providecommand\postthechapter{\par\nobreak\vskip 5\p@}

\providecommand\chapteralign{\centering}
\providecommand\chapterfont{\Large\bfseries}
\providecommand\prechapter{}
\providecommand\postchapter{\par\nobreak\vskip 20\p@}

%    \end{macrocode}
% Ïàðàìåòðû ôîðìàòà çàãîëîâêà Ïðèëîæåíèÿ.
%    \begin{macrocode}
\providecommand\tocpretheappendix{\protect\appendixname~}
\providecommand\tocposttheappendix{.\@postskip}
\providecommand\tocappendixfill{\tocfill{.}}

\providecommand\tocappendixfont{\bfseries}
\providecommand\tocappendixfillfont{\normalfont}
\providecommand\tocappendixnumfont{\normalfont}

\providecommand\theappendixalign{\centering}
\providecommand\theappendixfont{\Large}
\providecommand\pretheappendix{\protect\appendixname~}
\providecommand\posttheappendix{\par\nobreak\vskip 5\p@}

\providecommand\appendixalign{\centering}
\providecommand\appendixfont{\Large\bfseries}
\providecommand\preappendix{}
\providecommand\postappendix{\par\nobreak\vskip 20\p@}

%    \end{macrocode}
% Èíòåðôåéñ.
%    \begin{macrocode}
\newcommand\chapter{%
  \if@openright
    \cleardoublepage
  \else
    \clearpage
  \fi
  \thispagestyle{plain}%
  \global\@topnum\z@
  \@afterindentfalse
  \secdef\@chapter\@schapter
}

\def\@chapter[#1]#2{
  \ifnum \c@secnumdepth >\m@ne
    \refstepcounter{chapter}%
    {\def\\{ }\addcontentsline{toc}{chapter}{\@tocseccntformat{chapter} #1}}%
  \else
    {\def\\{ }\addcontentsline{toc}{chapter}{#1}}%
  \fi
  \chaptermark{#1}%
%    \end{macrocode}
% Äîáàâëåíèå âåðòèêàëüíûõ ðàçäåëèòåëåé â ñïèñêè ðèñóíêîâ è òàáëèö.
%    \begin{macrocode}
  \addtocontents{lof}{\protect\addvspace{10\p@}}%
  \addtocontents{lot}{\protect\addvspace{10\p@}}%
  \if@twocolumn
    \@topnewpage[\@makechapterhead{#2}]%
  \else
    \@makechapterhead{#2}%
    \@afterheading
  \fi
}
%    \end{macrocode}
% Ôîðìàò íà ñòðàíèöå.
%    \begin{macrocode}
\def\@makechapterhead#1{%
  {%
%    \end{macrocode}
% Óñòàíîâêà íóëåâîãî àáçàöíîãî îòñòóïà.
%    \begin{macrocode}
    \parindent \z@ \raggedright \normalfont
%    \end{macrocode}
% Ïîñòîÿííàÿ ÷àñòü çàãîëîâêà.
%    \begin{macrocode}
      \ifnum \c@secnumdepth >\m@ne
        {\thechapterfont\thechapteralign\@seccntformat{chapter}}
      \fi
      \interlinepenalty\@M
      \chapterfont\chapteralign\prechapter #1\postchapter
  }
}

\def\@schapter#1{
  \if@twocolumn
    \@topnewpage[\@makeschapterhead{#1}]%
  \else
    \@makeschapterhead{#1}%
    \@afterheading
  \fi
}

\def\@makeschapterhead#1{%
  {%
    \parindent \z@ \raggedright
    \normalfont\interlinepenalty\@M
    \chapteralign{\chapterfont\prechapter #1\postchapter}
  }
}
%    \end{macrocode}
% Êîìàíäà, ñîçäàþùàÿ çàïèñü â Ñîäåðæàíèè.
%    \begin{macrocode}
\newcommand*\l@chapter[2]{%
  \ifnum \c@tocdepth >\m@ne
    \addpenalty{-\@highpenalty}
    \vskip 1.0em \@plus\p@
    \setlength\@tempdima{1.5em}
    \begingroup
      \parindent \z@ \rightskip \@pnumwidth
      \parfillskip -\@pnumwidth
      \leavevmode
      \tocchapterfont
      \advance\leftskip\@tempdima
      \hskip -\leftskip
      #1\nobreak
      \tocchapterfillfont\tocchapterfill\hfill
      \nobreak\hb@xt@\@pnumwidth{\hss\tocchapternumfont #2}\par
      \penalty\@highpenalty
    \endgroup
  \fi
}

%    \end{macrocode}
% Êîìàíäà äëÿ ñîçäàíèÿ ãëàâ Ïðèëîæåíèÿ.
%    \begin{macrocode}
\newcommand\appendix{
  \setcounter{chapter}{0}
  \setcounter{section}{0}

%    \end{macrocode}
% Ñîõðàíåíèå ñòàðûõ çíà÷åíèé.
%    \begin{macrocode}
  \let\oldtocprethechapter=\tocprethechapter
  \let\oldtocpostthechapter=\tocpostthechapter
  \let\oldtocchapterfill=\tocchapterfill

  \let\oldtocchapterfont=\tocchapterfont
  \let\oldtocchapterfillfont=\tocchapterfillfont
  \let\oldtocchapternumfont=\tocchapternumfont

  \let\oldthechapteralign=\thechapteralign
  \let\oldthechapterfont=\thechapterfont
  \let\oldprethechapter=\prethechapter
  \let\oldpostthechapter=\postthechapter

  \let\oldchapteralign=\chapteralign
  \let\oldchapterfont=\chapterfont
  \let\oldprechapter=\prechapter
  \let\oldpostchapter=\postchapter
  \let\oldthechapter=\thechapter

%    \end{macrocode}
% Ïåðåçàïèñü ïàðàìåòðîâ ôîðìàòà ãëàâû äëÿ îôîðìëåíèÿ ïðèëîæåíèé.
%    \begin{macrocode}
  \renewcommand\tocprethechapter{\tocpretheappendix}
  \renewcommand\tocpostthechapter{\tocposttheappendix}
  \renewcommand\tocchapterfill{\tocappendixfill}

  \renewcommand\tocchapterfont{\tocappendixfont}
  \renewcommand\tocchapterfillfont{\tocappendixfillfont}
  \renewcommand\tocchapternumfont{\tocappendixnumfont}

  \renewcommand\thechapteralign{\theappendixalign}
  \renewcommand\thechapterfont{\theappendixfont}
  \renewcommand\prethechapter{\pretheappendix}
  \renewcommand\postthechapter{\posttheappendix}

  \renewcommand\chapteralign{\appendixalign}
  \renewcommand\chapterfont{\appendixfont}
  \renewcommand\prechapter{\preappendix}
  \renewcommand\postchapter{\postappendix}

  \gdef\thechapter{\theappendix}
}

\newcommand\noappendix{
  \let\tocprethechapter=\oldtocprethechapter
  \let\tocpostthechapter=\oldtocpostthechapter
  \let\tocchapterfill=\oldtocchapterfill

  \let\tocchapterfont=\oldtocchapterfont
  \let\tocchapterfillfont=\oldtocchapterfillfont
  \let\tocchapternumfont=\oldtocchapternumfont

  \let\thechapteralign=\oldthechapteralign
  \let\thechapterfont=\oldthechapterfont
  \let\prethechapter=\oldprethechapter
  \let\postthechapter=\oldpostthechapter

  \let\chapteralign=\oldchapteralign
  \let\chapterfont=\oldchapterfont
  \let\prechapter=\oldprechapter
  \let\postchapter=\oldpostchapter

  \gdef\thechapter{\oldthechapter}
}

%    \end{macrocode}
% Êîìàíäà äëÿ ñîçäàíèÿ íåíóìåðóåìûõ ãëàâ, êîòîðûå áóäóò âêëþ÷åíû â
% Ñîäåðæàíèå è PDF-çàêëàäêè. Äëÿ òîãî, ÷òîáû çàêëàäêà óêàçûâàëà èìåííî íà
% çàãîëîâîê, à íå íà ïåðâûé àáçàö ïîä íèì, íóæíî ïîìåñòèòü |\phantomchapter| % è |\addcontentsline| âíóòðè àðãóìåíòà |\chapter*|. ×åñòíî ãîâîðÿ, ìíå ýòî
% íå íðàâèòñÿ. Íàäî ïðèäóìàòü ÷òî-òî áîëåå ïðîñòîå è èçÿùíîå.
%    \begin{macrocode}
\newcommand\nchapter[1]{%
  \chapter*{%
    \phantomchapter\addcontentsline{toc}{chapter}{#1}%
    #1%
    \@mkboth{\MakeUppercase{#1}}{\MakeUppercase{#1}}
  }
}
%</chapter>
%    \end{macrocode}