*** empty log message ***
[m17n/m17n-docs.git] / styles / minitoc-hyper.sty
1 \def\fileversion{v28href}
2 \def\filedate{1999/05/17}
3 % minitoc-hyper.sty
4 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5 % Jean-Pierre Drucbert
6 % ONERA/CERT/GPI
7 % Office National d'\'Etudes et de Recherches A\'erospatiales
8 % Centre d'\'Etudes et de Recherches de Toulouse
9 % Groupe de Prestations Informatiques
10 % Complexe Scientifique de Rangueil
11 % 2, Avenue \'Edouard Belin
12 % BP 4025
13 % F-31055 TOULOUSE CEDEX
14 % FRANCE
15 %
16 % Phone +33-62-25-25-15
17 %
18 % Email: drucbert@onecert.fr
19 %
20 % Please send me any (constructive) suggestions and comments.
21 %
22 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
23 % Temporarily patched by Bernd Jaehne [Bernd.Jaehne@aeon.de] 
24 % and Didier Verna [verna@inf.enst.fr] to
25 % work with hyperref.sty from s.rahtz@elsevier.co.uk
26 % using input from Tony Roberts [aroberts@usq.edu.au]
27 % For changes see comments %%BJ and %DV
28 %
29 % However: this patch works only when  hyperref.sty is used,
30 % otherwise errors occur. Thus it may be advisable to add code
31 % so that minitoc runs both in standard and hyperref mode.
32 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
33
34 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
35 % History (contains some obsolete things... it is NOT
36 % the REAL documentation)
37 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
38 % minitoc.sty --- redefines the \chapter command to display a
39 %  mini-table-of-contents at the beginning of every chapter.
40 %  Oct-90       Original version, by Nigel Ward.
41 %  Nov-91       Revised to reuse \chapter, \section, \subsection commands
42 %               transparently, generate toc-file-name automatically,
43 %               assorted other cleanup.  Dan Jurafsky
44 %  Jun/Jul-93   New design, to avoid allocating a newwrite
45 %               for each chapter (!)
46 %               Added \chapterend to terminate the scope of a minitoc.
47 %               (IF YOU FORGOT PUTTING \chapterend at the end
48 %               of EACH chapter, an entry for the next chapter
49 %               will appear in each minitoc.) (Thanks to Yufan Hu).
50 %               Replaced ``minipage'' environnement by a ``verse''
51 %               environnement, to allow a minitoc split across pages.
52 %               All the layout of the minitoc is in the
53 %               \minitableofcontents command, so if someboby wants
54 %               to redefine that layout, he has just to
55 %               rewrite it (and only it).
56 %
57 %               You can inhibit the minitoc for the next chapter
58 %               by preceding it with \minitocno. (\minitocyes
59 %               is useless for the user: it is implicit AFTER
60 %               the \chapter* pseudo-chapters).
61 %
62 %               Problems: you MUST have \chapterend to terminate each
63 %               chapter with a minitoc.
64 %               How about avoiding this constraint?
65 %
66 %               The depth of the minitoc is user-adjustable with
67 %               the counter `minitocdepth' (as `tocdepth' for the table
68 %               of contents).
69 %               At least three passes (3!!!) of LaTeX are necessary to get
70 %               correct minitoc's (the first pass creates the .mtcX files,
71 %               the second uses them (but they may contain wrong page
72 %               numbers) and recreates them, the third should be ok).
73 %
74 %               Works with \chapter[xxx]{yyy} and floating bodies.
75 %               Works with two columns (but the minitoc is in composed in
76 %               one column; how to make it to spread over the two column?)
77 %               Some mods added to work with xr.sty (external references).
78 %               xr.sty version 5 is much more tolerant.
79 %   05Jul93     Version 2
80 %               Added compatibility with hangcaption.sty (the option
81 %               hangcaption (if present) must be given BEFORE minitoc
82 %               option.)
83 %               BEWARE to options modifying \@caption
84 %               Version 3 not released (buggy)
85 %   09Jul93     Version 4
86 %               Added \if@realch to avoid contentslines from
87 %               pseudo-chapters to go into the toc!
88 %               The option file mtcoff.sty allows to use a latex
89 %               document with minitoc commands and to make them
90 %               transparent: just replace the minitoc option by
91 %               mtcoff.
92 %   13Jul93     Version 5
93 %               Added a selection mechanism to not write spurious things
94 %               in the minitoc's.
95 %   15Jul93     Version 6
96 %               Fixed problems about chapters in the toc,
97 %               removed obsolete \caption stuff (filters are better)
98 %               added compatibility with toch.sty
99 %               (toch.sty makes a table of chapters. If used,
100 %               must be loaded BEFORE minitoc.sty)
101 %   22Jul93     Version 7 (MAJOR DIFFERENCES)
102 %               Completely rewritten, using tricks from xr.sty
103 %               (the version 5, by David Carlisle). The info
104 %               for minitocs is directly stolen from the .toc
105 %               file.
106 %               \chapterend and \minitocno are suppressed
107 %               \minitoc, \dominitoc and \faketableofcontents added
108 %   29Jul93     Version 8
109 %               Spacing adjustements.
110 %   04Aug93     Version 9
111 %               Added mods for MS-DOS (search MS-DOS, uncomment;
112 %               search UNIX, comment out). MS-DOS allows only
113 %               3 characters for extensions in file names (what a pity!).
114 %   05Aug93     Version 10
115 %               Works with appendices.
116 %               Detects obsolete versions of latex.tex.
117 %               (\@inputcheck or \reset@font not defined).
118 %   18Aug93     Version 11
119 %               Added \mtcSfont, font for section entries,
120 %               \mtcSSfont for subsection entries,
121 %               \mtcSSSfont for subsubsection entries,
122 %               \mtcPfont for paragraph entries,
123 %               \mtcSPfont for subparagraph entries.
124 %
125 %   16Dec93     Version 12
126 %               Use \kern's in place of \vspace*'s,
127 %               and added penalties (\nopagebreak) to
128 %               avoid a page break just before last \mtc@rule.
129 %               Also added a \samepage environnement.
130 %               Removed old commented out lines from
131 %               previous versions.
132 %
133 %   17Dec93     Version 13
134 %               Added minilof and minilot stuff.
135 %               For MS-DOS, uncomment the definition of \SHORTEXT.
136 %
137 %   03Jan94     Version 14
138 %               Corrected space under minitoc/lof/lot and added a
139 %               \raggedright to avoid ``underfull'' warnings.
140 %               Corrected some spacing problems (avoiding ~'s).
141 %               \mtifont changed from \normalsize\bf to
142 %               \large\bf.
143 %               Some mods suggested by Donald Arseneau (thanks):
144 %               \@newread becomes \newread, not outer
145 %               version of \newread.
146 %               \empty replaced by \relax in the spare definition
147 %               of \reset@font.
148 %               Removed \clubpenalty=10000 and \widowpenalty=10000
149 %               (done by \samepage), and \noindent.
150 %               Simplified processing of optional argument in
151 %               \minitoc, \minilof and \minilot.
152 %
153 %   27Jan94     Version 15
154 %               Added parttoc, partlof and partlot for books,
155 %               with commands and parameters parallel to
156 %               those for mini-things.
157 %
158 %               Added secttoc, sectlof and sectlot for articles,
159 %               with commands and parameters parallel to
160 %               those for mini-things.
161 %
162 %   02Feb94     Version 16
163 %               Bug fixes (typos).
164 %
165 %   23Jun94     Version 17
166 %               Keyword 'n' (null) synonym of 'e' (empty).
167 %               Compatibility with LaTeX ``2e''.
168 %               Thanks to Denis Roegel (who found
169 %               the problem) and Frank Mittelbach
170 %               (who gave the hints to solve).
171 %
172 %   26Jun94     Version 18
173 %               Make minitoc really compatible with latex2e
174 %               Introduce the language files as options
175 %               Thanks to Michel Goossens (via Frank Mittelbach)
176 %               who was inspired by the code of babel (Johannes Braams).
177 %
178 %   16Aug94     Version 19
179 %               Added stuff for numbering of chapters (parts,
180 %               sections) not starting at 1.
181 %               \firstchapteris etc. commands added.
182 %               \mtcrule, \nomtcrule etc. commands added.
183 %               Corrected a bug in \c@mti.
184 %               Corrected mtcswedish.sty (Jan Michel Rynning)
185 %               Corrected appendix in articles
186 %
187 %   25Aug94     Version 20
188 %               Corrected spacing before and after minitocs
189 %               and siblings.
190 %               Added \mtcpagenumbers and \nomtcpagenumbers
191 %               (and siblings) to make minitocs with/without
192 %               page numbers. Default: page numbers.
193 %               Corrected (difficult bug) appendix in articles.
194 %               Corrected vertical spacing.
195 %               Corrected a problem with chapters numbered
196 %               with (uppercase) roman numbers.
197 %
198 %   07Sep94     Version 21
199 %               Corrected typos in minitoc.sty and minitoc.tex.
200 %
201 %   10Oct94     Version 22
202 %               Corrected typos in minitoc.sty.
203 %
204 %   08Nov94     Version 23
205 %               Added a missing line in \sectlof@.
206 %               Works with document classes resetting
207 %               chapter (or section) number at each part.
208 %               (Thanks to Denis Roegel)
209 %               Removed stuff for \firstchapteris and co.
210 %               These commands are obsolete.
211 %               Removed appendix stuff.
212 %
213 %   21Dec94     Version 24
214 %               The \protect commands have been removed from
215 %               the .toc, .lot and .lot files, so some internal
216 %               macros have been corrected to be compatible
217 %               with the LaTeX2e release of December 1994.
218 %               Thanks to Denis Roegel who did the work.
219 %
220 %   13Sep96     Version 25
221 %               Updated mtcnorsk.sty and added mtcnynorsk.sty
222 %               on a suggestion from Dag Langmyhr (dag@ifi.uio.no).
223 %
224 %   14Nov96     Version 26
225 %               Language specific commands are now names <language>.mld
226 %               (in place of mtc<language>.sty) because there are not
227 %               packages and it makes shorter names.
228 %               Added breton, estonian, germanb, greek, irish,
229 %               russianb, scottish, lower and upper sorbian;
230 %               renamed esperanto into esperant like in Babel.
231 %
232 %   20Dec96     Version 27
233 %               Corrections for starred sectionning commands.
234 %               english.mld loaded as default language.
235 %               Added vietnam.mld.
236 %               Added arab.mld.
237 %               Renamed minitocoff.sty into mtcoff.sty to
238 %               keep the name short.
239 %
240 %
241 %               Jean-Pierre Drucbert
242 %
243 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
244 \NeedsTeXFormat{LaTeX2e}[1994/12/01]%
245 %%% This file will not work with latex2.09
246 \ProvidesPackage{minitoc}[\filedate\space\fileversion\space
247                         The minitoc package]
248 \typeout{*** minitoc package, version 27p ***}%
249 \@ifundefined{part}%
250 {}%
251 {\typeout{*** part level macros available ***}
252 \let\mtc@svpart\part %23
253 \def\part{\stepcounter{ptc}\mtc@svpart}} %23
254 \@ifundefined{chapter}%
255 {%
256 \@ifundefined{section}%
257 {\typeout{*** no section or chapter level macros available ***}%
258 \typeout{*** PLEASE VERIFY YOUR MAIN DOCUMENT CLASS ***}}%
259 {\typeout{*** section level macros available ***}
260 \let\mtc@svsection\section %23
261 \def\section{\stepcounter{stc}\mtc@svsection} %23
262 \let\mtc@svss\@ssect %23
263 %v25 \def\@ssect{\addtocounter{stc}{-1}\mtc@svss} %23
264 }%
265 }%
266 {\typeout{*** chapter level macros available ***}
267 \let\mtc@svchapter\@chapter %23
268 \def\@chapter{\stepcounter{mtc}\mtc@svchapter} %23
269 }
270 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
271 %
272 %         *****  ****   ***  *****
273 %         *      *   *   *     *
274 %         ***    *   *   *     *
275 %         *      *   *   *     *
276 %         *****  ****   ***    *
277 %
278 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
279 %\def\SHORTEXT{SHORTEXT}    %%% UNCOMMENT FOR DOS AND
280                             %%% SYSTEMS WITH SHORT EXTENSIONS
281                             %%% TO FILE NAMES
282                             %%% LEAVE IT COMMENTED OUT
283                             %%% FOR UNIX AND O.S. WITH
284                             %%% LONG EXTENSIONS
285                             %%% YOU CAN VERIFY BY LATEXING
286                             %%% AN EXAMPLE DOCUMENT
287                             %%% ONE OF THE FOLLOWING MESSAGES APPEARS
288                             %%% PLEASE CORRECT IF THE MESSAGE IS WRONG
289 % v27 : claim the type of system!
290 \@ifundefined{SHORTEXT}%
291 {\typeout{==> this version is configured for UNIX-like (long extensions) file names.}}%
292 {\typeout{==> this version is configured for MSDOS-like (8+3) file names.}}
293 %
294 %not outer version of \newread
295 \def\newread{\alloc@6\read\chardef\sixt@@n}
296 \@ifundefined{@inputcheck}%
297   {\typeout{Your version of latex.tex is obsolete.}%
298   \typeout{Trying to continue...}\newread\@inputcheck\relax}{}
299 \@ifundefined{reset@font}%
300   {\typeout{Your version of latex.tex is very obsolete.}%
301   \typeout{Trying to continue...}\let\reset@font\relax}{}
302 \newwrite\tf@mtc  % a file descriptor to write minitocs
303 \newtoks\mtc@toks
304 \def\mtc@string{\relax}
305 \newbox\mtc@strutbox
306 \setbox\mtc@strutbox=\hbox{\vrule height2.5ex
307       depth1.8ex width\z@}
308 \def\mtc@strut{\relax\ifmmode\copy\mtc@strutbox\else\unhcopy\mtc@strutbox\fi}
309 \def\mtc@v{\leavevmode%
310      \mtc@strut\vphantom{Lp$^{l^l}_{p_p}$}}  % a pseudo-strut ?
311 % \@BBR discourages page breaks
312 \def\@BBR{\unpenalty\nopagebreak[4]}
313 % Modified version to ignore the dots and the page number.              % 17b
314 \def\@undottedtocline#1#2#3#4#5{\ifnum #1>\c@tocdepth \else             % 17b
315   \vskip \z@ plus.2\p@                                                  % 17b
316   {\leftskip #2\relax \rightskip \@tocrmarg \parfillskip -\rightskip    % 17b
317     \parindent #2\relax\@afterindenttrue                                % 17b
318    \interlinepenalty\@M                                                 % 17b
319    \leavevmode                                                          % 17b
320    \@tempdima #3\relax \advance\leftskip \@tempdima \hbox{}%            % 17b
321    \hskip -\leftskip                                                    % 17b
322     #4\nobreak\hfill \nobreak                                           % 17b
323            \null\par}\fi}                                               % 17b
324 %%
325 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%17b
326 \def\mtcpagenumbers{\let\mtc@pgno\null}         %17b
327 \mtcpagenumbers %default                        %17b
328 \def\nomtcpagenumbers{\let\mtc@pgno\relax}      %17b
329 \def\stcpagenumbers{\let\stc@pgno\null}         %17b
330 \stcpagenumbers %default                        %17b
331 \def\nostcpagenumbers{\let\stc@pgno\relax}      %17b
332 \def\ptcpagenumbers{\let\ptc@pgno\null}         %17b
333 \ptcpagenumbers %default                        %17b
334 \def\noptcpagenumbers{\let\ptc@pgno\relax}      %17b
335 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%17b
336 \def\mlfpagenumbers{\let\mlf@pgno\null}         %17b
337 \mlfpagenumbers %default                        %17b
338 \def\nomlfpagenumbers{\let\mlf@pgno\relax}      %17b
339 \def\slfpagenumbers{\let\slf@pgno\null}         %17b
340 \slfpagenumbers %default                        %17b
341 \def\noslfpagenumbers{\let\slf@pgno\relax}      %17b
342 \def\plfpagenumbers{\let\plf@pgno\null}         %17b
343 \plfpagenumbers %default                        %17b
344 \def\noplfpagenumbers{\let\plf@pgno\relax}      %17b
345 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%17b
346 \def\mltpagenumbers{\let\mlt@pgno\null}         %17b
347 \mltpagenumbers %default                        %17b
348 \def\nomltpagenumbers{\let\mlt@pgno\relax}      %17b
349 \def\sltpagenumbers{\let\slt@pgno\null}         %17b
350 \sltpagenumbers %default                        %17b
351 \def\nosltpagenumbers{\let\slt@pgno\relax}      %17b
352 \def\pltpagenumbers{\let\plt@pgno\null}         %17b
353 \pltpagenumbers %default                        %17b
354 \def\nopltpagenumbers{\let\plt@pgno\relax}      %17b
355 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%17b
356 % if you don't want a table of contents, but want minitocs,
357 % you need to create the .toc file, without inputing it
358 % into your document. This command is a stripped off version
359 % of \tableofcontents
360 \def\faketableofcontents{\fake@starttoc{toc}}
361 % idem for list of figures
362 \def\fakelistoffigures{\fake@starttoc{lof}}
363 % idem for list of tables
364 \def\fakelistoftables{\fake@starttoc{lot}}
365 \def\fake@starttoc#1{\begingroup
366   \makeatletter
367   \if@filesw \expandafter\newwrite\csname tf@#1\endcsname
368              \immediate\openout \csname tf@#1\endcsname \jobname.#1\relax
369   \fi \global\@nobreakfalse \endgroup}
370 %%
371 \global\let\mtc@markboth\markboth
372 \global\let\@mkboth\markboth
373 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
374 \@ifundefined{chapter}{}{%
375 \def\The@chapter{\arabic{mtc}} %23
376 \def\firstchapteris#1%
377   {\typeout{^^JWARNING*** \string\firstchapteris}%
378    \typeout{ is an obsolete command^^J}}
379 \newcounter{mtc}  % counter of minitocs
380 \setcounter{mtc}{0}
381 \gdef\themtc{\arabic{mtc}}
382 \newcounter{minitocdepth} % analog to tocdepth, but for minitocs
383 \setcounter{minitocdepth}{2} % default value
384 \def\mtc@rule{\kern-3\p@%
385   \hrule width \columnwidth \kern2.6\p@} % the \hrule is .4pt high
386
387 \newlength\mtcindent % indentation (left/right) of minitocs
388 \mtcindent=24pt      % defaut value
389 \def\mtcfont{\small\rm}    % font for the minitoc
390 \def\mtcSfont{\small\bf}   % font for the minitoc (sections)
391 \def\mtcSSfont{\mtcfont}   % font for the minitoc (subsections)
392 \def\mtcSSSfont{\mtcfont}  % font for the minitoc (subsubsections)
393 \def\mtcPfont{\mtcfont}    % font for the minitoc (paragraphs)
394 \def\mtcSPfont{\mtcfont}   % font for the minitoc (subparagraphs)
395 \def\mlffont{\mtcfont}     % font for the minilof (figures)
396 \def\mltfont{\mtcfont}     % font for the minilot (tables)
397 \def\mtifont{\large\bf}    % font for titles
398
399 % Centering, flushleft, flushright or empty titles.
400 \def\c@mti#1{\null\hfill #1\hfill\null}
401 \def\l@mti#1{\null #1\hfill\null}
402 \def\r@mti#1{\null\hfill #1\null}
403 \def\e@mti#1{\relax}
404 \def\n@mti#1{\relax}
405
406 % Default: titles on left
407 \let\do@mtitc\l@mti
408 \let\df@mtitc\l@mti
409 \let\do@mtilf\l@mti
410 \let\df@mtilf\l@mti
411 \let\do@mtilt\l@mti
412 \let\df@mtilt\l@mti
413
414 %v27 Language dependent names: default values. Now
415 %v27 english.mld is loaded first.
416 %v27 \@ifundefined{mtctitle}{\def\mtctitle{Contents}}{\relax}
417 %v27 \@ifundefined{mlftitle}{\def\mlftitle{Figures}}{\relax}
418 %v27 \@ifundefined{mlttitle}{\def\mlttitle{Tables}}{\relax}
419
420 \def\mtc@verse{\let\\=\@centercr
421   \list{}{\itemsep\z@\itemindent \z@\listparindent \itemindent
422           \leftmargin\mtcindent
423           \rightmargin\leftmargin}\item[]}
424 \def\endmtc@verse{\nopagebreak[4]\endlist}
425
426 % this command must be used after \chapter
427 % if you need a minitoc (no automatic minitoc)
428 \def\minitoc{\@ifnextchar[{\minitoc@}{\minitoc@[d]}}
429
430 \def\minitoc@[#1]{%
431         \relax\begin{samepage}% we begin a local group here, using samepage
432         \if #1e\let\do@mtitc\e@mti
433         \else\if #1n\let\do@mtitc\n@mti
434         \else\if #1c\let\do@mtitc\c@mti
435         \else\if #1l\let\do@mtitc\l@mti
436         \else\if #1r\let\do@mtitc\r@mti
437         \else\if #1d\let\do@mtitc\df@mtitc
438         \fi\fi\fi\fi\fi\fi
439         \raggedright % added #14
440         \parskip=\z@%
441         \reset@font\mtcfont%
442         \parindent=\z@%
443         \nopagebreak[4]%
444         \kern-0.8\baselineskip\nopagebreak[4]%
445         \par\noindent %%
446         \ifx\mtc@rule\relax
447         \begin{tabular}{@{}p{\columnwidth}@{}}
448         {\reset@font\mtifont\do@mtitc{\mtc@v\mtctitle}}\\
449         \end{tabular}\else
450         \begin{tabular}{@{}p{\columnwidth}@{}}
451         {\reset@font\mtifont\do@mtitc{\mtc@v\mtctitle}}\\\hline
452         \end{tabular}\fi
453         \nopagebreak[4]\null\leavevmode\vrule width \z@
454         height \z@ depth \z@\\\@BBR%
455         \leftmargin\mtcindent
456         \rightmargin\mtcindent
457         \itemindent=\z@\labelwidth=\z@%
458         \labelsep=\z@\listparindent=\z@%
459         \begin{mtc@verse}\c@tocdepth=\c@minitocdepth%
460         \leavevmode\\\@BBR% this blank line is necessary to avoid
461                 % a wild negative indentation
462         \vskip -.5\baselineskip
463 \begingroup
464   \makeatletter
465   \@ifundefined{mtc@pgno}%
466   {\let\@dottedtocline\@undottedtocline}{}
467 \@ifundefined{SHORTEXT}%
468 {\def\@tocfile{mtc\The@chapter}}%  % UNIX
469 {\def\@tocfile{M\The@chapter}}%    % MS-DOS
470   \@input{\jobname.\@tocfile}\if@filesw
471   \fi%
472   \global\@nobreakfalse\endgroup
473         \end{mtc@verse}%
474         \kern0.\baselineskip%
475         \nopagebreak[4]\mtc@rule\null\leavevmode\\%
476         \vskip-1.0\baselineskip
477         \vrule width \z@ height \z@
478         depth \z@\end{samepage}% %## the \\ is essential
479         \par\pagebreak[1]\vspace*{-1ex}}%
480         % some space under the minitoc
481
482 % Added in version #13
483 % this command must be used after \chapter
484 % if you need a minilof (no automatic minilof)
485 \def\minilof{\@ifnextchar[{\minilof@}{\minilof@[d]}}
486
487 \def\minilof@[#1]{%
488         \relax\begin{samepage}% we begin a local group here, using samepage
489         \if #1e\let\do@mtilf\e@mti
490         \else\if #1n\let\do@mtilf\n@mti
491         \else\if #1c\let\do@mtilf\c@mti
492         \else\if #1l\let\do@mtilf\l@mti
493         \else\if #1r\let\do@mtilf\r@mti
494         \else\if #1d\let\do@mtilf\df@mtilf
495         \fi\fi\fi\fi\fi\fi
496         \raggedright % added #14
497         \parskip=\z@%
498         \reset@font\mlffont%
499         \parindent=\z@%
500         \nopagebreak[4]%
501         \kern-0.8\baselineskip\nopagebreak[4]%
502         \par\noindent
503         \ifx\mtc@rule\relax
504         \begin{tabular}{@{}p{\columnwidth}@{}}
505         {\reset@font\mtifont\do@mtilf{\mtc@v\mlftitle}}\\
506         \end{tabular}\else
507         \begin{tabular}{@{}p{\columnwidth}@{}}
508         {\reset@font\mtifont\do@mtilf{\mtc@v\mlftitle}}\\\hline
509         \end{tabular}\fi
510         \nopagebreak[4]\null\leavevmode\vrule width \z@
511         height \z@ depth \z@\\\@BBR%
512         \leftmargin\mtcindent
513         \rightmargin\mtcindent
514         \itemindent=\z@\labelwidth=\z@%
515         \labelsep=\z@\listparindent=\z@%
516         % depth does not matter for minilof
517         \begin{mtc@verse}%\c@tocdepth=\c@minitocdepth%
518         \leavevmode\\\@BBR% this blank line is necessary to avoid
519                 % a wild negative indentation
520         \vskip -.5\baselineskip
521 \begingroup
522   \makeatletter
523   \@ifundefined{mlf@pgno}%
524   {\let@dottedtocline\@undottedtocline}{}
525 \@ifundefined{SHORTEXT}%
526 {\def\@tocfile{mlf\The@chapter}}%  % UNIX
527 {\def\@tocfile{F\The@chapter}}%    % MS-DOS
528   \@input{\jobname.\@tocfile}\if@filesw
529   \fi%
530   \global\@nobreakfalse\endgroup
531         \end{mtc@verse}%
532         \kern0.\baselineskip%
533         \nopagebreak[4]\mtc@rule\null\leavevmode\\%
534         \vskip-1.0\baselineskip
535         \vrule width \z@ height \z@
536         depth \z@\end{samepage}% %## the \\ is essential
537         \par\pagebreak[1]\vspace*{-1ex}}%
538         % some space under the minilof
539
540 % Added in version #13
541 % this command must be used after \chapter
542 % if you need a minilot (no automatic minilot)
543 \def\minilot{\@ifnextchar[{\minilot@}{\minilot@[d]}}
544
545 \def\minilot@[#1]{%
546         \relax\begin{samepage}% we begin a local group here, using samepage
547         \if #1e\let\do@mtilt\e@mti
548         \else\if #1n\let\do@mtilt\n@mti
549         \else\if #1c\let\do@mtilt\c@mti
550         \else\if #1l\let\do@mtilt\l@mti
551         \else\if #1r\let\do@mtilt\r@mti
552         \else\if #1d\let\do@mtilt\df@mtilt
553         \fi\fi\fi\fi\fi\fi
554         \raggedright % added #14
555         \parskip=\z@%
556         \reset@font\mltfont%
557         \parindent=\z@%
558         \nopagebreak[4]%
559         \kern-0.8\baselineskip\nopagebreak[4]%
560         \par\noindent
561         \ifx\mtc@rule\relax
562         \begin{tabular}{@{}p{\columnwidth}@{}}
563         {\reset@font\mtifont\do@mtilt{\mtc@v\mlttitle}}\\
564         \end{tabular}\else
565         \begin{tabular}{@{}p{\columnwidth}@{}}
566         {\reset@font\mtifont\do@mtilt{\mtc@v\mlttitle}}\\\hline
567         \end{tabular}\fi
568         \nopagebreak[4]\null\leavevmode\vrule width \z@
569         height \z@ depth \z@\\\@BBR%
570         \leftmargin\mtcindent
571         \rightmargin\mtcindent
572         \itemindent=\z@\labelwidth=\z@%
573         \labelsep=\z@\listparindent=\z@%
574         % depth does not matter for minilot
575         \begin{mtc@verse}%\c@tocdepth=\c@minitocdepth%
576         \leavevmode\\\@BBR% this blank line is necessary to avoid
577                 % a wild negative indentation
578         \vskip -.5\baselineskip
579 \begingroup
580   \makeatletter
581   \@ifundefined{mlt@pgno}%
582   {\let\@dottedtocline\@undottedtocline}{}
583 \@ifundefined{SHORTEXT}%
584 {\def\@tocfile{mlt\The@chapter}}%  % UNIX
585 {\def\@tocfile{T\The@chapter}}%    % MS-DOS
586   \@input{\jobname.\@tocfile}\if@filesw
587   \fi%
588   \global\@nobreakfalse\endgroup
589         \end{mtc@verse}%
590         \kern0.\baselineskip%
591         \nopagebreak[4]\mtc@rule\null\leavevmode\\%
592         \vskip-1.0\baselineskip
593         \vrule width \z@ height \z@
594         depth \z@\end{samepage}% %## the \\ is essential
595         \par\pagebreak[1]\vspace*{-1ex}}%
596         % some space under the minilot
597
598 % I use a depth of 10000 to inhibit the printing of
599 % that contentsline.
600 \def\l@xchapter{\@dottedtocline{\@M}{1em}{2.3em}}
601 \def\xchapter{xchapter}
602
603 \let\sv@chapter\@chapter
604 \def\@chapter[#1]#2{\sv@chapter[{#1}]{#2}\relax%
605 \addcontentsline{lof}{xchapter}{#1}%
606 \addcontentsline{lot}{xchapter}{#1}%
607 }
608
609 % tricky code to deal with \chapter*
610 \let\mtc@schapter\@schapter
611 \def\@schapter{%
612 \addtocontents{toc}{\protect\chapterend}\mtc@schapter%
613 }
614 \def\@schapter{%
615 \addtocontents{toc}{\protect\chapterbegin}\mtc@schapter%
616 }
617 \let\chapterend\relax
618 \let\chapterbegin\relax
619
620 \let\appendixmtc\relax
621
622 % this command extracts info from the .toc file
623 % and create the .mtcN files (.mtc -> .M on MS-DOS)
624 \def\@dominitoc#1{{%
625   \makeatletter
626   \setcounter{mtc}{0} % START VALUE
627   \MTC@next#1.toc\relax\\}\setcounter{mtc}{0}} %23: raz
628 % this command extracts info from the .lof file
629 % and create the .mlfN files (.mlf -> .F on MS-DOS)
630 \def\@dominilof#1{{%
631   \makeatletter
632   \setcounter{mtc}{0} % START VALUE
633   \MLF@next#1.lof\relax\\}\setcounter{mtc}{0}} %23: raz
634 % this command extracts info from the .lot file
635 % and create the .mltN files (.mlt -> .T on MS-DOS)
636 \def\@dominilot#1{{%
637   \makeatletter
638   \setcounter{mtc}{0} % START VALUE
639   \MLT@next#1.lot\relax\\}\setcounter{mtc}{0}} %23: raz
640
641 \def\dominitoc{\@ifnextchar[{\dominitoc@}{\dominitoc@[l]}}
642 \def\dominilof{\@ifnextchar[{\dominilof@}{\dominilof@[l]}}
643 \def\dominilot{\@ifnextchar[{\dominilot@}{\dominilot@[l]}}
644
645 \def\dominitoc@[#1]{%
646 \if #1e\let\df@mtitc\e@mti%
647 \else\if #1n\let\df@mtitc\n@mti%
648 \else\if #1c\let\df@mtitc\c@mti%
649 \else\if #1l\let\df@mtitc\l@mti%
650 \else\if #1r\let\df@mtitc\r@mti%
651 \fi\fi\fi\fi\fi%
652 \@@dominitoc}
653
654 \def\dominilof@[#1]{%
655 \if #1e\let\df@mtilf\e@mti%
656 \else\if #1n\let\df@mtilf\n@mti%
657 \else\if #1c\let\df@mtilf\c@mti%
658 \else\if #1l\let\df@mtilf\l@mti%
659 \else\if #1r\let\df@mtilf\r@mti%
660 \fi\fi\fi\fi\fi%
661 \@@dominilof}
662
663 \def\dominilot@[#1]{%
664 \if #1e\let\df@mtilt\e@mti%
665 \else\if #1n\let\df@mtilt\n@mti%
666 \else\if #1c\let\df@mtilt\c@mti%
667 \else\if #1l\let\df@mtilt\l@mti%
668 \else\if #1r\let\df@mtilt\r@mti%
669 \fi\fi\fi\fi\fi%
670 \@@dominilot}
671
672 \def\@@dominitoc{\@dominitoc{\jobname}\immediate\closeout\tf@mtc}
673 \def\@@dominilof{\@dominilof{\jobname}\immediate\closeout\tf@mtc}
674 \def\@@dominilot{\@dominilot{\jobname}\immediate\closeout\tf@mtc}
675
676 \def\MTC@next#1\relax#2\\{%
677   \edef\MTC@list{#2}%
678   \MTC@loop{#1}}
679 \def\MTC@toc{%
680   \ifx\MTC@list\@empty\else\expandafter\MTC@explist\fi}
681
682 %%%%%%% patch minitoc to write *.mtc files with link name at end
683 % so that hyperref contentsline works properly---I hope
684 \def\MTC@contentsline#1#2#3#4{% %%BJ: 4 instead of 3 parameters
685 \gdef\themtc{\arabic{mtc}}
686 \expandafter%
687  \ifx\csname #1\endcsname\chapter\relax
688  \stepcounter{mtc}% % the mtc counter simulates the chapter counter
689 \@ifundefined{SHORTEXT}%
690 {\typeout{Writing\space\jobname.mtc\themtc}%     % UNIX
691 \def\mtcname{\jobname.mtc\themtc}}%              % UNIX
692 {\typeout{Writing\space\jobname.M\themtc}%       % MS-DOS
693 \def\mtcname{\jobname.M\themtc}}%                % MS-DOS
694  \immediate\closeout\tf@mtc % close current .mtcN .mtc->.M on MS-DOS
695  \immediate\openout\tf@mtc=\mtcname % open next .mtcN (.mtc->.M if MS-DOS)
696  \fi
697 \expandafter% % extracts and writes info for sections, etc.
698  \ifx\csname #1\endcsname\section\relax
699      \mtc@toks{\noexpand\leavevmode#2}%
700      \edef\@tempa{\immediate\write\tf@mtc {%
701      {\string\reset@font\string\mtcSfont\string\mtc@string%
702      \string\contentsline{#1}%
703      {\noexpand\the\mtc@toks}{\string\reset@font\string\mtcSfont%
704       \space #3}{#4}}}}\@tempa%   %%BJ: #4 is hyperlink
705  \fi
706 \expandafter%
707  \ifx\csname #1\endcsname\subsection\relax
708      \mtc@toks{\noexpand\leavevmode#2}%
709      \edef\@tempa{\immediate\write\tf@mtc {%
710      {\string\reset@font\string\mtcSSfont\string\mtc@string%
711      \string\contentsline{#1}%
712      {\noexpand\the\mtc@toks}{\string\reset@font\string\mtcSSfont%
713       \space #3}{#4}}}}\@tempa%   %%BJ: #4 is hyperlink
714  \fi
715 \expandafter%
716  \ifx\csname #1\endcsname\subsubsection\relax
717      \mtc@toks{\noexpand \leavevmode#2}%
718      \edef\@tempa{\immediate\write\tf@mtc {%
719      {\string\reset@font\string\mtcSSSfont\string\mtc@string%
720      \string\contentsline{#1}%
721      {\noexpand\the\mtc@toks}{\string\reset@font\string\mtcSSSfont%
722       \space #3}{#4}}}}\@tempa%   %%BJ: #4 is hyperlink
723  \fi
724 \expandafter%
725  \ifx\csname #1\endcsname\paragraph\relax
726      \mtc@toks{\noexpand\leavevmode#2}%
727      \edef\@tempa{\immediate\write\tf@mtc {%
728      {\string\reset@font\string\mtcPfont\string\mtc@string%
729      \string\contentsline{#1}%
730      {\noexpand\the\mtc@toks}{\string\reset@font\string\mtcPfont%
731       \space #3}{#4}}}}\@tempa%   %%BJ: #4 is hyperlink
732  \fi
733 \expandafter%
734  \ifx\csname #1\endcsname\subparagraph\relax
735      \mtc@toks{\noexpand\leavevmode#2}%
736      \edef\@tempa{\immediate\write\tf@mtc {%
737      {\string\reset@font\string\mtcSPfont\string\mtc@string%
738      \string\contentsline{#1}%
739      {\noexpand\the\mtc@toks}{\string\reset@font\string\mtcSPfont
740       \space #3}{#4}}}}\@tempa%   %%BJ: #4 is hyperlink
741  \fi
742 % Added v25: \starchapter and co.
743 \expandafter% % extracts and writes info for sections, etc.
744  \ifx\csname #1\endcsname\starchapter\relax
745 \stepcounter{mtc}% % the mtc counter simulates the chapter counter
746 \@ifundefined{SHORTEXT}%
747 {\typeout{Writing\space\jobname.mtc\themtc}%     % UNIX
748 \def\mtcname{\jobname.mtc\themtc}}%              % UNIX
749 {\typeout{Writing\space\jobname.M\themtc}%       % MS-DOS
750 \def\mtcname{\jobname.M\themtc}}%                % MS-DOS
751  \immediate\closeout\tf@mtc % close current .mtcN .mtc->.M on MS-DOS
752  \immediate\openout\tf@mtc=\mtcname % open next .mtcN (.mtc->.M if MS-DOS)
753  \fi
754 \expandafter% % extracts and writes info for sections, etc.
755  \ifx\csname #1\endcsname\starsection\relax
756      \mtc@toks{\noexpand\leavevmode#2}%
757      \edef\@tempa{\immediate\write\tf@mtc {%
758      {\string\reset@font\string\mtcSfont\string\mtc@string%
759      \string\contentsline{#1}%
760      {\noexpand\the\mtc@toks}{\string\reset@font\string\mtcSfont%
761       \space #3}{#4}}}}\@tempa%   %%BJ: #4 is hyperlink
762  \fi
763 \expandafter%
764  \ifx\csname #1\endcsname\starsubsection\relax
765      \mtc@toks{\noexpand\leavevmode#2}%
766      \edef\@tempa{\immediate\write\tf@mtc {%
767      {\string\reset@font\string\mtcSSfont\string\mtc@string%
768      \string\contentsline{#1}%
769      {\noexpand\the\mtc@toks}{\string\reset@font\string\mtcSSfont%
770       \space #3}{#4}}}}\@tempa%   %%BJ: #4 is hyperlink
771  \fi
772 \expandafter%
773  \ifx\csname #1\endcsname\starsubsubsection\relax
774      \mtc@toks{\noexpand \leavevmode#2}%
775      \edef\@tempa{\immediate\write\tf@mtc {%
776      {\string\reset@font\string\mtcSSSfont\string\mtc@string%
777      \string\contentsline{#1}%
778      {\noexpand\the\mtc@toks}{\string\reset@font\string\mtcSSSfont%
779       \space #3}{#4}}}}\@tempa%   %%BJ: #4 is hyperlink
780  \fi
781 \expandafter%
782  \ifx\csname #1\endcsname\starparagraph\relax
783      \mtc@toks{\noexpand\leavevmode#2}%
784      \edef\@tempa{\immediate\write\tf@mtc {%
785      {\string\reset@font\string\mtcPfont\string\mtc@string%
786      \string\contentsline{#1}%
787      {\noexpand\the\mtc@toks}{\string\reset@font\string\mtcPfont%
788       \space #3}{#4}}}}\@tempa%   %%BJ: #4 is hyperlink
789  \fi
790 \expandafter%
791  \ifx\csname #1\endcsname\starsubparagraph\relax
792      \mtc@toks{\noexpand\leavevmode#2}%
793      \edef\@tempa{\immediate\write\tf@mtc {%
794      {\string\reset@font\string\mtcSPfont\string\mtc@string%
795      \string\contentsline{#1}%
796      {\noexpand\the\mtc@toks}{\string\reset@font\string\mtcSPfont
797       \space #3}{#4}}}}\@tempa%   %%BJ: #4 is hyperlink
798  \fi
799 }
800
801
802 \def\MTC@explist{\expandafter\MTC@next\MTC@list\\}
803 \def\MTC@loop#1{\openin\@inputcheck#1\relax
804   \ifeof\@inputcheck
805     \typeout{^^JNo file #1^^JMINITOCS NOT PREPARED.^^J}%
806     \expandafter\MTC@toc
807   \else
808     \typeout{PREPARING MINITOCS FROM #1}%
809     \expandafter\MTC@read\fi}
810 \def\MTC@read{%
811   \read\@inputcheck to\MTC@line
812   \expandafter\MTC@test\MTC@line....\MTC@%
813   }%
814 % now patch MTC@test %   %%BJ: call \MTC@contentsline with 4 instead of 3 parameters
815 \newcommand{\scrubdots}[5]{#1} %%BJ: added by Tony Roberts
816 \long\def\MTC@test#1#2#3#4#5\MTC@{%
817   \ifx#1\contentsline
818     \let\mtc@string\string
819     \MTC@contentsline{#2}{#3}{#4}{\scrubdots#5}% %%BJ: 4. parameter added by Tony Roberts
820     \let\mtc@string\relax
821   \else\ifx#1\@input
822      \edef\MTC@list{\MTC@list#2\relax}%
823   \else\ifx#1\chapterend % \chapter* closes .mtcN (.mtc->.M on MS-DOS)
824      \immediate\closeout\tf@mtc
825      \immediate\openout\tf@mtc=\jobname.bmt % and opens a scratch file
826   \else\ifx#1\chapterbegin
827      \addtocounter{mtc}{-1}% % \chapter* has done a parasite increment
828   \fi\fi\fi\fi
829   \ifeof\@inputcheck\expandafter\MTC@toc
830   \else\expandafter\MTC@read\fi}%
831 %%%%%%%%%% end of minitoc patches
832
833
834 \def\MLF@next#1\relax#2\\{%
835   \edef\MLF@list{#2}%
836   \MLF@loop{#1}}
837 \def\MLF@lof{%
838   \ifx\MLF@list\@empty\else\expandafter\MLF@explist\fi}
839
840 \def\MLF@contentsline#1#2#3{%
841 \gdef\themtc{\arabic{mtc}}
842 \expandafter%
843  \ifx\csname #1\endcsname\xchapter\relax
844  \stepcounter{mtc}% % the mtc counter simulates the chapter counter
845 \@ifundefined{SHORTEXT}%
846 {\typeout{Writing\space\jobname.mlf\themtc}%     % UNIX
847 \def\mlfname{\jobname.mlf\themtc}}%              % UNIX
848 {\typeout{Writing\space\jobname.F\themtc}%       % MS-DOS
849 \def\mlfname{\jobname.F\themtc}}%                % MS-DOS
850  \immediate\closeout\tf@mtc % close current .mlfN .mlf->.F on MS-DOS
851  \immediate\openout\tf@mtc=\mlfname % open next .mlfN (.mlf->.F if MS-DOS)
852  \fi
853 \expandafter% % extracts and writes info for sections, etc.
854  \ifx\csname #1\endcsname\figure\relax
855      \mtc@toks{\noexpand\leavevmode#2}%
856      \edef\@tempa{\immediate\write\tf@mtc {%
857      {\string\reset@font\string\mlffont\string\mtc@string%
858      \string\contentsline{#1}%
859      {\noexpand\the\mtc@toks}{\string\reset@font\string\mlffont%
860       \space #3}}}}\@tempa
861  \fi
862 }
863
864 \def\MLF@explist{\expandafter\MLF@next\MLF@list\\}
865 \def\MLF@loop#1{\openin\@inputcheck#1\relax
866   \ifeof\@inputcheck
867     \typeout{^^JNo file #1^^JMINILOFS NOT PREPARED.^^J}%
868     \expandafter\MLF@lof
869   \else
870     \typeout{PREPARING MINILOFS FROM #1}%
871     \expandafter\MLF@read\fi}
872 \def\MLF@read{%
873   \read\@inputcheck to\MLF@line
874   \expandafter\MLF@test\MLF@line....\MLF@%
875   }%
876 \long\def\MLF@test#1#2#3#4#5\MLF@{%
877   \ifx#1\contentsline
878     \let\mtc@string\string
879     \MLF@contentsline{#2}{#3}{#4}%
880     \let\mtc@string\relax
881   \else\ifx#1\@input
882      \edef\MLF@list{\MLF@list#2\relax}%
883   \else\ifx#1\chapterend % \chapter* closes .mlfN (.mlf->.F on MS-DOS)
884      \immediate\closeout\tf@mtc
885      \immediate\openout\tf@mtc=\jobname.bmt % and opens a scratch file
886   \else\ifx#1\chapterbegin
887      \addtocounter{mtc}{-1}% % \chapter* has done a parasite increment
888   \fi\fi\fi\fi
889   \ifeof\@inputcheck\expandafter\MLF@lof
890   \else\expandafter\MLF@read\fi}%
891
892 \def\MLT@next#1\relax#2\\{%
893   \edef\MLT@list{#2}%
894   \MLT@loop{#1}}
895 \def\MLT@lot{%
896   \ifx\MLT@list\@empty\else\expandafter\MLT@explist\fi}
897
898 \def\MLT@contentsline#1#2#3{%
899 \gdef\themtc{\arabic{mtc}}
900 \expandafter%
901  \ifx\csname #1\endcsname\xchapter\relax
902  \stepcounter{mtc}% % the mtc counter simulates the chapter counter
903 \@ifundefined{SHORTEXT}%
904 {\typeout{Writing\space\jobname.mlt\themtc}%     % UNIX
905 \def\mltname{\jobname.mlt\themtc}}%              % UNIX
906 {\typeout{Writing\space\jobname.T\themtc}%       % MS-DOS
907 \def\mltname{\jobname.T\themtc}}%                % MS-DOS
908  \immediate\closeout\tf@mtc % close current .mltN .mlt->.T on MS-DOS
909  \immediate\openout\tf@mtc=\mltname % open next .mltN (.mlt->.T if MS-DOS)
910  \fi
911 \expandafter% % extracts and writes info for sections, etc.
912  \ifx\csname #1\endcsname\table\relax
913      \mtc@toks{\noexpand\leavevmode#2}%
914      \edef\@tempa{\immediate\write\tf@mtc {%
915      {\string\reset@font\string\mltfont\string\mtc@string%
916      \string\contentsline{#1}%
917      {\noexpand\the\mtc@toks}{\string\reset@font\string\mltfont%
918       \space #3}}}}\@tempa
919  \fi
920 }
921
922 \def\MLT@explist{\expandafter\MLT@next\MLT@list\\}
923 \def\MLT@loop#1{\openin\@inputcheck#1\relax
924   \ifeof\@inputcheck
925     \typeout{^^JNo file #1^^JMINILOTS NOT PREPARED.^^J}%
926     \expandafter\MLT@lot
927   \else
928     \typeout{PREPARING MINILOTS FROM #1}%
929     \expandafter\MLT@read\fi}
930 \def\MLT@read{%
931   \read\@inputcheck to\MLT@line
932   \expandafter\MLT@test\MLT@line....\MLT@%
933   }%
934 \long\def\MLT@test#1#2#3#4#5\MLT@{%
935   \ifx#1\contentsline
936     \let\mtc@string\string
937     \MLT@contentsline{#2}{#3}{#4}%
938     \let\mtc@string\relax
939   \else\ifx#1\@input
940      \edef\MLT@list{\MLT@list#2\relax}%
941   \else\ifx#1\chapterend % \chapter* closes .mltN (.mlt->.T on MS-DOS)
942      \immediate\closeout\tf@mtc
943      \immediate\openout\tf@mtc=\jobname.bmt % and opens a scratch file
944   \else\ifx#1\chapterbegin
945      \addtocounter{mtc}{-1}% % \chapter* has done a parasite increment
946   \fi\fi\fi\fi
947   \ifeof\@inputcheck\expandafter\MLT@lot
948   \else\expandafter\MLT@read\fi}%
949 } % end of chapter level
950
951 %%%%%%%%%%%%%%%%%%%%%%%%%
952 %%
953 % If \part is defined (book or article-like document),
954 % the following macros are allowed
955 % Sometimes, we need to make a difference between book and
956 % article (is \chapter defined?), to have a different layout.
957 \@ifundefined{part}{}%
958 {%
959 \def\xpart{xpart}
960 \def\Thepart{\arabic{part}}
961 \def\firstpartis#1%
962   {\typeout{^^JWARNING*** \string\firstpartis}%
963    \typeout{ is an obsolete command^^J}}
964 \newcounter{ptc}  % counter of parttocs
965 \setcounter{ptc}{0}
966 \def\theptc{\arabic{ptc}}
967 \newcounter{parttocdepth} % analog to tocdepth, but for parttocs
968 \setcounter{parttocdepth}{2}
969
970 \@ifundefined{chapter}{%
971 \def\ptc@rule{\kern-3\p@%
972   \hrule width \columnwidth \kern2.6\p@}% the \hrule is .4pt high
973 }{\let\ptc@rule\relax} % no rule before/after parttoc/partlof/partlot
974                        % for books
975
976 \newlength\ptcindent % indentation (left/right) of parttocs
977 \@ifundefined{chapter}{\ptcindent=24pt}{\ptcindent=0pt} % defaut value
978
979 \@ifundefined{chapter}{%
980 \def\ptcfont{\small\rm}    % font for the parttoc
981 \def\ptcSfont{\small\bf}   % font for the parttoc (sections)
982 \def\ptcSSfont{\ptcfont}   % font for the parttoc (subsections)
983 \def\ptcSSSfont{\ptcfont}  % font for the parttoc (subsubsections)
984 \def\ptcPfont{\ptcfont}    % font for the parttoc (paragraphs)
985 \def\ptcSPfont{\ptcfont}   % font for the parttoc (subparagraphs)
986 \def\plffont{\ptcfont}     % font for the partlof (figures)
987 \def\pltfont{\ptcfont}     % font for the partlot (tables)
988 \def\ptifont{\large\bf}    % font for titles
989 }{%
990 \def\ptcfont{\normalsize\rm}    % font for the parttoc
991 \def\ptcCfont{\normalsize\bf}   % font for the parttoc (chapters)
992 \def\ptcSfont{\normalsize\rm}   % font for the parttoc (sections)
993 \def\ptcSSfont{\ptcfont}   % font for the parttoc (subsections)
994 \def\ptcSSSfont{\ptcfont}  % font for the parttoc (subsubsections)
995 \def\ptcPfont{\ptcfont}    % font for the parttoc (paragraphs)
996 \def\ptcSPfont{\ptcfont}   % font for the parttoc (subparagraphs)
997 \def\plffont{\ptcfont}     % font for the partlof (figures)
998 \def\pltfont{\ptcfont}     % font for the partlot (tables)
999 \def\ptifont{\Huge\bf}     % font for titles
1000 }
1001
1002 % Centering, flushleft, flushright or empty titles.
1003 \@ifundefined{chapter}{%
1004 \def\c@pti#1{\null\hfill #1\hfill\null}
1005 \def\l@pti#1{\null #1\hfill\null}
1006 \def\r@pti#1{\null\hfill #1\null}
1007 \def\e@pti#1{\relax}
1008 \def\n@pti#1{\relax}
1009 }{%
1010 \def\e@pti#1{\relax}
1011 \def\n@pti#1{\relax}
1012 \def\l@pti#1{\if@twocolumn
1013     \@topnewpage[\@makephead@l{#1}]%
1014     \else
1015     \@makephead@l{#1}%
1016     \@afterheading
1017     \fi}
1018 \def\@makephead@l#1{%
1019     \vspace*{50\p@}%
1020     {\parindent \z@ \raggedright
1021      \ptifont
1022      #1\par
1023      \nobreak
1024      \vskip 40\p@
1025     }}
1026 \def\r@pti#1{\if@twocolumn
1027     \@topnewpage[\@makephead@r{#1}]%
1028     \else
1029     \@makephead@r{#1}%
1030     \@afterheading
1031     \fi}
1032 \def\@makephead@r#1{%
1033     \vspace*{50\p@}%
1034     {\parindent \z@ \raggedleft
1035      \ptifont
1036      #1\par
1037      \nobreak
1038      \vskip 40\p@
1039     }}
1040 \def\c@pti#1{\if@twocolumn
1041     \@topnewpage[\@makephead@c{#1}]%
1042     \else
1043     \@makephead@c{#1}%
1044     \@afterheading
1045     \fi}
1046 \def\@makephead@c#1{%
1047     \vspace*{50\p@}%
1048     {\parindent \z@ \centering
1049      \ptifont
1050      #1\par
1051      \nobreak
1052      \vskip 40\p@
1053     }}%
1054 }
1055
1056 % Default: titles on left
1057 \let\do@ptitc\l@pti
1058 \let\df@ptitc\l@pti
1059 \let\do@ptilf\l@pti
1060 \let\df@ptilf\l@pti
1061 \let\do@ptilt\l@pti
1062 \let\df@ptilt\l@pti
1063
1064 %v27 % Language dependent names: default values
1065 %v27 \@ifundefined{chapter}{%
1066 %v27 \@ifundefined{ptctitle}{\def\ptctitle{Contents}}{\relax}
1067 %v27 \@ifundefined{plftitle}{\def\plftitle{Figures}}{\relax}
1068 %v27 \@ifundefined{plttitle}{\def\plttitle{Tables}}{\relax}}%
1069 %v27 {%
1070 %v27 \@ifundefined{ptctitle}{\def\ptctitle{Table of Contents}}{\relax}
1071 %v27 \@ifundefined{plftitle}{\def\plftitle{List of Figures}}{\relax}
1072 %v27 \@ifundefined{plttitle}{\def\plttitle{List of Tables}}{\relax}
1073 %v27 }
1074
1075 \def\ptc@verse{\let\\=\@centercr
1076   \list{}{\itemsep\z@\itemindent \z@\listparindent \itemindent
1077           \leftmargin\ptcindent
1078           \rightmargin\leftmargin}\item[]}
1079 \def\endptc@verse{\nopagebreak[4]\endlist}
1080
1081 % this command must be used after \part
1082 % if you need a parttoc (no automatic parttoc)
1083 \def\parttoc{\@ifnextchar[{\parttoc@}{\parttoc@[d]}}
1084
1085 \def\parttoc@[#1]{%
1086         \@ifundefined{chapter}{}{\cleardoublepage
1087         \global\let\mtc@markboth\markboth
1088         \global\let\@mkboth\markboth
1089         \thispagestyle{empty}
1090         \mtc@markboth{\uppercase{\ptctitle}}{\uppercase{\ptctitle}}%
1091         }%
1092         \relax\begin{samepage}% we begin a local group here, using samepage
1093         \if #1e\let\do@ptitc\e@pti
1094         \else\if #1n\let\do@ptitc\n@pti
1095         \else\if #1c\let\do@ptitc\c@pti
1096         \else\if #1l\let\do@ptitc\l@pti
1097         \else\if #1r\let\do@ptitc\r@pti
1098         \else\if #1d\let\do@ptitc\df@ptitc
1099         \fi\fi\fi\fi\fi\fi
1100         \raggedright % added #14
1101         \parskip=\z@%
1102         \reset@font\ptcfont%
1103         \parindent=\z@%
1104         \nopagebreak[4]%
1105         \kern-0.8\baselineskip\nopagebreak[4]%
1106         \par\noindent
1107         \nopagebreak[4]%
1108         \ifx\ptc@rule\relax
1109         \begin{tabular}{@{}p{\columnwidth}@{}}
1110         {\reset@font\ptifont\do@ptitc{\mtc@v\ptctitle}}\\
1111         \end{tabular}\else
1112         \begin{tabular}{@{}p{\columnwidth}@{}}
1113         {\reset@font\ptifont\do@ptitc{\mtc@v\ptctitle}}\\\hline
1114         \end{tabular}\fi
1115         \nopagebreak[4]\null\leavevmode\vrule width \z@
1116         height \z@ depth \z@\\\@BBR%
1117         \leftmargin\ptcindent
1118         \rightmargin\ptcindent
1119         \itemindent=\z@\labelwidth=\z@%
1120         \labelsep=\z@\listparindent=\z@%
1121         \begin{ptc@verse}\c@tocdepth=\c@parttocdepth%
1122         \leavevmode\\\@BBR% this blank line is necessary to avoid
1123                 % a wild negative indentation
1124         \vskip -.5\baselineskip
1125 \begingroup
1126   \makeatletter
1127   \@ifundefined{ptc@pgno}%
1128   {\let\@dottedtocline\@undottedtocline}{}
1129 \@ifundefined{SHORTEXT}%
1130 {\def\@tocfile{ptc\Thepart}}%  % UNIX
1131 {\def\@tocfile{P\Thepart}}%    % MS-DOS
1132   \@input{\jobname.\@tocfile}\if@filesw
1133   \fi%
1134   \global\@nobreakfalse\endgroup
1135         \end{ptc@verse}%
1136         \kern0.\baselineskip%
1137         \nopagebreak[4]\ptc@rule\null\leavevmode\\%
1138         \vskip-1.0\baselineskip
1139         \vrule width \z@ height \z@
1140         depth \z@\end{samepage}% %## the \\ is essential
1141         \par\@ifundefined{chapter}{\pagebreak[1]\vspace*{-1ex}}%
1142         {\cleardoublepage}}
1143
1144 % this command must be used after \part
1145 % if you need a partlof (no automatic partlof)
1146 \def\partlof{\@ifnextchar[{\partlof@}{\partlof@[d]}}
1147
1148 \def\partlof@[#1]{%
1149         \@ifundefined{chapter}{}{\cleardoublepage
1150         \global\let\mtc@markboth\markboth
1151         \global\let\@mkboth\markboth
1152         \thispagestyle{empty}
1153         \mtc@markboth{\uppercase{\plftitle}}{\uppercase{\plftitle}}%
1154         }%
1155         \relax\begin{samepage}% we begin a local group here, using samepage
1156         \if #1e\let\do@ptilf\e@pti
1157         \else\if #1n\let\do@ptilf\n@pti
1158         \else\if #1c\let\do@ptilf\c@pti
1159         \else\if #1l\let\do@ptilf\l@pti
1160         \else\if #1r\let\do@ptilf\r@pti
1161         \else\if #1d\let\do@ptilf\df@ptilf
1162         \fi\fi\fi\fi\fi\fi
1163         \raggedright % added #14
1164         \parskip=\z@%
1165         \reset@font\plffont%
1166         \parindent=\z@%
1167         \nopagebreak[4]%
1168         \kern-0.8\baselineskip\nopagebreak[4]%
1169         \par\noindent
1170         \ifx\ptc@rule\relax
1171         \begin{tabular}{@{}p{\columnwidth}@{}}
1172         {\reset@font\ptifont\do@ptilf{\mtc@v\plftitle}}\\
1173         \end{tabular}\else
1174         \begin{tabular}{@{}p{\columnwidth}@{}}
1175         {\reset@font\ptifont\do@ptilf{\mtc@v\plftitle}}\\
1176         \@ifundefined{chapter}{\hline}{}
1177         \end{tabular}\fi
1178         \nopagebreak[4]\null\leavevmode\vrule width \z@
1179         height \z@ depth \z@\\\@BBR%
1180         \leftmargin\ptcindent
1181         \rightmargin\ptcindent
1182         \itemindent=\z@\labelwidth=\z@%
1183         \labelsep=\z@\listparindent=\z@%
1184         % depth does not matter for partlof
1185         \begin{ptc@verse}%\c@tocdepth=\c@parttocdepth%
1186         \leavevmode\\\@BBR% this blank line is necessary to avoid
1187                 % a wild negative indentation
1188         \vskip -.5\baselineskip
1189 \begingroup
1190   \makeatletter
1191   \@ifundefined{plf@pgno}%
1192   {\let\@dottedtocline\@undottedtocline}{}
1193 \@ifundefined{SHORTEXT}%
1194 {\def\@tocfile{plf\Thepart}}%  % UNIX
1195 {\def\@tocfile{G\Thepart}}%    % MS-DOS
1196   \@input{\jobname.\@tocfile}\if@filesw
1197   \fi%
1198   \global\@nobreakfalse\endgroup
1199         \end{ptc@verse}%
1200         \kern0.\baselineskip%
1201         \nopagebreak[4]\ptc@rule\null\leavevmode\\%
1202         \vskip-1.0\baselineskip
1203         \vrule width \z@ height \z@
1204         depth \z@\end{samepage}% %## the \\ is essential
1205         \par\@ifundefined{chapter}{\pagebreak[1]\vspace*{-1ex}}%
1206         {\cleardoublepage}}
1207
1208 % Added in version #13
1209 % this command must be used after \part
1210 % if you need a minilot (no automatic partlot)
1211 \def\partlot{\@ifnextchar[{\partlot@}{\partlot@[d]}}
1212
1213 \def\partlot@[#1]{%
1214         \@ifundefined{chapter}{}{\cleardoublepage
1215         \global\let\mtc@markboth\markboth
1216         \global\let\@mkboth\markboth
1217         \thispagestyle{empty}
1218         \mtc@markboth{\uppercase{\plttitle}}{\uppercase{\plttitle}}%
1219         }%
1220         \relax\begin{samepage}% we begin a local group here, using samepage
1221         \if #1e\let\do@ptilt\e@pti
1222         \else\if #1n\let\do@ptilt\n@pti
1223         \else\if #1c\let\do@ptilt\c@pti
1224         \else\if #1l\let\do@ptilt\l@pti
1225         \else\if #1r\let\do@ptilt\r@pti
1226         \else\if #1d\let\do@ptilt\df@ptilt
1227         \fi\fi\fi\fi\fi\fi
1228         \raggedright % added #14
1229         \parskip=\z@%
1230         \reset@font\pltfont%
1231         \parindent=\z@%
1232         \nopagebreak[4]%
1233         \kern-0.8\baselineskip\nopagebreak[4]%
1234         \par\noindent
1235         \ifx\ptc@rule\relax
1236         \begin{tabular}{@{}p{\columnwidth}@{}}
1237         {\reset@font\ptifont\do@ptilt{\mtc@v\plttitle}}\\
1238         \end{tabular}\else
1239         \begin{tabular}{@{}p{\columnwidth}@{}}
1240         {\reset@font\ptifont\do@ptilt{\mtc@v\plttitle}}\\
1241         \@ifundefined{chapter}{\hline}{}
1242         \end{tabular}\fi
1243         \nopagebreak[4]\null\leavevmode\vrule width \z@
1244         height \z@ depth \z@\\\@BBR%
1245         \leftmargin\ptcindent
1246         \rightmargin\ptcindent
1247         \itemindent=\z@\labelwidth=\z@%
1248         \labelsep=\z@\listparindent=\z@%
1249         % depth does not matter for partlot
1250         \begin{ptc@verse}%\c@tocdepth=\c@parttocdepth%
1251         \leavevmode\\\@BBR% this blank line is necessary to avoid
1252                 % a wild negative indentation
1253         \vskip -.5\baselineskip
1254 \begingroup
1255   \makeatletter
1256   \@ifundefined{plt@pgno}%
1257   {\let\@dottedtocline\@undottedtocline}{}
1258 \@ifundefined{SHORTEXT}%
1259 {\def\@tocfile{plt\Thepart}}%  % UNIX
1260 {\def\@tocfile{U\Thepart}}%    % MS-DOS
1261   \@input{\jobname.\@tocfile}\if@filesw
1262   \fi%
1263   \global\@nobreakfalse\endgroup
1264         \end{ptc@verse}%
1265         \kern0.\baselineskip%
1266         \nopagebreak[4]\ptc@rule\null\leavevmode\\%
1267         \vskip-1.0\baselineskip
1268         \vrule width \z@ height \z@
1269         depth \z@\end{samepage}% %## the \\ is essential
1270         \par\@ifundefined{chapter}{\pagebreak[1]\vspace*{-1ex}}%
1271         {\cleardoublepage}}
1272
1273 % I use a depth of 10000 to inhibit the printing of
1274 % that contentsline.
1275 \def\l@xpart{\@dottedtocline{\@M}{1.0em}{2.3em}}
1276 \def\l@pchapter{\@dottedtocline{1}{1.0em}{2.3em}}
1277
1278 \def\pchapter{pchapter}
1279
1280 \let\sv@part\@part
1281 \def\@part[#1]#2{\sv@part[{#1}]{#2}\relax%
1282 \addcontentsline{lof}{xpart}{#1}%
1283 \addcontentsline{lot}{xpart}{#1}%
1284 }
1285
1286 % tricky code to deal with \part*
1287 \let\ptc@spart\@spart
1288 \def\@spart{%
1289 \addtocontents{toc}{\protect\partend}\ptc@spart%
1290 }
1291 \def\@spart{%
1292 \addtocontents{toc}{\protect\partbegin}\ptc@spart%
1293 }
1294 \let\partend\relax
1295 \let\partbegin\relax
1296
1297 \let\appendixmtc\relax
1298
1299 % this command extracts info from the .toc file
1300 % and create the .ptcN files (.ptc -> .P on MS-DOS)
1301 \def\@doparttoc#1{{%
1302   \makeatletter
1303   \setcounter{ptc}{0} % START VALUE
1304   \PTC@next#1.toc\relax\\}\setcounter{ptc}{0}} %23; raz
1305 % this command extracts info from the .lof file
1306 % and create the .plfN files (.plf -> .G on MS-DOS)
1307 \def\@dopartlof#1{{%
1308   \makeatletter
1309   \setcounter{ptc}{0} % START VALUE
1310   \PLF@next#1.lof\relax\\}\setcounter{ptc}{0}} %23: raz
1311 % this command extracts info from the .lot file
1312 % and create the .pltN files (.plt -> .U on MS-DOS)
1313 \def\@dopartlot#1{{%
1314   \setcounter{ptc}{0} % START VALUE
1315   \makeatletter
1316   \PLT@next#1.lot\relax\\}\setcounter{ptc}{0}} %23: raz
1317
1318 \def\doparttoc{\@ifnextchar[{\doparttoc@}{\doparttoc@[l]}}
1319 \def\dopartlof{\@ifnextchar[{\dopartlof@}{\dopartlof@[l]}}
1320 \def\dopartlot{\@ifnextchar[{\dopartlot@}{\dopartlot@[l]}}
1321
1322 \def\doparttoc@[#1]{%
1323 \if #1e\let\df@ptitc\e@pti%
1324 \else\if #1n\let\df@ptitc\n@pti%
1325 \else\if #1c\let\df@ptitc\c@pti%
1326 \else\if #1l\let\df@ptitc\l@pti%
1327 \else\if #1r\let\df@ptitc\r@pti%
1328 \fi\fi\fi\fi\fi%
1329 \@@doparttoc}
1330
1331 \def\dopartlof@[#1]{%
1332 \if #1e\let\df@ptilf\e@pti%
1333 \else\if #1n\let\df@ptilf\n@pti%
1334 \else\if #1c\let\df@ptilf\c@pti%
1335 \else\if #1l\let\df@ptilf\l@pti%
1336 \else\if #1r\let\df@ptilf\r@pti%
1337 \fi\fi\fi\fi\fi%
1338 \@@dopartlof}
1339
1340 \def\dopartlot@[#1]{%
1341 \if #1e\let\df@ptilt\e@pti%
1342 \else\if #1n\let\df@ptilt\n@pti%
1343 \else\if #1c\let\df@ptilt\c@pti%
1344 \else\if #1l\let\df@ptilt\l@pti%
1345 \else\if #1r\let\df@ptilt\r@pti%
1346 \fi\fi\fi\fi\fi%
1347 \@@dopartlot}
1348
1349 \def\@@doparttoc{\@doparttoc{\jobname}\immediate\closeout\tf@mtc}
1350 \def\@@dopartlof{\@dopartlof{\jobname}\immediate\closeout\tf@mtc}
1351 \def\@@dopartlot{\@dopartlot{\jobname}\immediate\closeout\tf@mtc}
1352
1353 \def\PTC@next#1\relax#2\\{%
1354   \edef\PTC@list{#2}%
1355   \PTC@loop{#1}}
1356 \def\PTC@toc{%
1357   \ifx\PTC@list\@empty\else\expandafter\PTC@explist\fi}
1358
1359 \def\PTC@contentsline#1#2#3#4{% %%DV: 4 instead of 3 parameters
1360 \expandafter%
1361  \ifx\csname #1\endcsname\part\relax
1362  \stepcounter{ptc}% % the ptc counter simulates the part counter
1363 \@ifundefined{SHORTEXT}%
1364 {\typeout{Writing\space\jobname.ptc\theptc}%     % UNIX
1365 \def\ptcname{\jobname.ptc\theptc}}%              % UNIX
1366 {\typeout{Writing\space\jobname.P\theptc}%       % MS-DOS
1367 \def\ptcname{\jobname.P\theptc}}%                % MS-DOS
1368  \immediate\closeout\tf@mtc % close current .ptcN .ptc->.P on MS-DOS
1369  \immediate\openout\tf@mtc=\ptcname % open next .ptcN (.ptc->.P if MS-DOS)
1370  \fi
1371 \expandafter% % extracts and writes info for chapters, sections, etc.
1372  \ifx\csname #1\endcsname\chapter\relax
1373      \mtc@toks{\noexpand\leavevmode#2}%
1374      \edef\@tempa{\immediate\write\tf@mtc {%
1375      {\string\reset@font\string\ptcCfont\string\mtc@string%
1376      \string\contentsline{#1}%
1377      {\noexpand\the\mtc@toks}{\string\reset@font\string\ptcCfont%
1378       \space #3}{#4}}}}\@tempa% %%DV: 4 instead of 3 parameters
1379  \fi
1380 \expandafter%
1381  \ifx\csname #1\endcsname\section\relax
1382      \mtc@toks{\noexpand\leavevmode#2}%
1383      \edef\@tempa{\immediate\write\tf@mtc {%
1384      {\string\reset@font\string\ptcSfont\string\mtc@string%
1385      \string\contentsline{#1}%
1386      {\noexpand\the\mtc@toks}{\string\reset@font\string\ptcSfont%
1387       \space #3}{#4}}}}\@tempa% %%DV: 4 instead of 3 parameters
1388  \fi
1389 \expandafter%
1390  \ifx\csname #1\endcsname\subsection\relax
1391      \mtc@toks{\noexpand\leavevmode#2}%
1392      \edef\@tempa{\immediate\write\tf@mtc {%
1393      {\string\reset@font\string\ptcSSfont\string\mtc@string%
1394      \string\contentsline{#1}%
1395      {\noexpand\the\mtc@toks}{\string\reset@font\string\ptcSSfont%
1396       \space #3}{#4}}}}\@tempa% %%DV: 4 instead of 3 parameters
1397  \fi
1398 \expandafter%
1399  \ifx\csname #1\endcsname\subsubsection\relax
1400      \mtc@toks{\noexpand \leavevmode#2}%
1401      \edef\@tempa{\immediate\write\tf@mtc {%
1402      {\string\reset@font\string\ptcSSSfont\string\mtc@string%
1403      \string\contentsline{#1}%
1404      {\noexpand\the\mtc@toks}{\string\reset@font\string\ptcSSSfont%
1405       \space #3}{#4}}}}\@tempa% %%DV: 4 instead of 3 parameters
1406  \fi
1407 \expandafter%
1408  \ifx\csname #1\endcsname\paragraph\relax
1409      \mtc@toks{\noexpand\leavevmode#2}%
1410      \edef\@tempa{\immediate\write\tf@mtc {%
1411      {\string\reset@font\string\ptcPfont\string\mtc@string%
1412      \string\contentsline{#1}%
1413      {\noexpand\the\mtc@toks}{\string\reset@font\string\ptcPfont%
1414       \space #3}{#4}}}}\@tempa% %%DV: 4 instead of 3 parameters
1415  \fi
1416 \expandafter%
1417  \ifx\csname #1\endcsname\subparagraph\relax
1418      \mtc@toks{\noexpand\leavevmode#2}%
1419      \edef\@tempa{\immediate\write\tf@mtc {%
1420      {\string\reset@font\string\ptcSPfont\string\mtc@string%
1421      \string\contentsline{#1}%
1422      {\noexpand\the\mtc@toks}{\string\reset@font\string\ptcSPfont
1423       \space #3}{#4}}}}\@tempa% %%DV: 4 instead of 3 parameters
1424  \fi
1425 % Added v25: \starchapter & co.
1426 \expandafter% % extracts and writes info for chapters, sections, etc.
1427  \ifx\csname #1\endcsname\starchapter\relax
1428      \mtc@toks{\noexpand\leavevmode#2}%
1429      \edef\@tempa{\immediate\write\tf@mtc {%
1430      {\string\reset@font\string\ptcCfont\string\mtc@string%
1431      \string\contentsline{#1}%
1432      {\noexpand\the\mtc@toks}{\string\reset@font\string\ptcCfont%
1433       \space #3}{#4}}}}\@tempa% %%DV: 4 instead of 3 parameters
1434  \fi
1435 \expandafter%
1436  \ifx\csname #1\endcsname\starsection\relax
1437      \mtc@toks{\noexpand\leavevmode#2}%
1438      \edef\@tempa{\immediate\write\tf@mtc {%
1439      {\string\reset@font\string\ptcSfont\string\mtc@string%
1440      \string\contentsline{#1}%
1441      {\noexpand\the\mtc@toks}{\string\reset@font\string\ptcSfont%
1442       \space #3}{#4}}}}\@tempa% %%DV: 4 instead of 3 parameters
1443  \fi
1444 \expandafter%
1445  \ifx\csname #1\endcsname\starsubsection\relax
1446      \mtc@toks{\noexpand\leavevmode#2}%
1447      \edef\@tempa{\immediate\write\tf@mtc {%
1448      {\string\reset@font\string\ptcSSfont\string\mtc@string%
1449      \string\contentsline{#1}%
1450      {\noexpand\the\mtc@toks}{\string\reset@font\string\ptcSSfont%
1451       \space #3}{#4}}}}\@tempa% %%DV: 4 instead of 3 parameters
1452  \fi
1453 \expandafter%
1454  \ifx\csname #1\endcsname\starsubsubsection\relax
1455      \mtc@toks{\noexpand \leavevmode#2}%
1456      \edef\@tempa{\immediate\write\tf@mtc {%
1457      {\string\reset@font\string\ptcSSSfont\string\mtc@string%
1458      \string\contentsline{#1}%
1459      {\noexpand\the\mtc@toks}{\string\reset@font\string\ptcSSSfont%
1460       \space #3}{#4}}}}\@tempa% %%DV: 4 instead of 3 parameters
1461  \fi
1462 \expandafter%
1463  \ifx\csname #1\endcsname\starparagraph\relax
1464      \mtc@toks{\noexpand\leavevmode#2}%
1465      \edef\@tempa{\immediate\write\tf@mtc {%
1466      {\string\reset@font\string\ptcPfont\string\mtc@string%
1467      \string\contentsline{#1}%
1468      {\noexpand\the\mtc@toks}{\string\reset@font\string\ptcPfont%
1469       \space #3}{#4}}}}\@tempa% %%DV: 4 instead of 3 parameters
1470  \fi
1471 \expandafter%
1472  \ifx\csname #1\endcsname\starsubparagraph\relax
1473      \mtc@toks{\noexpand\leavevmode#2}%
1474      \edef\@tempa{\immediate\write\tf@mtc {%
1475      {\string\reset@font\string\ptcSPfont\string\mtc@string%
1476      \string\contentsline{#1}%
1477      {\noexpand\the\mtc@toks}{\string\reset@font\string\ptcSPfont
1478       \space #3}{#4}}}}\@tempa% %%DV: 4 instead of 3 parameters
1479  \fi
1480 }
1481
1482 \def\PTC@explist{\expandafter\PTC@next\PTC@list\\}
1483 \def\PTC@loop#1{\openin\@inputcheck#1\relax
1484   \ifeof\@inputcheck
1485     \typeout{^^JNo file #1^^JPARTTOCS NOT PREPARED.^^J}%
1486     \expandafter\PTC@toc
1487   \else
1488     \typeout{PREPARING PARTTOCS FROM #1}%
1489     \expandafter\PTC@read\fi}
1490 \def\PTC@read{%
1491   \read\@inputcheck to\PTC@line
1492   \expandafter\PTC@test\PTC@line....\PTC@%
1493   }%
1494 \long\def\PTC@test#1#2#3#4#5\PTC@{%
1495   \ifx#1\contentsline
1496     \let\mtc@string\string
1497     \PTC@contentsline{#2}{#3}{#4}{\scrubdots#5}% %%DV: 4 instead of 3 params
1498     \let\mtc@string\relax
1499   \else\ifx#1\@input
1500      \edef\PTC@list{\PTC@list#2\relax}%
1501   \else\ifx#1\partend % \part* closes .ptcN (.ptc->.P on MS-DOS)
1502      \immediate\closeout\tf@mtc
1503      \immediate\openout\tf@mtc=\jobname.bmt % and opens a scratch file
1504   \else\ifx#1\partbegin
1505      \addtocounter{ptc}{-1}% % \part* has done a parasite increment
1506   \fi\fi\fi\fi
1507   \ifeof\@inputcheck\expandafter\PTC@toc
1508   \else\expandafter\PTC@read\fi}%
1509
1510 \def\PLF@next#1\relax#2\\{%
1511   \edef\PLF@list{#2}%
1512   \PLF@loop{#1}}
1513 \def\PLF@lof{%
1514   \ifx\PLF@list\@empty\else\expandafter\PLF@explist\fi}
1515
1516 \def\PLF@contentsline#1#2#3{%
1517 \expandafter%
1518  \ifx\csname #1\endcsname\xpart\relax
1519  \stepcounter{ptc}% % the ptc counter simulates the part counter
1520 \@ifundefined{SHORTEXT}%
1521 {\typeout{Writing\space\jobname.plf\theptc}%     % UNIX
1522 \def\plfname{\jobname.plf\theptc}}%              % UNIX
1523 {\typeout{Writing\space\jobname.G\theptc}%       % MS-DOS
1524 \def\plfname{\jobname.G\theptc}}%                % MS-DOS
1525  \immediate\closeout\tf@mtc % close current .plfN .plf->.G on MS-DOS
1526  \immediate\openout\tf@mtc=\plfname % open next .plfN (.plf->.G if MS-DOS)
1527  \fi
1528 \expandafter% % extracts and writes info for sections, etc.
1529  \ifx\csname #1\endcsname\figure\relax
1530      \mtc@toks{\noexpand\leavevmode#2}%
1531      \edef\@tempa{\immediate\write\tf@mtc {%
1532      {\string\reset@font\string\plffont\string\mtc@string%
1533      \string\contentsline{#1}%
1534      {\noexpand\the\mtc@toks}{\string\reset@font\string\plffont%
1535       \space #3}}}}\@tempa
1536  \fi
1537 }
1538
1539 \def\PLF@explist{\expandafter\PLF@next\PLF@list\\}
1540 \def\PLF@loop#1{\openin\@inputcheck#1\relax
1541   \ifeof\@inputcheck
1542     \typeout{^^JNo file #1^^JPARTLOFS NOT PREPARED.^^J}%
1543     \expandafter\PLF@lof
1544   \else
1545     \typeout{PREPARING PARTLOFS FROM #1}%
1546     \expandafter\PLF@read\fi}
1547 \def\PLF@read{%
1548   \read\@inputcheck to\PLF@line
1549   \expandafter\PLF@test\PLF@line....\PLF@%
1550   }%
1551 \long\def\PLF@test#1#2#3#4#5\PLF@{%
1552   \ifx#1\contentsline
1553     \let\mtc@string\string
1554     \PLF@contentsline{#2}{#3}{#4}%
1555     \let\mtc@string\relax
1556   \else\ifx#1\@input
1557      \edef\PLF@list{\PLF@list#2\relax}%
1558   \else\ifx#1\partend % \part* closes .plfN (.plf->.G on MS-DOS)
1559      \immediate\closeout\tf@mtc
1560      \immediate\openout\tf@mtc=\jobname.bmt % and opens a scratch file
1561   \else\ifx#1\partbegin
1562      \addtocounter{ptc}{-1}% % \part* has done a parasite increment
1563   \fi\fi\fi\fi
1564   \ifeof\@inputcheck\expandafter\PLF@lof
1565   \else\expandafter\PLF@read\fi}%
1566
1567 \def\PLT@next#1\relax#2\\{%
1568   \edef\PLT@list{#2}%
1569   \PLT@loop{#1}}
1570 \def\PLT@lot{%
1571   \ifx\PLT@list\@empty\else\expandafter\PLT@explist\fi}
1572
1573 \def\PLT@contentsline#1#2#3{%
1574 \expandafter%
1575  \ifx\csname #1\endcsname\xpart\relax
1576  \stepcounter{ptc}% % the ptc counter simulates the part counter
1577 \@ifundefined{SHORTEXT}%
1578 {\typeout{Writing\space\jobname.plt\theptc}%     % UNIX
1579 \def\pltname{\jobname.plt\theptc}}%              % UNIX
1580 {\typeout{Writing\space\jobname.U\theptc}%       % MS-DOS
1581 \def\pltname{\jobname.U\theptc}}%                % MS-DOS
1582  \immediate\closeout\tf@mtc % close current .pltN .plt->.U on MS-DOS
1583  \immediate\openout\tf@mtc=\pltname % open next .pltN (.plt->.U if MS-DOS)
1584  \fi
1585 \expandafter% % extracts and writes info for chapters, sections, etc.
1586  \ifx\csname #1\endcsname\table\relax
1587      \mtc@toks{\noexpand\leavevmode#2}%
1588      \edef\@tempa{\immediate\write\tf@mtc {%
1589      {\string\reset@font\string\pltfont\string\mtc@string%
1590      \string\contentsline{#1}%
1591      {\noexpand\the\mtc@toks}{\string\reset@font\string\pltfont%
1592       \space #3}}}}\@tempa
1593  \fi
1594 }
1595
1596 \def\PLT@explist{\expandafter\PLT@next\PLT@list\\}
1597 \def\PLT@loop#1{\openin\@inputcheck#1\relax
1598   \ifeof\@inputcheck
1599     \typeout{^^JNo file #1^^JPARTLOTS NOT PREPARED.^^J}%
1600     \expandafter\PLT@lot
1601   \else
1602     \typeout{PREPARING PARTLOTS FROM #1}%
1603     \expandafter\PLT@read\fi}
1604 \def\PLT@read{%
1605   \read\@inputcheck to\PLT@line
1606   \expandafter\PLT@test\PLT@line....\PLT@%
1607   }%
1608 \long\def\PLT@test#1#2#3#4#5\PLT@{%
1609   \ifx#1\contentsline
1610     \let\mtc@string\string
1611     \PLT@contentsline{#2}{#3}{#4}%
1612     \let\mtc@string\relax
1613   \else\ifx#1\@input
1614      \edef\PLT@list{\PLT@list#2\relax}%
1615   \else\ifx#1\partend % \part* closes .pltN (.plt->.U on MS-DOS)
1616      \immediate\closeout\tf@mtc
1617      \immediate\openout\tf@mtc=\jobname.bmt % and opens a scratch file
1618   \else\ifx#1\partbegin
1619      \addtocounter{ptc}{-1}% % \part* has done a parasite increment
1620   \fi\fi\fi\fi
1621   \ifeof\@inputcheck\expandafter\PLT@lot
1622   \else\expandafter\PLT@read\fi}%
1623 } % end of part stuff
1624
1625 %%%%%%%%%%%%%%%%%%%%%%%
1626 %%% If \chapter is not defined but \section is, then
1627 %%% the following macros are available (for article-like documents).
1628 %%% Braces are inscrutable!
1629 \@ifundefined{chapter}%
1630 {\@ifundefined{section}{}{%
1631 \def\firstsectionis#1%
1632   {\typeout{^^JWARNING*** \string\firstsectionis}%
1633    \typeout{ is an obsolete command^^J}}
1634 \newcounter{stc}  % counter of secttocs
1635 \setcounter{stc}{0}
1636 \newcounter{secttocdepth} % analog to tocdepth, but for secttocs
1637 \setcounter{secttocdepth}{2}
1638
1639 % rule before/after secttoc/sectlof/sectlot
1640 \def\stc@rule{\kern-3\p@%
1641   \hrule width \columnwidth \kern2.6\p@} % the \hrule is .4pt high
1642
1643 \newlength\stcindent % indentation (left/right) of secttocs
1644 \stcindent=24pt      % defaut value
1645 \def\stcfont{\small\rm}    % font for the secttoc
1646 \def\stcSSfont{\normalsize\bf}   % font for the secttoc (subsections)
1647 \def\stcSSSfont{\stcfont}  % font for the secttoc (subsubsections)
1648 \def\stcPfont{\stcfont}    % font for the secttoc (paragraphs)
1649 \def\stcSPfont{\stcfont}   % font for the secttoc (subparagraphs)
1650 \def\slffont{\stcfont}     % font for the sectlof (figures)
1651 \def\sltfont{\stcfont}     % font for the sectlot (tables)
1652 \def\stifont{\Large\bf}    % font for titles
1653
1654 % Centering, flushleft, flushright or empty titles.
1655 \def\c@sti#1{\null\hfill #1\hfill\null}
1656 \def\l@sti#1{\null #1\hfill\null}
1657 \def\r@sti#1{\null\hfill #1\null}
1658 \def\e@sti#1{\relax}
1659 \def\n@sti#1{\relax}
1660
1661 % Default: titles on left
1662 \let\do@stitc\l@sti
1663 \let\df@stitc\l@sti
1664 \let\do@stilf\l@sti
1665 \let\df@stilf\l@sti
1666 \let\do@stilt\l@sti
1667 \let\df@stilt\l@sti
1668
1669 %v27 % Language dependent names: default values
1670 %v27 \@ifundefined{stctitle}{\def\stctitle{Contents}}{\relax}
1671 %v27 \@ifundefined{slftitle}{\def\slftitle{Figures}}{\relax}
1672 %v27 \@ifundefined{slttitle}{\def\slttitle{Tables}}{\relax}
1673
1674 \def\stc@verse{\let\\=\@centercr
1675   \list{}{\itemsep\z@\itemindent \z@\listparindent \itemindent
1676           \leftmargin\stcindent
1677           \rightmargin\leftmargin}\item[]}
1678 \def\endstc@verse{\nopagebreak[4]\endlist}
1679
1680 % this command must be used after \section
1681 % if you need a secttoc (no automatic secttoc)
1682 \def\secttoc{\@ifnextchar[{\secttoc@}{\secttoc@[d]}}
1683
1684 \def\secttoc@[#1]{%
1685         \relax\begin{samepage}% we begin a local group here, using samepage
1686         \if #1e\let\do@stitc\e@sti
1687         \else\if #1n\let\do@stitc\n@sti
1688         \else\if #1c\let\do@stitc\c@sti
1689         \else\if #1l\let\do@stitc\l@sti
1690         \else\if #1r\let\do@stitc\r@sti
1691         \else\if #1d\let\do@stitc\df@stitc
1692         \fi\fi\fi\fi\fi\fi
1693         \raggedright % added #14
1694         \parskip=\z@%
1695         \reset@font\stcfont%
1696         \parindent=\z@%
1697         \nopagebreak[4]%
1698         \kern-0.8\baselineskip\nopagebreak[4]%
1699         \par\noindent
1700         \ifx\stc@rule\relax
1701         \begin{tabular}{@{}p{\columnwidth}@{}}
1702         {\reset@font\stifont\do@stitc{\mtc@v\stctitle}}\\
1703         \end{tabular}\else
1704         \begin{tabular}{@{}p{\columnwidth}@{}}
1705         {\reset@font\stifont\do@stitc{\mtc@v\stctitle}}\\\hline
1706         \end{tabular}\fi
1707         \nopagebreak[4]\null\leavevmode\vrule width \z@
1708         height \z@ depth \z@\\\@BBR%
1709         \leftmargin\stcindent
1710         \rightmargin\stcindent
1711         \itemindent=\z@\labelwidth=\z@%
1712         \labelsep=\z@\listparindent=\z@%
1713         \begin{stc@verse}\c@tocdepth=\c@secttocdepth%
1714         \leavevmode\\\@BBR% this blank line is necessary to avoid
1715                 % a wild negative indentation
1716         \vskip -.5\baselineskip
1717 \begingroup
1718   \makeatletter
1719   \@ifundefined{stc@pgno}%
1720   {\let\@dottedtocline\@undottedtocline}{}
1721    \gdef\thestc{\arabic{stc}} %23
1722 \@ifundefined{SHORTEXT}%
1723 {\def\@tocfile{stc\thestc}}%  % UNIX
1724 {\def\@tocfile{S\thestc}}%    % MS-DOS
1725   \@input{\jobname.\@tocfile}\if@filesw
1726   \fi%
1727   \global\@nobreakfalse\endgroup
1728         \end{stc@verse}%
1729         \kern0.\baselineskip%
1730         \nopagebreak[4]\stc@rule\null\leavevmode\\%
1731         \vskip-1.0\baselineskip
1732         \vrule width \z@ height \z@
1733         depth \z@\end{samepage}% %## the \\ is essential
1734         \par\pagebreak[1]\vspace*{-1ex}}%
1735         % some space under the secttoc
1736
1737 % this command must be used after \section
1738 % if you need a sectlof (no automatic sectlof)
1739 \def\sectlof{\@ifnextchar[{\sectlof@}{\sectlof@[d]}}
1740
1741 \def\sectlof@[#1]{%
1742         \relax\begin{samepage}% we begin a local group here, using samepage
1743         \if #1e\let\do@stilf\e@sti
1744         \else\if #1n\let\do@stilf\n@sti
1745         \else\if #1c\let\do@stilf\c@sti
1746         \else\if #1l\let\do@stilf\l@sti
1747         \else\if #1r\let\do@stilf\r@sti
1748         \else\if #1d\let\do@stilf\df@stilf
1749         \fi\fi\fi\fi\fi\fi
1750         \raggedright % added #14
1751         \parskip=\z@%
1752         \reset@font\slffont%
1753         \parindent=\z@%
1754         \nopagebreak[4]%
1755         \kern-0.8\baselineskip\nopagebreak[4]%
1756         \par\noindent
1757         \ifx\stc@rule\relax % correction 07Nov94 v23
1758         \begin{tabular}{@{}p{\columnwidth}@{}}
1759         {\reset@font\stifont\do@stilf{\mtc@v\slftitle}}\\
1760         \end{tabular}\else
1761         \begin{tabular}{@{}p{\columnwidth}@{}}
1762         {\reset@font\stifont\do@stilf{\mtc@v\slftitle}}\\\hline
1763         \end{tabular}\fi
1764         \nopagebreak[4]\null\leavevmode\vrule width \z@
1765         height \z@ depth \z@\\\@BBR%
1766         \leftmargin\stcindent
1767         \rightmargin\stcindent
1768         \itemindent=\z@\labelwidth=\z@%
1769         \labelsep=\z@\listparindent=\z@%
1770         % depth does not matter for sectlof
1771         \begin{stc@verse}%\c@tocdepth=\c@secttocdepth%
1772         \leavevmode\\\@BBR% this blank line is necessary to avoid
1773                 % a wild negative indentation
1774         \vskip -.5\baselineskip
1775 \begingroup
1776   \makeatletter
1777   \@ifundefined{slf@pgno}%
1778   {\let\@dottedtocline\@undottedtocline}{}
1779    \gdef\thestc{\arabic{stc}} %23
1780 \@ifundefined{SHORTEXT}%
1781 {\def\@tocfile{slf\thestc}}%  % UNIX
1782 {\def\@tocfile{H\thestc}}%    % MS-DOS
1783   \@input{\jobname.\@tocfile}\if@filesw
1784   \fi%
1785   \global\@nobreakfalse\endgroup
1786         \end{stc@verse}%
1787         \kern0.\baselineskip%
1788         \nopagebreak[4]\stc@rule\null\leavevmode\\%
1789         \vskip-1.0\baselineskip
1790         \vrule width \z@ height \z@
1791         depth \z@\end{samepage}% %## the \\ is essential
1792         \par\pagebreak[1]\vspace*{-1ex}}%
1793         % some space under the secttoc
1794
1795 % Added in version #13
1796 % this command must be used after \section
1797 % if you need a sectlot (no automatic sectlot)
1798 \def\sectlot{\@ifnextchar[{\sectlot@}{\sectlot@[d]}}
1799
1800 \def\sectlot@[#1]{%
1801         \relax\begin{samepage}% we begin a local group here, using samepage
1802         \if #1e\let\do@stilt\e@sti
1803         \else\if #1n\let\do@stilt\n@sti
1804         \else\if #1c\let\do@stilt\c@sti
1805         \else\if #1l\let\do@stilt\l@sti
1806         \else\if #1r\let\do@stilt\r@sti
1807         \else\if #1d\let\do@stilt\df@stilt
1808         \fi\fi\fi\fi\fi\fi
1809         \raggedright % added #14
1810         \parskip=\z@%
1811         \reset@font\sltfont%
1812         \parindent=\z@%
1813         \nopagebreak[4]%
1814         \kern-0.8\baselineskip\nopagebreak[4]%
1815         \par\noindent
1816         \ifx\stc@rule\relax
1817         \begin{tabular}{@{}p{\columnwidth}@{}}
1818         {\reset@font\stifont\do@stilt{\mtc@v\slttitle}}\\
1819         \end{tabular}\else
1820         \begin{tabular}{@{}p{\columnwidth}@{}}
1821         {\reset@font\stifont\do@stilt{\mtc@v\slttitle}}\\\hline
1822         \end{tabular}\fi
1823         \nopagebreak[4]\null\leavevmode\vrule width \z@
1824         height \z@ depth \z@\\\@BBR%
1825         \leftmargin\stcindent
1826         \rightmargin\stcindent
1827         \itemindent=\z@\labelwidth=\z@%
1828         \labelsep=\z@\listparindent=\z@%
1829         % depth does not matter for sectlot
1830         \begin{stc@verse}%\c@tocdepth=\c@secttocdepth%
1831         \leavevmode\\\@BBR% this blank line is necessary to avoid
1832                 % a wild negative indentation
1833         \vskip -.5\baselineskip
1834 \begingroup
1835   \makeatletter
1836   \@ifundefined{slt@pgno}%
1837   {\let\@dottedtocline\@undottedtocline}{}
1838     \gdef\thestc{\arabic{stc}}
1839 \@ifundefined{SHORTEXT}%
1840 {\def\@tocfile{slt\thestc}}%  % UNIX
1841 {\def\@tocfile{V\thestc}}%    % MS-DOS
1842   \@input{\jobname.\@tocfile}\if@filesw
1843   \fi%
1844   \global\@nobreakfalse\endgroup
1845         \end{stc@verse}%
1846         \kern0.\baselineskip%
1847         \nopagebreak[4]\stc@rule\null\leavevmode\\%
1848         \vskip-1.0\baselineskip
1849         \vrule width \z@ height \z@
1850         depth \z@\end{samepage}% %## the \\ is essential
1851         \par\pagebreak[1]\vspace*{-1ex}}%
1852         % some space under the secttoc
1853
1854 % I use a depth of 10000 to inhibit the printing of
1855 % that contentsline.
1856 \def\l@xsect{\@dottedtocline{\@M}{1.0em}{2.3em}}
1857 \def\l@schapter{\@dottedtocline{1}{1.0em}{2.3em}}
1858
1859 \def\xsect{xsect}
1860 \def\schapter{schapter}
1861
1862 \let\sv@sect\@sect
1863 \gdef\@sect#1#2#3#4#5#6[#7]#8{%
1864 \ifnum #2=1
1865 \addcontentsline{lof}{xsect}{#7}%
1866 \addcontentsline{lot}{xsect}{#7}%
1867 \fi
1868 \sv@sect{#1}{#2}{#3}{#4}{#4}{#5}{#6}[{#7}]{#8}}
1869
1870 \def\@sect#1#2#3#4#5#6[#7]#8{
1871 \expandafter
1872 \ifx\csname #1\endcsname\section\relax % ADDED
1873 \addcontentsline{lof}{xsect}{#7}%        ADDED
1874 \addcontentsline{lot}{xsect}{#7}%        ADDED
1875 \fi                             %        ADDED
1876 \ifx\csname #1\endcsname\starsection\relax % ADDED v25
1877 \addcontentsline{lof}{xsect}{#7}%        ADDED v25
1878 \addcontentsline{lot}{xsect}{#7}%        ADDED v25
1879 \fi                             %        ADDED v25
1880 \ifnum #2>\c@secnumdepth
1881      \let\@svsec\@empty\else
1882      \refstepcounter{#1}\edef\@svsec{\csname the#1\endcsname\hskip 1em}\fi
1883      \@tempskipa #5\relax
1884       \ifdim \@tempskipa>\z@
1885         \begingroup #6\relax
1886           \@hangfrom{\hskip #3\relax\@svsec}{\interlinepenalty \@M #8\par}%
1887         \endgroup
1888        \csname #1mark\endcsname{#7}\addcontentsline
1889          {toc}{#1}{\ifnum #2>\c@secnumdepth \else
1890                       \protect\numberline{\csname the#1\endcsname}\fi
1891                     #7}\else
1892         \def\@svsechd{#6\hskip #3\relax  %% \relax added 2 May 90
1893                    \@svsec #8\csname #1mark\endcsname
1894                       {#7}\addcontentsline
1895                            {toc}{#1}{\ifnum #2>\c@secnumdepth \else
1896                              \protect\numberline{\csname the#1\endcsname}\fi
1897                        #7}}\fi
1898      \@xsect{#5}}
1899
1900 % tricky code to deal with \section*
1901 \let\stc@ssect\@ssect
1902 \def\@ssect{%
1903 \addtocontents{toc}{\protect\sectend}\stc@ssect%
1904 }
1905 \def\@ssect{%
1906 \addtocontents{toc}{\protect\sectbegin}\stc@ssect%
1907 }
1908 \let\sectend\relax
1909 \let\sectbegin\relax
1910
1911 \let\appendixmtc\relax
1912
1913 % this command extracts info from the .toc file
1914 % and create the .stcN files (.stc -> .S on MS-DOS)
1915 \def\@dosecttoc#1{{%
1916   \makeatletter
1917   \setcounter{stc}{0} % START VALUE
1918   \STC@next#1.toc\relax\\}\setcounter{stc}{0}} %23: raz
1919 % this command extracts info from the .lof file
1920 % and create the .slfN files (.slf -> .H on MS-DOS)
1921 \def\@dosectlof#1{{%
1922   \makeatletter
1923   \setcounter{stc}{0} % START VALUE
1924   \SLF@next#1.lof\relax\\}\setcounter{stc}{0}} %23: raz
1925 % this command extracts info from the .lot file
1926 % and create the .sltN files (.slt -> .V on MS-DOS)
1927 \def\@dosectlot#1{{%
1928   \setcounter{stc}{0} % START VALUE
1929   \makeatletter
1930   \SLT@next#1.lot\relax\\}\setcounter{stc}{0}} %23: raz
1931
1932 \def\dosecttoc{\@ifnextchar[{\dosecttoc@}{\dosecttoc@[l]}}
1933 \def\dosectlof{\@ifnextchar[{\dosectlof@}{\dosectlof@[l]}}
1934 \def\dosectlot{\@ifnextchar[{\dosectlot@}{\dosectlot@[l]}}
1935
1936 \def\dosecttoc@[#1]{%
1937 \if #1e\let\df@stitc\e@sti%
1938 \else\if #1n\let\df@stitc\n@sti%
1939 \else\if #1c\let\df@stitc\c@sti%
1940 \else\if #1l\let\df@stitc\l@sti%
1941 \else\if #1r\let\df@stitc\r@sti%
1942 \fi\fi\fi\fi\fi%
1943 \@@dosecttoc}
1944
1945 \def\dosectlof@[#1]{%
1946 \if #1e\let\df@stilf\e@sti%
1947 \else\if #1n\let\df@stilf\n@sti%
1948 \else\if #1c\let\df@stilf\c@sti%
1949 \else\if #1l\let\df@stilf\l@sti%
1950 \else\if #1r\let\df@stilf\r@sti%
1951 \fi\fi\fi\fi\fi%
1952 \@@dosectlof}
1953
1954 \def\dosectlot@[#1]{%
1955 \if #1e\let\df@stilt\e@sti%
1956 \else\if #1n\let\df@stilt\n@sti%
1957 \else\if #1c\let\df@stilt\c@sti%
1958 \else\if #1l\let\df@stilt\l@sti%
1959 \else\if #1r\let\df@stilt\r@sti%
1960 \fi\fi\fi\fi\fi%
1961 \@@dosectlot}
1962
1963 \def\@@dosecttoc{\@dosecttoc{\jobname}\immediate\closeout\tf@mtc}
1964 \def\@@dosectlof{\@dosectlof{\jobname}\immediate\closeout\tf@mtc}
1965 \def\@@dosectlot{\@dosectlot{\jobname}\immediate\closeout\tf@mtc}
1966
1967 \def\STC@next#1\relax#2\\{%
1968   \edef\STC@list{#2}%
1969   \STC@loop{#1}}
1970 \def\STC@toc{%
1971   \ifx\STC@list\@empty\else\expandafter\STC@explist\fi}
1972
1973 \def\STC@contentsline#1#2#3{%
1974   \gdef\thestc{\arabic{stc}}
1975 \expandafter%
1976  \ifx\csname #1\endcsname\section\relax
1977  \stepcounter{stc}% % the stc counter simulates the section counter
1978   \gdef\thestc{\arabic{stc}}
1979 \@ifundefined{SHORTEXT}%
1980 {\typeout{Writing\space\jobname.stc\thestc}%     % UNIX
1981 \def\stcname{\jobname.stc\thestc}}%              % UNIX
1982 {\typeout{Writing\space\jobname.S\thestc}%       % MS-DOS
1983 \def\stcname{\jobname.S\thestc}}%                % MS-DOS
1984  \immediate\closeout\tf@mtc % close current .stcN .stc->.S on MS-DOS
1985  \immediate\openout\tf@mtc=\stcname % open next .stcN (.stc->.S if MS-DOS)
1986  \fi
1987 \expandafter%
1988  \ifx\csname #1\endcsname\subsection\relax
1989      \mtc@toks{\noexpand\leavevmode#2}%
1990      \edef\@tempa{\immediate\write\tf@mtc {%
1991      {\string\reset@font\string\stcSSfont\string\mtc@string%
1992      \string\contentsline{#1}%
1993      {\noexpand\the\mtc@toks}{\string\reset@font\string\stcSSfont%
1994       \space #3}}}}\@tempa
1995  \fi
1996 \expandafter%
1997  \ifx\csname #1\endcsname\subsubsection\relax
1998      \mtc@toks{\noexpand \leavevmode#2}%
1999      \edef\@tempa{\immediate\write\tf@mtc {%
2000      {\string\reset@font\string\stcSSSfont\string\mtc@string%
2001      \string\contentsline{#1}%
2002      {\noexpand\the\mtc@toks}{\string\reset@font\string\stcSSSfont%
2003       \space #3}}}}\@tempa
2004  \fi
2005 \expandafter%
2006  \ifx\csname #1\endcsname\paragraph\relax
2007      \mtc@toks{\noexpand\leavevmode#2}%
2008      \edef\@tempa{\immediate\write\tf@mtc {%
2009      {\string\reset@font\string\stcPfont\string\mtc@string%
2010      \string\contentsline{#1}%
2011      {\noexpand\the\mtc@toks}{\string\reset@font\string\stcPfont%
2012       \space #3}}}}\@tempa
2013  \fi
2014 \expandafter%
2015  \ifx\csname #1\endcsname\subparagraph\relax
2016      \mtc@toks{\noexpand\leavevmode#2}%
2017      \edef\@tempa{\immediate\write\tf@mtc {%
2018      {\string\reset@font\string\stcSPfont\string\mtc@string%
2019      \string\contentsline{#1}%
2020      {\noexpand\the\mtc@toks}{\string\reset@font\string\stcSPfont
2021       \space #3}}}}\@tempa
2022  \fi
2023 % Added v25: \starsection and co.
2024  \ifx\csname #1\endcsname\starsection\relax
2025  \stepcounter{stc}% % the stc counter simulates the section counter
2026   \gdef\thestc{\arabic{stc}}
2027 \@ifundefined{SHORTEXT}%
2028 {\typeout{Writing\space\jobname.stc\thestc}%     % UNIX
2029 \def\stcname{\jobname.stc\thestc}}%              % UNIX
2030 {\typeout{Writing\space\jobname.S\thestc}%       % MS-DOS
2031 \def\stcname{\jobname.S\thestc}}%                % MS-DOS
2032  \immediate\closeout\tf@mtc % close current .stcN .stc->.S on MS-DOS
2033  \immediate\openout\tf@mtc=\stcname % open next .stcN (.stc->.S if MS-DOS)
2034  \fi
2035 \expandafter%
2036  \ifx\csname #1\endcsname\starsubsection\relax
2037      \mtc@toks{\noexpand\leavevmode#2}%
2038      \edef\@tempa{\immediate\write\tf@mtc {%
2039      {\string\reset@font\string\stcSSfont\string\mtc@string%
2040      \string\contentsline{#1}%
2041      {\noexpand\the\mtc@toks}{\string\reset@font\string\stcSSfont%
2042       \space #3}}}}\@tempa
2043  \fi
2044 \expandafter%
2045  \ifx\csname #1\endcsname\starsubsubsection\relax
2046      \mtc@toks{\noexpand \leavevmode#2}%
2047      \edef\@tempa{\immediate\write\tf@mtc {%
2048      {\string\reset@font\string\stcSSSfont\string\mtc@string%
2049      \string\contentsline{#1}%
2050      {\noexpand\the\mtc@toks}{\string\reset@font\string\stcSSSfont%
2051       \space #3}}}}\@tempa
2052  \fi
2053 \expandafter%
2054  \ifx\csname #1\endcsname\starparagraph\relax
2055      \mtc@toks{\noexpand\leavevmode#2}%
2056      \edef\@tempa{\immediate\write\tf@mtc {%
2057      {\string\reset@font\string\stcPfont\string\mtc@string%
2058      \string\contentsline{#1}%
2059      {\noexpand\the\mtc@toks}{\string\reset@font\string\stcPfont%
2060       \space #3}}}}\@tempa
2061  \fi
2062 \expandafter%
2063  \ifx\csname #1\endcsname\starsubparagraph\relax
2064      \mtc@toks{\noexpand\leavevmode#2}%
2065      \edef\@tempa{\immediate\write\tf@mtc {%
2066      {\string\reset@font\string\stcSPfont\string\mtc@string%
2067      \string\contentsline{#1}%
2068      {\noexpand\the\mtc@toks}{\string\reset@font\string\stcSPfont
2069       \space #3}}}}\@tempa
2070  \fi
2071 }
2072
2073 \def\STC@explist{\expandafter\STC@next\STC@list\\}
2074 \def\STC@loop#1{\openin\@inputcheck#1\relax
2075   \ifeof\@inputcheck
2076     \typeout{^^JNo file #1^^JSECTTOCS NOT PREPARED.^^J}%
2077     \expandafter\STC@toc
2078   \else
2079     \typeout{PREPARING SECTTOCS FROM #1}%
2080     \expandafter\STC@read\fi}
2081 \def\STC@read{%
2082   \read\@inputcheck to\STC@line
2083   \expandafter\STC@test\STC@line....\STC@%
2084   }%
2085 \long\def\STC@test#1#2#3#4#5\STC@{%
2086   \ifx#1\contentsline
2087     \let\mtc@string\string
2088     \STC@contentsline{#2}{#3}{#4}%
2089     \let\mtc@string\relax
2090   \else\ifx#1\@input
2091      \edef\STC@list{\STC@list#2\relax}%
2092   \else\ifx#1\sectend % \section* closes .stcN (.stc->.S on MS-DOS)
2093      \immediate\closeout\tf@mtc
2094      \immediate\openout\tf@mtc=\jobname.bmt % and opens a scratch file
2095   \else\ifx#1\sectbegin
2096      \addtocounter{stc}{-1}% % \section* has done a parasite increment
2097   \fi\fi\fi\fi
2098   \ifeof\@inputcheck\expandafter\STC@toc
2099   \else\expandafter\STC@read\fi}%
2100
2101 \def\SLF@next#1\relax#2\\{%
2102   \edef\SLF@list{#2}%
2103   \SLF@loop{#1}}
2104 \def\SLF@lof{%
2105   \ifx\SLF@list\@empty\else\expandafter\SLF@explist\fi}
2106
2107 \def\SLF@contentsline#1#2#3{%
2108   \gdef\thestc{\arabic{stc}}
2109 \expandafter%
2110  \ifx\csname #1\endcsname\xsect\relax
2111  \stepcounter{stc}% % the stc counter simulates the section counter
2112   \gdef\thestc{\arabic{stc}}
2113 \@ifundefined{SHORTEXT}%
2114 {\typeout{Writing\space\jobname.slf\thestc}%     % UNIX
2115 \def\slfname{\jobname.slf\thestc}}%              % UNIX
2116 {\typeout{Writing\space\jobname.G\thestc}%       % MS-DOS
2117 \def\slfname{\jobname.H\thestc}}%                % MS-DOS
2118  \immediate\closeout\tf@mtc % close current .slfN .slf->.H on MS-DOS
2119  \immediate\openout\tf@mtc=\slfname % open next .slfN (.slf->.H if MS-DOS)
2120  \fi
2121 \expandafter% % extracts and writes info for sections, etc.
2122  \ifx\csname #1\endcsname\figure\relax
2123      \mtc@toks{\noexpand\leavevmode#2}%
2124      \edef\@tempa{\immediate\write\tf@mtc {%
2125      {\string\reset@font\string\slffont\string\mtc@string%
2126      \string\contentsline{#1}%
2127      {\noexpand\the\mtc@toks}{\string\reset@font\string\slffont%
2128       \space #3}}}}\@tempa
2129  \fi
2130 }
2131
2132 \def\SLF@explist{\expandafter\SLF@next\SLF@list\\}
2133 \def\SLF@loop#1{\openin\@inputcheck#1\relax
2134   \ifeof\@inputcheck
2135     \typeout{^^JNo file #1^^JSECTLOFS NOT PREPARED.^^J}%
2136     \expandafter\SLF@lof
2137   \else
2138     \typeout{PREPARING SECTLOFS FROM #1}%
2139     \expandafter\SLF@read\fi}
2140 \def\SLF@read{%
2141   \read\@inputcheck to\SLF@line
2142   \expandafter\SLF@test\SLF@line....\SLF@%
2143   }%
2144 \long\def\SLF@test#1#2#3#4#5\SLF@{%
2145   \ifx#1\contentsline
2146     \let\mtc@string\string
2147     \SLF@contentsline{#2}{#3}{#4}%
2148     \let\mtc@string\relax
2149   \else\ifx#1\@input
2150      \edef\SLF@list{\SLF@list#2\relax}%
2151   \else\ifx#1\sectend % \section* closes .slfN (.slf->.H on MS-DOS)
2152      \immediate\closeout\tf@mtc
2153      \immediate\openout\tf@mtc=\jobname.bmt % and opens a scratch file
2154   \else\ifx#1\sectbegin
2155      \addtocounter{stc}{-1}% % \section* has done a parasite increment
2156   \fi\fi\fi\fi
2157   \ifeof\@inputcheck\expandafter\SLF@lof
2158   \else\expandafter\SLF@read\fi}%
2159
2160 \def\SLT@next#1\relax#2\\{%
2161   \edef\SLT@list{#2}%
2162   \SLT@loop{#1}}
2163 \def\SLT@lot{%
2164   \ifx\SLT@list\@empty\else\expandafter\SLT@explist\fi}
2165
2166 \def\SLT@contentsline#1#2#3{%
2167   \gdef\thestc{\arabic{stc}}
2168 \expandafter%
2169  \ifx\csname #1\endcsname\xsect\relax
2170  \stepcounter{stc}% % the stc counter simulates the section counter
2171   \gdef\thestc{\arabic{stc}}
2172 \@ifundefined{SHORTEXT}%
2173 {\typeout{Writing\space\jobname.slt\thestc}%     % UNIX
2174 \def\mltname{\jobname.slt\thestc}}%              % UNIX
2175 {\typeout{Writing\space\jobname.V\thestc}%       % MS-DOS
2176 \def\sltname{\jobname.V\thestc}}%                % MS-DOS
2177  \immediate\closeout\tf@mtc % close current .sltN .slt->.V on MS-DOS
2178  \immediate\openout\tf@mtc=\sltname % open next .sltN (.slt->.V if MS-DOS)
2179  \fi
2180 \expandafter% % extracts and writes info for subsections, etc.
2181  \ifx\csname #1\endcsname\table\relax
2182      \mtc@toks{\noexpand\leavevmode#2}%
2183      \edef\@tempa{\immediate\write\tf@mtc {%
2184      {\string\reset@font\string\sltfont\string\mtc@string%
2185      \string\contentsline{#1}%
2186      {\noexpand\the\mtc@toks}{\string\reset@font\string\sltfont%
2187       \space #3}}}}\@tempa
2188  \fi
2189 }
2190
2191 \def\SLT@explist{\expandafter\SLT@next\SLT@list\\}
2192 \def\SLT@loop#1{\openin\@inputcheck#1\relax
2193   \ifeof\@inputcheck
2194     \typeout{^^JNo file #1^^JSECTLOTS NOT PREPARED.^^J}%
2195     \expandafter\SLT@lot
2196   \else
2197     \typeout{PREPARING SECTLOTS FROM #1}%
2198     \expandafter\SLT@read\fi}
2199 \def\SLT@read{%
2200   \read\@inputcheck to\SLT@line
2201   \expandafter\SLT@test\SLT@line....\SLT@%
2202   }%
2203 \long\def\SLT@test#1#2#3#4#5\SLT@{%
2204   \ifx#1\contentsline
2205     \let\mtc@string\string
2206     \SLT@contentsline{#2}{#3}{#4}%
2207     \let\mtc@string\relax
2208   \else\ifx#1\@input
2209      \edef\SLT@list{\SLT@list#2\relax}%
2210   \else\ifx#1\sectend % \section* closes .sltN (.slt->.V on MS-DOS)
2211      \immediate\closeout\tf@mtc
2212      \immediate\openout\tf@mtc=\jobname.bmt % and opens a scratch file
2213   \else\ifx#1\sectbegin
2214      \addtocounter{stc}{-1}% % \section* has done a parasite increment
2215   \fi\fi\fi\fi
2216   \ifeof\@inputcheck\expandafter\SLT@lot
2217   \else\expandafter\SLT@read\fi}%
2218 }}{}
2219
2220 \@ifundefined{section}{}{\let\l@listof\l@section} %v27
2221 \@ifundefined{chapter}{}{\let\l@listof\l@chapter} %v27
2222 \@ifundefined{part}{}{\let\l@starpart\l@part}
2223 \@ifundefined{chapter}{}{\let\l@starchapter\l@chapter}
2224 \@ifundefined{section}{}{\let\l@starsection\l@section}
2225 \@ifundefined{subsection}{}{\let\l@starsubsection\l@subsection}
2226 \@ifundefined{subsubsection}{}{\let\l@starsubsubsection\l@subsubsection}
2227 \@ifundefined{paragraph}{}{\let\l@starparagraph\l@paragraph}
2228 \@ifundefined{subparagraph}{}{\let\l@starsubparagraph\l@subparagraph}
2229
2230 \def\noptcrule{\let\ptc@rule\relax}
2231 \def\nomtcrule{\let\mtc@rule\relax}
2232 \def\nostcrule{\let\stc@rule\relax}
2233 \def\ptcrule{\def\ptc@rule{\kern-3\p@%
2234   \hrule width \columnwidth \kern2.6\p@}} % the \hrule is .4pt high
2235 \def\mtcrule{\def\mtc@rule{\kern-3\p@%
2236   \hrule width \columnwidth \kern2.6\p@}} % the \hrule is .4pt high
2237 \def\stcrule{\def\stc@rule{\kern-3\p@%
2238   \hrule width \columnwidth \kern2.6\p@}} % the \hrule is .4pt high
2239
2240 %%%% Language dependent part
2241 \DeclareOption{american}{\input{english.mld}}
2242 \DeclareOption{austrian}{\input{german.mld}}
2243 \DeclareOption{brazil}{\input{portuges.mld}}
2244 \DeclareOption{breton}{\input{breton.mld}} %v26
2245 \DeclareOption{catalan}{\input{catalan.mld}}
2246 \DeclareOption{croatian}{\input{croatian.mld}}
2247 \DeclareOption{czech}{\input{czech.mld}}
2248 \DeclareOption{danish}{\input{danish.mld}}
2249 \DeclareOption{dutch}{\input{dutch.mld}}
2250 \DeclareOption{english}{\input{english.mld}}
2251 \DeclareOption{esperant}{\input{esperant.mld}} %v26
2252 \DeclareOption{esperanto}{\input{esperant.mld}} %v26
2253 \DeclareOption{finnish}{\input{finnish.mld}}
2254 \DeclareOption{francais}{\input{french.mld}}
2255 \DeclareOption{french}{\input{french.mld}}
2256 \DeclareOption{galician}{\input{galician.mld}}
2257 \DeclareOption{german}{\input{german.mld}}
2258 \DeclareOption{germanb}{\input{germanb.mld}} %v26
2259 \DeclareOption{greek}{\input{greek.mld}} %v26
2260 \DeclareOption{hungarian}{\input{magyar.mld}}
2261 \DeclareOption{irish}{\input{irish.mld}} %v26
2262 \DeclareOption{italian}{\input{italian.mld}}
2263 \DeclareOption{lsorbian}{\input{lsorbian.mld}} %v26
2264 \DeclareOption{magyar}{\input{magyar.mld}}
2265 \DeclareOption{norsk}{\input{norsk.mld}}
2266 \DeclareOption{nynorsk}{\input{nynorsk.mld}} %v25
2267 \DeclareOption{polish}{\input{polish.mld}}
2268 \DeclareOption{portuges}{\input{portuges.mld}}
2269 \DeclareOption{romanian}{\input{romanian.mld}}
2270 %%%%russian not supported \DeclareOption{russian}{\input{russian.mld}}
2271 \DeclareOption{russianb}{\input{russianb.mld}} %v26
2272 \DeclareOption{scottish}{\input{scottish.mld}} %v26
2273 \DeclareOption{slovak}{\input{slovak.mld}}
2274 \DeclareOption{slovene}{\input{slovene.mld}}
2275 \DeclareOption{spanish}{\input{spanish.mld}}
2276 \DeclareOption{swedish}{\input{swedish.mld}}
2277 \DeclareOption{turkish}{\input{turkish.mld}}
2278 \DeclareOption{usorbian}{\input{usorbian.mld}} %v26
2279 \DeclareOption{vietnam}{\input{vietnam.mld}}   %v27
2280 \DeclareOption{vietnamese}{\input{vietnam.mld}}   %v27
2281 \DeclareOption{arab}{\input{arab.mld}}   %v27
2282 \DeclareOption{arabic}{\input{arab.mld}}   %v27
2283 \ExecuteOptions{english} %v27 % default
2284 \ProcessOptions*
2285 %%\languagespecific{russian.dtx}
2286 %%
2287 %% \CharacterTable
2288 %%  {Upper-case    \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
2289 %%   Lower-case    \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
2290 %%   Digits        \0\1\2\3\4\5\6\7\8\9
2291 %%   Exclamation   \!     Double quote  \"     Hash (number) \#
2292 %%   Dollar        \$     Percent       \%     Ampersand     \&
2293 %%   Acute accent  \'     Left paren    \(     Right paren   \)
2294 %%   Asterisk      \*     Plus          \+     Comma         \,
2295 %%   Minus         \-     Point         \.     Solidus       \/
2296 %%   Colon         \:     Semicolon     \;     Less than     \<
2297 %%   Equals        \=     Greater than  \>     Question mark \?
2298 %%   Commercial at \@     Left bracket  \[     Backslash     \\
2299 %%   Right bracket \]     Circumflex    \^     Underscore    \_
2300 %%   Grave accent  \`     Left brace    \{     Vertical bar  \|
2301 %%   Right brace   \}     Tilde         \~}
2302 \endinput
2303 %%
2304 %% End of file `minitoc.sty'.