\def\fileversion{v40}
\def\filedate{2004/12/20}
% minitoc.sty
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Jean-Pierre Drucbert
% ONERA/Toulouse/SRI
% Office national d'\'etudes et de recherches a\'erospatiales
% Centre de Toulouse
% Service r\'eseaux et informatique
% Complexe scientifique de Rangueil
% 2, Avenue \'Edouard Belin
% BP 4025
% F-31055 TOULOUSE CEDEX
% FRANCE
%
% Phone +33-62-25-25-15
%
% Email: drucbert@onecert.fr
%
% Please send me any (constructive) suggestions and comments.

% mtc31hyp.sty (version v31href): (renamed minitoc.sty, version 31 (JPFD))
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Patched by Heiko Oberdiek <oberdiek@ruf.uni-freiburg.de>
% to work with _and_ without hyperref.sty.
% The forth argument of hyperref's \contentsline
% is transparently passed through.
% It uses the patches of v30href (see below).
% Additions and changes are marked with %%HO.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% mtc30hyp.sty (version v30href):
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Patched by Heiko Oberdiek <oberdiek@ruf.uni-freiburg.de>
% to work with hyperref.sty.
% It uses the patches of v28href (see below).
% Additions and changes are marked with %%HO.
% Bug fix: \stepcounter{mtc} removed in
%          starchapter part of \PTC@contentsline.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% minitoc-hyper.sty (version v28href):
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Temporarily patched by Bernd Jaehne [Bernd.Jaehne@aeon.de]
% and Didier Verna [verna@inf.enst.fr] to
% work with hyperref.sty from s.rahtz@elsevier.co.uk
% using input from Tony Roberts [aroberts@usq.edu.au]
% For changes see comments %%BJ and %DV
%
% However: this patch works only when  hyperref.sty is used,
% otherwise errors occur. Thus it may be advisable to add code
% so that minitoc runs both in standard and hyperref mode.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% History (contains some obsolete things... it is NOT
% the REAL documentation)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% minitoc.sty --- redefines the \chapter command to display a
%  mini-table-of-contents at the beginning of every chapter.
%  Oct-90       Original version, by Nigel Ward.
%  Nov-91       Revised to reuse \chapter, \section, \subsection
%               commands transparently, generate toc-file-name
%               automatically,
%               assorted other cleanup.  Dan Jurafsky
%  Jun/Jul-93   New design, to avoid allocating a newwrite
%               for each chapter (!)
%               Added \chapterend to terminate the scope of a minitoc.
%               (IF YOU FORGOT PUTTING \chapterend at the end
%               of EACH chapter, an entry for the next chapter
%               will appear in each minitoc.) (Thanks to Yufan Hu).
%               Replaced ``minipage'' environnement by a ``verse''
%               environnement, to allow a minitoc split across pages.
%               All the layout of the minitoc is in the
%               \minitableofcontents command, so if someboby wants
%               to redefine that layout, he has just to
%               rewrite it (and only it).
%
%               You can inhibit the minitoc for the next chapter
%               by preceding it with \minitocno. (\minitocyes
%               is useless for the user: it is implicit AFTER
%               the \chapter* pseudo-chapters).
%
%               Problems: you MUST have \chapterend to terminate each
%               chapter with a minitoc.
%               How about avoiding this constraint?
%
%               The depth of the minitoc is user-adjustable with
%               the counter `minitocdepth' (as `tocdepth' for the table
%               of contents).
%               At least three passes (3!!!) of LaTeX are necessary to
%               get correct minitoc's (the first pass creates the
%               .mtcX files, the second uses them (but they may
%               contain wrong page numbers) and recreates them,
%               the third should be ok).
%
%               Works with \chapter[xxx]{yyy} and floating bodies.
%               Works with two columns (but the minitoc is composed in
%               one column; how to make it to spread over the two
%               column?)
%               Some mods added to work with xr.sty (external
%               references). xr.sty version 5 is much more tolerant.
%   05Jul93     Version 2
%               Added compatibility with hangcaption.sty (the option
%               hangcaption (if present) must be given BEFORE minitoc
%               option.)
%               BEWARE to options modifying \@caption
%               Version 3 not released (buggy)
%   09Jul93     Version 4
%               Added \if@realch to avoid contentslines from
%               pseudo-chapters to go into the toc!
%               The option file mtcoff.sty allows to use a latex
%               document with minitoc commands and to make them
%               transparent: just replace the minitoc option by
%               mtcoff.
%   13Jul93     Version 5
%               Added a selection mechanism to not write spurious
%               things in the minitoc's.
%   15Jul93     Version 6
%               Fixed problems about chapters in the toc,
%               removed obsolete \caption stuff (filters are better)
%               added compatibility with toch.sty
%               (toch.sty makes a table of chapters. If used,
%               must be loaded BEFORE minitoc.sty)
%   22Jul93     Version 7 (MAJOR DIFFERENCES)
%               Completely rewritten, using tricks from xr.sty
%               (the version 5, by David Carlisle). The info
%               for minitocs is directly stolen from the .toc
%               file.
%               \chapterend and \minitocno are suppressed
%               \minitoc, \dominitoc and \faketableofcontents added
%   29Jul93     Version 8
%               Spacing adjustements.
%   04Aug93     Version 9
%               Added mods for MS-DOS (search MS-DOS, uncomment;
%               search UNIX, comment out). MS-DOS allows only
%               3 characters for extensions in file names
%               (what a pity!).
%   05Aug93     Version 10
%               Works with appendices.
%               Detects obsolete versions of latex.tex.
%               (\@inputcheck or \reset@font not defined).
%   18Aug93     Version 11
%               Added \mtcSfont, font for section entries,
%               \mtcSSfont for subsection entries,
%               \mtcSSSfont for subsubsection entries,
%               \mtcPfont for paragraph entries,
%               \mtcSPfont for subparagraph entries.
%
%   16Dec93     Version 12
%               Use \kern's in place of \vspace*'s,
%               and added penalties (\nopagebreak) to
%               avoid a page break just before last \mtc@rule.
%               Also added a \samepage environnement.
%               Removed old commented out lines from
%               previous versions.
%
%   17Dec93     Version 13
%               Added minilof and minilot stuff.
%               For MS-DOS, uncomment the definition of \SHORTEXT.
%
%   03Jan94     Version 14
%               Corrected space under minitoc/lof/lot and added a
%               \raggedright to avoid ``underfull'' warnings.
%               Corrected some spacing problems (avoiding ~'s).
%               \mtifont changed from \normalsize\bf to
%               \large\bf.
%               Some mods suggested by Donald Arseneau (thanks):
%               \@newread becomes \newread, not outer
%               version of \newread.
%               \empty replaced by \relax in the spare definition
%               of \reset@font.
%               Removed \clubpenalty=10000 and \widowpenalty=10000
%               (done by \samepage), and \noindent.
%               Simplified processing of optional argument in
%               \minitoc, \minilof and \minilot.
%
%   27Jan94     Version 15
%               Added parttoc, partlof and partlot for books,
%               with commands and parameters parallel to
%               those for mini-things.
%
%               Added secttoc, sectlof and sectlot for articles,
%               with commands and parameters parallel to
%               those for mini-things.
%
%   02Feb94     Version 16
%               Bug fixes (typos).
%
%   23Jun94     Version 17
%               Keyword 'n' (null) synonym of 'e' (empty).
%               Compatibility with LaTeX ``2e''.
%               Thanks to Denis Roegel (who found
%               the problem) and Frank Mittelbach
%               (who gave the hints to solve).
%
%   26Jun94     Version 18
%               Make minitoc really compatible with latex2e
%               Introduce the language files as options
%               Thanks to Michel Goossens (via Frank Mittelbach)
%               who was inspired by the code of babel (Johannes Braams).
%
%   16Aug94     Version 19
%               Added stuff for numbering of chapters (parts,
%               sections) not starting at 1.
%               \firstchapteris etc. commands added.
%               \mtcrule, \nomtcrule etc. commands added.
%               Corrected a bug in \c@mti.
%               Corrected mtcswedish.sty (Jan Michel Rynning)
%               Corrected appendix in articles
%
%   25Aug94     Version 20
%               Corrected spacing before and after minitocs
%               and siblings.
%               Added \mtcpagenumbers and \nomtcpagenumbers
%               (and siblings) to make minitocs with/without
%               page numbers. Default: page numbers.
%               Corrected (difficult bug) appendix in articles.
%               Corrected vertical spacing.
%               Corrected a problem with chapters numbered
%               with (uppercase) roman numbers.
%
%   07Sep94     Version 21
%               Corrected typos in minitoc.sty and minitoc.tex.
%
%   10Oct94     Version 22
%               Corrected typos in minitoc.sty.
%
%   08Nov94     Version 23
%               Added a missing line in \sectlof@.
%               Works with document classes resetting
%               chapter (or section) number at each part.
%               (Thanks to Denis Roegel)
%               Removed stuff for \firstchapteris and co.
%               These commands are obsolete.
%               Removed appendix stuff.
%
%   21Dec94     Version 24
%               The \protect commands have been removed from
%               the .toc, .lot and .lot files, so some internal
%               macros have been corrected to be compatible
%               with the LaTeX2e release of December 1994.
%               Thanks to Denis Roegel who did the work.
%
%   13Sep96     Version 25
%               Updated mtcnorsk.sty and added mtcnynorsk.sty
%               on a suggestion from Dag Langmyhr (dag@ifi.uio.no).
%
%   14Nov96     Version 26
%               Language specific commands are now named <language>.mld
%               (in place of mtc<language>.sty) because they are not
%               packages and it makes shorter names.
%               Added breton, estonian, germanb, greek, irish,
%               russianb, scottish, lower and upper sorbian;
%               renamed esperanto by esperant like in Babel.
%
%   20Dec96     Version 27
%               Corrections for starred sectionning commands.
%               english.mld loaded as default language.
%               Added vietnam.mld.
%               Added arab.mld.
%               Renamed minitocoff.sty into mtcoff.sty to
%               keep the name short.
%
%   29Oct97     Version 28
%               Added afrikaan(s) language
%               Added brazil language
%               Added ethiopia(n) language
%               Added autoconfiguration of extensions
%               Added shortext option
%               Added COFFEE stuff
%               Added \addstarred stuff (for starchapter stuff)
%               Fixed bug in parttocs.
%
%   17Nov98     Version 28
%               15Jun98: a typo corrected by Donald Arseneau:
%                 {\let@dottedtocline\@undottedtocline}{}
%               should probably be
%                 {\let\@dottedtocline\@undottedtocline}{}
%                      ^
%                      |
%               Thanks to him.
%
%               Added the bahasa language
%
%   03Dec98     Version 28
%                Added the tight option
%
%   16Mar99     Version 29
%               Added the bicig, buryat, mongol and russianc languages
%   28Jun99     Added the armenian language (from ArmTeX)
%   23Jul99     Added the dotted/undotted options (default: dotted)
%   29Jul99     Added the lithuanian language
%
%   06Dec99     Version 30
%               Added the basque, ngermanb, serbian, ukraineb,
%               and welsh languages.
%               Corrected a bug on \sltname definition (mlt->slt).
%
%   04Avr2000   Version 31
%               Added compatibility with hyperref.sty,
%               thanks to Heiko Oberdiek <oberdiek@ruf.uni-freiburg.de>,
%               who has also simplified some code and fixed the
%               infamous \chapter* bug.
%
%   08Aug2000   Version 32
%               Added commands:
%                     \before|part|toc
%                     \after |    |lof
%                            |    |lot
%               and
%                     \thispagepart|toc|style
%                                  |lof|
%                                  |lot|
%
%               Documentation improved by Stefan Ulrich
%               <ulrich@cis.uni-muenchen.de>.
%
%               \nomtcrule corrected
%
%   07Dec2000   Version 33
%               Added commands:
%                     \mtcadd|chapter|[title]
%                            |section|
%                            |part|
%
%   These commands add stuff in the .toc, .lof and .lot files for
%   the \chapter* (\section* and \part*) problem. From a suggestion
%   by Karl F. Everitt (everitt@chem.skin1.chem.wisc.edu).
%
%   08Dec2000   Version 33
%               Corrected a feature in \mtcaddchapter & co.
%               with a blank optionnal argument.
%
%   13Dec2000b  Version 34
%
%   03Jan2001   Version 35
%   09Jan2001   Added macros to test if a file is ``empty''
%               (i.e. empty, blank or inexistent) or ``non
%               empty'' (i.e. useful).
%               I used some code from Stephan von Bechtolsheim.
%               Added the checkfiles/nocheckfiles options.
%               Replaced \The@chapter by \The@mtc.
%   26Feb2001   Added bulgarian.mld, hebrew.mld,
%               icelandic.mld, latin.mld, samin.mld.
%   09Mar2001   Added \mtcselectlanguage.
%   01Jun2001   Fixed estionian option (missing).
%   04Jul2001   Added interlingua language.
%
%   11Feb2002   Version 36
%   11Feb2002   Corrected an interaction with \tableofcontents
%               which creates a \chapter* or a \section*,
%               perturbing mtc/stc counters (problem signalled
%               by Frank Mittelbach).
%   18Feb2002   Corrected a spacing problem with empty titles
%               (problem signalled by Frank Mittelbach).
%               Workaround for the \parttoc-\chapter*
%               problem.
%   19Feb2002   Added \mtcskip and \mtcskipamount.
%   27Feb2002   Fixed test for empty files.
%   13Mar2002   Added bangla language.
%   15Mar2002   Reduced depth of \mtc@strutbox.
%
%   xxxxxxxxx   Version 37 canceled
%
%   24Jan2003   Version 38
%   24Jan2003   pt -> \p@ and 0pt -> \z@
%   24Jan2003   \hrule and \vrule replaced by \rule (latex)
%   24Jan2003   added \mtc@zrule for zero-dims rules 
%   28Jan2003   added frenchb language (synonym of french)
%   30Jan2003   changed test for empty titles
%   30Jan2003   added options flsection and flsectionb
%   31Jan2003   option tight applies to \parttoc
%               (Thomas Leonhardt leonhardt@informatik.tu-darmstadt.de)
%   07Feb2003   options flsection and flsectionb removed,
%   07Feb2003   replaced by insection option (=flsectionb).
%   11Feb2003   corrected numbering of SLF, SLT
%   20Feb2003   added frenchle and frenchpro languages (synonym of french)
%   20Feb2003   corrected secttocs, at least.
%   18Mar2003   corrected some vertical spacings and struts
%               (I added some mods by Frank Mittelbach, many
%               thanks to him.)
%               A lot of cleaning remains to do, but the
%               release seems to be needed now.

%   09Apr2003  Version 39
%   09Apr2003  modern font commands for
%   09Apr2003  compatibility with the memoir class
%   09Apr2003  \nomtcpagenumbers & memoir class
%   08Jun2004  added \@fileswfalse and \mtc@hook@beforeinputfile for the notoccite package
%              (asked for by Donald Arseneau)
%              added notoccite option (loads the notoccite package)
%   08Sep2004  added language options and .mld files for
%              dialects:
%                canadian (=english)
%                acadian, acadien, canadien (=french)
%                naustrian, ngerman (=ngermanb)
%              added comments in .mld files using special fonts.
%              corrections in the documentation
%              added a paragraph about making a TOC for
%                appendices, not listed in the main TOC.
%   17Sep2004  corrections in the documentation
%              corrections about rules

%   09Dec2004  Version 40
%   09Dec2004  Added japanese language
%   09Dec2004  Added castillan language
%   09Dec2004  Removed the test on the presence of the multicol
%   09Dec2004  package in minitoc.tex, because multicol is
%   09Dec2004  a required package.
%   09Dec2004  Added a figure in minitoc.tex about the need
%   09Dec2004  of 3 compilations.
%   09Dec2004  Added some infos in minitoc.bug.
%   09Dec2004  Added a paragraph about problem with the appendix package.
%   13Dec2004  Updated minitoc.bib.
%   14Dec2004  Added the hints option. This option is still experimental; you advice is welcome.
%   20Dec2004  Added fminitoc.pdf (french documentation in PDF format).
%
%   Jean-Pierre F. Drucbert
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\NeedsTeXFormat{LaTeX2e}[1996/06/01]%
%%% This file will not work with latex2.09
\ProvidesPackage{minitoc}[\filedate\space\fileversion\space
                        Package minitoc, compatible with hyperref]
\typeout{*** minitoc package, version 40 ***}%
%#39 \mtc@hook@beforeinputfile 
\newif\if@mtc@notoccite@ \@mtc@notoccite@false
\@ifundefined{mtc@hook@beforeinputfile}{\let\mtc@hook@beforeinputfile\relax}{}
%#39: look if the memoir class is loaded
\newif\if@mtc@memoirLoaded@ \@mtc@memoirLoaded@false
\@ifclassloaded{memoir}%
   {\@mtc@memoirLoaded@true\relax%
   \typeout{*** the memoir class is loaded: compatibility attempted ***}}%
   {\@mtc@memoirLoaded@false}
%%HO: <begin>
\typeout{*** compatible with hyperref ***}%
\newlength\mtcindent % indentation (left/right) of minitocs
\newskip\mtcskipamount % length of an \mtcskip     %v36-2002/02/19
\setlength{\mtcskipamount}{\bigskipamount}          %v36-2002/02/19
%\def\mtcskip{\removelastskip\vspace\mtcskipamount}  %v36-2002/02/19
\def\mtcskip{{\parskip=\z@\removelastskip\vspace\mtcskipamount}}  %v36-2002/02/22
\AtBeginDocument{%
  \@ifpackageloaded{hyperref}{%
    \def\toclevel@xpart{1000}%
    \def\toclevel@xchapter{1000}%
    \def\toclevel@xsect{1000}%
    \let\toclevel@starchapter\toclevel@chapter
    \let\toclevel@starsection\toclevel@section
    \let\toclevel@starsubsection\toclevel@subsection
    \let\toclevel@starsubsubsection\toclevel@subsubsection
    \let\toclevel@starparagraph\toclevel@paragraph
    \let\toclevel@starsubparagraph\toclevel@subparagraph
  }{}%
}
%%HO: <end>
\@ifundefined{part}{%
}{%
  \typeout{*** part level macros available ***}
  \let\mtc@svspart\@spart %28d
  \def\@spart{\stepcounter{ptc}\mtc@svspart} %28d
  \let\mtc@svpart\@part %23
  \def\@part{%
    \stepcounter{ptc}%
    \mtc@svpart
  }%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% v33 2000/12/08
% Some macros for testing an empty argument.            % v33 2000/12/08
% (from ifmtarg.sty, Peter R. Wilson and                % v33 2000/12/08
%  Donald Arseneau)                                     % v33 2000/12/08
\begingroup                                             % v33 2000/12/08
\catcode`\Q=3                                           % v33 2000/12/08
\long\gdef\mtc@ifmtarg#1{%                              % v33 2000/12/08
\mtc@xifmtarg#1QQ\@secondoftwo\@firstoftwo\@nil}        % v33 2000/12/08
\long\gdef\mtc@xifmtarg#1#2Q#3#4#5\@nil{#4}             % v33 2000/12/08
%\long\gdef\mtc@ifnotmtarg#1{%                          % v36 2002/02/15
%\mtc@xifmtarg#1QQ\@firstofone\@gobble\@nil}            % v36 2002/02/15
\endgroup                                               % v33 2000/12/08
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% v33 2000/12/08
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% v35 2000/01/09
% from while.tip by Stephan von Bechtolsheim           % v35 2000/01/09
% TeX in Practice Tome III p 408--410                  % v35 2000/01/09
% Springer-Verlag 1992   ISBN 3-540-97597-7            % v35 2000/01/09
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% v35 2000/01/09
\let\mtc@EndWhile = \fi                                % v35 2000/01/09
\def\mtc@While #1#2#3\mtc@EndWhile{%                   % v35 2000/01/09
   \def\mtc@WhilePreCondition{#1}%                     % v35 2000/01/09
   \def\mtc@WhileCondition{#2}%                        % v35 2000/01/09
   \def\mtc@WhileBody{#3}%                             % v35 2000/01/09
   \mtc@@While                                         % v35 2000/01/09
}                                                      % v35 2000/01/09
\def\mtc@@While{%                                      % v35 2000/01/09
   \mtc@WhilePreCondition                              % v35 2000/01/09
   \mtc@WhileCondition                                 % v35 2000/01/09
      \def\mtc@WhileNext{%                             % v35 2000/01/09
          \mtc@WhileBody                               % v35 2000/01/09
          \mtc@@While                                  % v35 2000/01/09
      }%                                               % v35 2000/01/09
   \else                                               % v35 2000/01/09
      \def\mtc@WhileNext{}%                            % v35 2000/01/09
   \fi                                                 % v35 2000/01/09
   \mtc@WhileNext                                      % v35 2000/01/09
}                                                      % v35 2000/01/09
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% v35 2000/01/09
% Some macros to test if a file is empty ou not:       % v35 2000/01/09
% \mtc@CkFile{file} returns \@mtc@FEtrue if file       % v35 2000/01/09
% is empty, @mtc@FEfalse if file not empty.            % v35 2000/01/09
% An inexistent file is empty.                         % v35 2000/01/09
% A file full of white space (space, tab, nl)          % v35 2000/01/09
% is empty. Comments are empty.                        % v35 2000/01/09
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% v35 2000/01/09
%\newread\rf\relax                                     % v35 2000/01/09
%Use \@inputcheck                                      % v35 2000/01/09
\newif\if@mtc@LI\@mtc@LItrue                           % v35 2000/01/09
\newif\if@mtc@FE\@mtc@FEtrue                           % v35 2000/01/09
\newif\if@mtc@checkfiles\@mtc@checkfilestrue           % v35 2000/01/09
\def\mtc@Body{\immediate\read\@inputcheck to           % v36 2002/02/27
                                   \mtc@Rline\relax    % v36 2002/02/27
  \ifeof\@inputcheck\relax\@mtc@LIfalse\fi             % v35 2000/01/09
  \expandafter\ifx\mtc@Rline\par\relax                 % v35 2000/01/09
     \def\mtc@Rline{}                                  % v35 2000/01/09
  \else                                                % v35 2000/01/09
     \ifeof\@inputcheck\relax\global\@mtc@LIfalse\fi   % v35 2000/01/09
     \mtc@ifmtarg{\mtc@Rline}{\relax}%                 % v35 2000/01/09
              {\@mtc@FEfalse\@mtc@LIfalse}             % v35 2000/01/09
  \fi                                                  % v35 2000/01/09
}                                                      % v35 2000/01/09
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% v35 2000/01/09
\def\mtc@CkFile#1{%                                    % v35 2000/01/09
\@mtc@LItrue\@mtc@FEtrue        % re-init!             % v36 2002/02/27
\if@mtc@checkfiles                                     % v35 2000/01/09
\IfFileExists{#1}{%                                    % v35 2000/01/09
\immediate\openin\@inputcheck #1\relax                 % v36 2002/02/27
\mtc@While{}{\if@mtc@LI\relax}%                        % v35 2000/01/09
   {\mtc@Body}%                                        % v35 2000/01/09
\mtc@EndWhile}%                                        % v35 2000/01/09
{\@mtc@FEtrue}%                                        % v35 2001/01/09
\else                                                  % v35 2001/01/09
\@mtc@FEfalse%                                         % v35 2001/01/09
\fi}                                                   % v35 2000/01/09
\closein\@inputcheck\relax                             % v35 2000/01/09
% Note: on a big empty file, this loop may be          % v35 2000/01/09
% time consuming, but not an eternity (33s for         % v35 2000/01/09
% 1000000 lines on my computer), and the first         % v35 2000/01/09
% no-empty line stops the loop.                        % v35 2000/01/09
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% v35 2000/01/09
\def\mtc@CkStr#1{%                                     % v38 2003/01/30
\immediate\openout\tf@mtc \jobname.bmt                 % v38 2003/01/30
\immediate\write\tf@mtc{#1}%                           % v38 2003/01/30
\immediate\closeout\tf@mtc                             % v38 2003/01/30
\mtc@CkFile{\jobname.bmt}}                             % v38 2003/01/30

\def\mtc@onebackpart{\addtocounter{ptc}{-1}}    % v36-2002/02/11
\def\mtc@onebackchap{\addtocounter{mtc}{-1}}    % v36-2002/02/11
\def\mtc@onebacksect{\addtocounter{stc}{-1}}    % v36-2002/02/11

% Add a \part* and its title in the toc         % v33 2000/12/07
\newcommand{\mtcaddpart}[1][]{%                 % v33 2000/12/07
    \mtc@ifmtarg{#1}{%                          % v33 2000/12/08
    \addcontentsline{toc}{xpart}{}%             % v33 2000/12/07
    }{%                                         % v33 2000/12/08
    \addcontentsline{toc}{part}{#1}%            % v33 2000/12/07
    }                                           % v33 2000/12/08
    \addcontentsline{lof}{xpart}{}%             % v33 2000/12/07
    \addcontentsline{lot}{xpart}{}%             % v33 2000/12/07
    \adjustptc%                                 % v33 2000/12/07
}                                               % v33 2000/12/07
} %23
\@ifundefined{chapter}{%
  \@ifundefined{section}{%
    \typeout{*** no section or chapter level macros available ***}%
    \typeout{*** PLEASE VERIFY YOUR MAIN DOCUMENT CLASS ***}%
  }{%
    \typeout{*** section level macros available ***}%
    % tocs are section*, apply a correction     % v36-2002/02/11
    \let\mtcsv@tableofcontents\tableofcontents  % v36-2002/02/11
    \let\mtcsv@listoffigures\listoffigures      % v38-2003/02/10
    \let\mtcsv@listoftables\listoftables        % v38-2003/02/10
    \def\tableofcontents{\mtcsv@tableofcontents\mtc@onebacksect} % v36
    \def\listoffigures{\mtcsv@listoffigures\mtc@onebacksect} % v38
    \def\listoftables{\mtcsv@listoftables\mtc@onebacksect} % v38
    \let\mtc@svsection\section %23
    \def\section{\stepcounter{stc}\mtc@svsection} %23
    \let\mtc@svss\@ssect %23
%v25 \def\@ssect{\addtocounter{stc}{-1}\mtc@svss} %23
% Add a \section* and its title in the toc      % v33 2000/12/07
\newcommand{\mtcaddsection}[1][]{%              % v33 2000/12/07
    \mtc@ifmtarg{#1}{%                          % v33 2000/12/08
    \addcontentsline{toc}{xsection}{}%          % v33 2000/12/08
    }{%                                         % v33 2000/12/08
    \addcontentsline{toc}{section}{#1}%         % v33 2000/12/07
    }%                                          % v33 2000/12/08
    \addcontentsline{lof}{xsection}{}%          % v33 2000/12/07
    \addcontentsline{lot}{xsection}{}%          % v33 2000/12/07
    \adjuststc%                                 % v33 2000/12/07
}                                               % v33 2000/12/07
  }%
}{%
  \typeout{*** chapter level macros available ***}
%    % tocs are chapter*, apply a correction     % v36-2002/02/11
%    \let\mtcsv@tableofcontents\tableofcontents  % v36-2002/02/11
%    \def\tableofcontents{\mtcsv@tableofcontents\mtc@onebackchap} % v36
  \let\mtc@svchapter\@chapter %23
  \def\@chapter{\stepcounter{mtc}\mtc@svchapter} %23
% Add a \chapter* and its title in the toc      % v33 2000/12/07
\newcommand{\mtcaddchapter}[1][]{%              % v33 2000/12/07
    \mtc@ifmtarg{#1}{%                          % v33 2000/12/08
    \addcontentsline{toc}{xchapter}{}%          % v33 2000/12/07
    }{%                                         % v33 2000/12/08
    \addcontentsline{toc}{chapter}{#1}%         % v33 2000/12/07
    }%                                          % v33 2000/12/08
    \addcontentsline{lof}{xchapter}{}%          % v33 2000/12/07
    \addcontentsline{lot}{xchapter}{}%          % v33 2000/12/07
    \adjustmtc%                                 % v33 2000/12/07
}                                               % v33 2000/12/07
}
\newwrite\tf@mtc  % a file descriptor to write minitocs
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% AUTOCONFIG (v28)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\typeout{*** Autoconfiguration of extensions ***}
\newif\if@longextensions\@longextensionsfalse

%---------------------------------
%The order of the writes is vital!
%---------------------------------
\immediate\openout\tf@mtc \jobname.mtc1
\immediate\write\tf@mtc{\string\@longextensionstrue}
\immediate\closeout\tf@mtc

\immediate\openout\tf@mtc \jobname.mtc
\immediate\write\tf@mtc{\string\@longextensionsfalse}
\immediate\closeout\tf@mtc

\input{\jobname.mtc1}

% Cover our tracks (scratch the files!):
\immediate\openout\tf@mtc \jobname.mtc
\immediate\closeout\tf@mtc

\immediate\openout\tf@mtc \jobname.mtc1
\immediate\closeout\tf@mtc


\if@longextensions
\typeout{*** Long extensions (Unix-like) will be used ***}
\else
\typeout{*** Short extensions (MSDOS-like) will be used ***sight***}
\fi
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% v27 : claim the type of system!
\if@longextensions%
\typeout%
{==> this version is configured for UNIX-like (long extensions) file names.}%
\else
\typeout{==> this version is configured for MSDOS-like (8+3) file names.}
\fi
%
% Option tight: the flag (1998/12/03)
\newif\iftightmtc \tightmtcfalse
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%not outer version of \newread
\def\newread{\alloc@6\read\chardef\sixt@@n}
\@ifundefined{@inputcheck}%
  {\typeout{Your version of latex.tex is obsolete.}%
  \typeout{Trying to continue...}\newread\@inputcheck\relax}{}
\@ifundefined{reset@font}%
  {\typeout{Your version of latex.tex is very obsolete.}%
  \typeout{Trying to continue... crossing fingers.}%
  \let\reset@font\relax}{}

\newtoks\mtc@toks
\def\mtc@string{\relax}
\newbox\mtc@strutbox
% \rule[raise]{W}{H}
%\setbox\mtc@strutbox=\hbox{\rule[1.3ex]{\z@}{2.0ex}}           %v38-2003/01/24
\setbox\mtc@strutbox=\hbox{\rule[1.8ex]{\z@}{2.5ex}}           %v38-2003/01/24
%\setbox\mtc@strutbox=\hbox{\rule[2.1ex]{\z@}{2.8ex}}           %v38-2003/01/24
\def\mtc@strut{\relax\ifmmode\copy\mtc@strutbox\else\unhcopy\mtc@strutbox\fi}
%ESSAISTRUT%\def\mtc@strut{\@finalstrut\@arstrutbox}
\def\mtc@v{\leavevmode%
     \mtc@strut}%ESSAISTRUT%\vphantom{Lp$^{l^l}_{p_p}$}}  % a pseudo-strut ?
\def\mtc@zrule{\rule[\z@]{\z@}{\z@}} % rule with zero depth, width and height %v38-2003/01/24
% \mtc@BBR discourages page breaks
\def\mtc@BBR{\unpenalty\nopagebreak[4]}
% Modified version to ignore the dots and the page number.              % 17b
\def\@undottedtocline#1#2#3#4#5{\ifnum #1>\c@tocdepth \else             % 17b
  \vskip \z@ plus.2\p@                                                  % 17b
  {\leftskip #2\relax \rightskip \@tocrmarg \parfillskip -\rightskip    % 17b
    \parindent #2\relax\@afterindenttrue                                % 17b
   \interlinepenalty\@M                                                 % 17b
   \leavevmode                                                          % 17b
   \@tempdima #3\relax \advance\leftskip \@tempdima \hbox{}%            % 17b
   \hskip -\leftskip                                                    % 17b
    #4\nobreak\hfill \nobreak                                           % 17b
           \null\par}
	   % 17b
	   \fi}                                               % 17b
%%
%
% PB page numbers
%%%%%%%%%
\if@mtc@memoirLoaded@
% if the memoir class is loaded, the definitions are different (#v39)
\def\mtcpagenumbers{%
  \cftpagenumberson{section}
  \cftpagenumberson{subsection}
  \cftpagenumberson{subsubsection}
  \cftpagenumberson{paragraph}
  \cftpagenumberson{subparagraph}}
\def\nomtcpagenumbers{%
  \cftpagenumbersoff{section}
  \cftpagenumbersoff{subsection}
  \cftpagenumbersoff{subsubsection}
  \cftpagenumbersoff{paragraph}
  \cftpagenumbersoff{subparagraph}}
\def\mtcpagenumbers{%
  \cftpagenumberson{section}
  \cftpagenumberson{subsection}
  \cftpagenumberson{subsubsection}
  \cftpagenumberson{paragraph}
  \cftpagenumberson{subparagraph}}
\def\nomtcpagenumbers{%
  \cftpagenumbersoff{section}
  \cftpagenumbersoff{subsection}
  \cftpagenumbersoff{subsubsection}
  \cftpagenumbersoff{paragraph}
  \cftpagenumbersoff{subparagraph}}
%
\def\stcpagenumbers{%
  \cftpagenumberson{subsection}
  \cftpagenumberson{subsubsection}
  \cftpagenumberson{paragraph}
  \cftpagenumberson{subparagraph}}
\def\nostcpagenumbers{%
  \cftpagenumbersoff{subsection}
  \cftpagenumbersoff{subsubsection}
  \cftpagenumbersoff{paragraph}
  \cftpagenumbersoff{subparagraph}}
%
\def\ptcpagenumbers{%
  \cftpagenumberson{chapter}
  \cftpagenumberson{section}
  \cftpagenumberson{subsection}
  \cftpagenumberson{subsubsection}
  \cftpagenumberson{paragraph}
  \cftpagenumberson{subparagraph}}
\def\noptcpagenumbers{%
  \cftpagenumbersoff{chapter}
  \cftpagenumbersoff{section}
  \cftpagenumbersoff{subsection}
  \cftpagenumbersoff{subsubsection}
  \cftpagenumbersoff{paragraph}
  \cftpagenumbersoff{subparagraph}}
%
  \def\mlfpagenumbers{\cftpagenumberson{figure}}
  \def\nomlfpagenumbers{\cftpagenumbersoff{figure}}
  \def\slfpagenumbers{\cftpagenumberson{figure}}
  \def\noslfpagenumbers{\cftpagenumbersoff{figure}}
  \def\plfpagenumbers{\cftpagenumberson{figure}}
  \def\noplfpagenumbers{\cftpagenumbersoff{figure}}
%
  \def\mltpagenumbers{\cftpagenumberson{table}}
  \def\nomltpagenumbers{\cftpagenumbersoff{table}}
  \def\sltpagenumbers{\cftpagenumberson{table}}
  \def\nosltpagenumbers{\cftpagenumbersoff{table}}
  \def\pltpagenumbers{\cftpagenumberson{table}}
  \def\nopltpagenumbers{\cftpagenumbersoff{table}}
\else
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%17b
\def\mtcpagenumbers{\let\mtc@pgno\null}         %17b
\def\nomtcpagenumbers{\let\mtc@pgno\relax}      %17b
\def\stcpagenumbers{\let\stc@pgno\null}         %17b
\def\nostcpagenumbers{\let\stc@pgno\relax}      %17b
\def\ptcpagenumbers{\let\ptc@pgno\null}         %17b
\def\noptcpagenumbers{\let\ptc@pgno\relax}      %17b
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%17b
\def\mlfpagenumbers{\let\mlf@pgno\null}         %17b
\def\nomlfpagenumbers{\let\mlf@pgno\relax}      %17b
\def\slfpagenumbers{\let\slf@pgno\null}         %17b
\def\noslfpagenumbers{\let\slf@pgno\relax}      %17b
\def\plfpagenumbers{\let\plf@pgno\null}         %17b
\def\noplfpagenumbers{\let\plf@pgno\relax}      %17b
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%17b
\def\mltpagenumbers{\let\mlt@pgno\null}         %17b
\def\nomltpagenumbers{\let\mlt@pgno\relax}      %17b
\def\sltpagenumbers{\let\slt@pgno\null}         %17b
\def\nosltpagenumbers{\let\slt@pgno\relax}      %17b
\def\pltpagenumbers{\let\plt@pgno\null}         %17b
\def\nopltpagenumbers{\let\plt@pgno\relax}      %17b
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%17b
\fi
\mtcpagenumbers %default                        %17b
\stcpagenumbers %default                        %17b
\ptcpagenumbers %default                        %17b
\mlfpagenumbers %default                        %17b
\slfpagenumbers %default                        %17b
\plfpagenumbers %default                        %17b
\mltpagenumbers %default                        %17b
\sltpagenumbers %default                        %17b
\pltpagenumbers %default                        %17b
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%32
\let\beforeparttoc\cleardoublepage              %32
\let\beforepartlof\cleardoublepage              %32
\let\beforepartlot\cleardoublepage              %32
\let\afterparttoc\cleardoublepage               %32
\let\afterpartlof\cleardoublepage               %32
\let\afterpartlot\cleardoublepage               %32
\def\thispageparttocstyle{\thispagestyle{empty}}%32
\def\thispagepartlofstyle{\thispagestyle{empty}}%32
\def\thispagepartlotstyle{\thispagestyle{empty}}%32
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%32
% if you don't want a table of contents, but want minitocs,
% you need to create the .toc file, without inputing it
% into your document. This command is a stripped off version
% of \tableofcontents
\def\faketableofcontents{\fake@starttoc{toc}}
% idem for list of figures
\def\fakelistoffigures{\fake@starttoc{lof}}
% idem for list of tables
\def\fakelistoftables{\fake@starttoc{lot}}
\def\fake@starttoc#1{\begingroup
  \makeatletter
  \if@filesw \expandafter\newwrite\csname tf@#1\endcsname
             \immediate\openout \csname tf@#1\endcsname \jobname.#1\relax
  \fi \global\@nobreakfalse \endgroup%
  \@ifundefined{c@stc}{}{\setcounter{stc}{0}}% v38-20030207
  }
%%
\global\let\mtc@markboth\markboth
\global\let\@mkboth\markboth
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%v30 starchapters
\def\addst@rred#1#2{%
  \addcontentsline{toc}{star#1}{#2}%
  \@ifundefined{c@ptc}{}{%
    \expandafter\ifx\csname #1\endcsname\part
      \stepcounter{ptc}%
    \fi
  }%
  \@ifundefined{c@mtc}{}{%
    \expandafter\ifx\csname #1\endcsname\chapter
      \stepcounter{mtc}%
    \fi
  }%
  \@ifundefined{c@stc}{}{%
    \expandafter\ifx\csname #1\endcsname\section
      \@ifundefined{chapter}{\stepcounter{stc}}{}%
    \fi
  }%
%%%<ESSAI
%  \@ifundefined{c@mtc}{}{%
%    \expandafter\ifx\csname #1\endcsname\starchapter
%      \stepcounter{mtc}%
%    \fi
%  }%
%  \@ifundefined{c@stc}{}{%
%    \expandafter\ifx\csname #1\endcsname\starsection
%      \@ifundefined{chapter}{\stepcounter{stc}}{}%
%    \fi
%  }%
%%%>ESSAI
}
\@ifundefined{chapter}{%
\gdef\addstarredsection#1{\addst@rred{section}{#1}}
}{%
\def\The@mtc{\arabic{mtc}} %v23 % v35 rename
\def\firstchapteris#1%
  {\typeout{^^JWARNING*** \string\firstchapteris}%
   \typeout{ is an obsolete command^^J}}
\newcounter{mtc}  % counter of minitocs
\setcounter{mtc}{0}
\def\adjustmtc{\stepcounter{mtc}}  %32
\gdef\themtc{\arabic{mtc}}
\newcounter{minitocdepth} % analog to tocdepth, but for minitocs
\setcounter{minitocdepth}{2} % default value
%\def\mtc@rule{\rule[3\p@]{\columnwidth}{.4\p@}\vspace*{2.6\p@}} % the \hrule is .4pt high %v38-2003/01/24 %kern->vspace* v39-2004/09/09
\def\mtc@rule{\kern-3\p@ \hrule \@width\columnwidth \kern2.6\p@} %the \hrule is .4pt high %v39-2004/09/17
%v39-2004/09/17 use \hrule to stay in vmode for the final \kern

\mtcindent=24\p@      % defaut value 
% redefined in #39
% \def\mtcfont{\small\rm}    % font for the minitoc
% \def\mtcSfont{\small\bf}   % font for the minitoc (sections)
% \def\mtcSSfont{\mtcfont}   % font for the minitoc (subsections)
% \def\mtcSSSfont{\mtcfont}  % font for the minitoc (subsubsections)
% \def\mtcPfont{\mtcfont}    % font for the minitoc (paragraphs)
% \def\mtcSPfont{\mtcfont}   % font for the minitoc (subparagraphs)
% \def\mlffont{\mtcfont}     % font for the minilof (figures)
% \def\mltfont{\mtcfont}     % font for the minilot (tables)
% \def\mtifont{\large\bf}    % font for titles
% \def\coffeefont{\small\sl} % font for COFFEE breaks
% in version #39, fonts are fully described, with NFSS:
\def\mtcfont{\small\rmfamily\upshape\mdseries}    % font for the minitoc
\def\mtcSfont{\small\rmfamily\upshape\bfseries}   % font for the minitoc (sections)
\let\mtcSSfont\mtcfont     % font for the minitoc (subsections)
\let\mtcSSSfont\mtcfont    % font for the minitoc (subsubsections)
\let\mtcPfont\mtcfont      % font for the minitoc (paragraphs)
\let\mtcSPfont\mtcfont     % font for the minitoc (subparagraphs)
\let\mlffont\mtcfont       % font for the minilof (figures)
\let\mltfont\mtcfont       % font for the minilot (tables)
\def\mtifont{\large\rmfamily\upshape\bfseries}    % font for titles
\def\coffeefont{\small\rmfamily\slshape\mdseries} % font for COFFEE breaks

% Centering, flushleft, flushright or empty titles.
\def\c@mti#1{\null\hfill #1\hfill\null}
\def\l@mti#1{\null #1\hfill\null}
\def\r@mti#1{\null\hfill #1\null}
% these ones do not work! % v36-2002/02/11
%\def\e@mti#1{\relax}
%\def\n@mti#1{\relax}
% v36-2002/02/11 avoid an ugly blank space (from FMi)
\def\e@mti#1{\vspace{-\baselineskip}} % v36-2002/02/11
\def\n@mti#1{\vspace{-\baselineskip}} % v36-2002/02/11

% Default: titles on left
\let\do@mtitc\l@mti
\let\df@mtitc\l@mti
\let\do@mtilf\l@mti
\let\df@mtilf\l@mti
\let\do@mtilt\l@mti
\let\df@mtilt\l@mti

\def\mtc@verse{\let\\=\@centercr
  \list{}{\itemsep\z@\itemindent \z@\listparindent \itemindent
	  \partopsep\z@ \topsep\z@
  \iftightmtc
          \parsep\z@ % 19981203
  \fi
	  \topsep=1ex % 20030317
          \leftmargin\mtcindent
          \rightmargin\leftmargin}\item[]}
\def\endmtc@verse{\nopagebreak[4]\endlist}

% this command must be used after \chapter
% if you need a minitoc (no automatic minitoc)
\def\minitoc{\@ifnextchar[{\minitoc@}{\minitoc@[d]}}

\def\minitoc@[#1]{%
\if@longextensions
\def\@tocfile{mtc\The@mtc}%  % UNIX
\else
\def\@tocfile{M\The@mtc}%    % MS-DOS
\fi
        \mtc@CkFile{\jobname.\@tocfile}               % v35 2001/01/09
        \if@mtc@FE                                    % v35 2001/01/09
        \typeout{\jobname.\@tocfile\space is empty}   % v35 2001/01/09
        \else                                         % v35 2001/01/09
        \relax\begin{samepage}% we begin a local group here, using samepage
        \if #1e\let\do@mtitc\e@mti
        \else\if #1n\let\do@mtitc\n@mti
        \else\if #1c\let\do@mtitc\c@mti
        \else\if #1l\let\do@mtitc\l@mti
        \else\if #1r\let\do@mtitc\r@mti
        \else\if #1d\let\do@mtitc\df@mtitc
        \fi\fi\fi\fi\fi\fi
%-v36-2002/03/15 We test the emptyness of \mtctitle % DOES NOT WORK YET
% \mtc@ifmtarg{\mtctitle}{\let\do@mtitc\e@mti\relax}{} %-v36-2002/03/15
        \mtc@CkStr{\mtctitle}\if@mtc@FE \let\do@mtitc\e@mti\relax\fi %v38 2003/01/30
        \raggedright % added #14
        \parskip=\z@%
        \reset@font\mtcfont%
        \parindent=\z@%
        \nopagebreak[4]%
        \kern-0.8\baselineskip\nopagebreak[4]%
        \par\noindent %%
        \ifx\mtc@rule\relax
        \begin{tabular}{@{}p{\columnwidth}@{}}
        \reset@font\mtifont\do@mtitc{\mtc@v\mtctitle}\\
        \end{tabular}%
	\else
        \begin{tabular}{@{}p{\columnwidth}@{}}
        \reset@font\mtifont\do@mtitc{\mtc@v\mtctitle}\\\hline
        \end{tabular}%
	\fi
        \nopagebreak[4]\null\leavevmode\mtc@zrule\\\mtc@BBR%
        \leftmargin\mtcindent
        \rightmargin\mtcindent
        \itemindent=\z@\labelwidth=\z@%
        \labelsep=\z@\listparindent=\z@%
        \begin{mtc@verse}\c@tocdepth=\c@minitocdepth%
        \leavevmode\\\mtc@BBR% this blank line is necessary to avoid
                % a wild negative indentation
        \vskip -.5\baselineskip
\begingroup
  \makeatletter
  \@ifundefined{mtc@pgno}%
  {\let\@dottedtocline\@undottedtocline}{}
  \@fileswfalse\mtc@hook@beforeinputfile\@input{\jobname.\@tocfile}
  % v36-2002/02/11 % adjust space under minitocs
  \vspace{-1ex} \vspace{-\baselineskip} % v36-2002/02/11
  \leavevmode\mtc@strut                 % v36-2002/02/11
  \global\@nobreakfalse\endgroup
        \end{mtc@verse}%
%        \kern-1.\baselineskip%
        \kern0.\baselineskip%
        \nopagebreak[4]\mtc@bottom@rule\null\leavevmode\\%
        \vskip-1.0\baselineskip\mtc@zrule
        \end{samepage}% %## the \\ is essential
        \par\pagebreak[1]\vspace*{-1ex}\fi}% %\fi for v35-2001/01/29
\def\mtc@bottom@rule{%\kern-3\p@%
  \ifx\mtc@rule\relax\relax\else  % 2000/08/08 v32 pb \nomtcrule
	\vskip -2.5ex%v38-2003/01/24
        \rule[2.4\p@]{\columnwidth}{.4\p@}\vspace*{2.6\p@}\fi} %v38-2003/01/24 %kern->vspace* v39-2004/09/09
        % some space under the minitoc

% Added in version #13
% this command must be used after \chapter
% if you need a minilof (no automatic minilof)
\def\minilof{\@ifnextchar[{\minilof@}{\minilof@[d]}}

\def\minilof@[#1]{%
\if@longextensions%
\def\@tocfile{mlf\The@mtc}%  % UNIX
\else
\def\@tocfile{F\The@mtc}%    % MS-DOS
\fi
        \mtc@CkFile{\jobname.\@tocfile}               % v35 2001/01/09
        \if@mtc@FE                                    % v35 2001/01/09
        \typeout{\jobname.\@tocfile\space is empty}   % v35 2001/01/09
        \else                                         % v35 2001/01/09
        \relax\begin{samepage}% we begin a local group here, using samepage
        \if #1e\let\do@mtilf\e@mti
        \else\if #1n\let\do@mtilf\n@mti
        \else\if #1c\let\do@mtilf\c@mti
        \else\if #1l\let\do@mtilf\l@mti
        \else\if #1r\let\do@mtilf\r@mti
        \else\if #1d\let\do@mtilf\df@mtilf
        \fi\fi\fi\fi\fi\fi
%-v36-2002/02/15 If \mlftitle is empty, acts like \minilof[e]
%-v36-2002/03/15 We test the emptyness of \mlftitle
%	\mtc@ifmtarg{\mlftitle}{\let\do@mtilf\e@mti\relax}{} %-v36-2002/03/15
        \mtc@CkStr{\mlftitle}\if@mtc@FE \let\do@mtilf\e@mti\relax\fi %v38 2003/01/30
        \raggedright % added #14
        \parskip=\z@%
        \reset@font\mlffont%
        \parindent=\z@%
        \nopagebreak[4]%
        \kern-0.8\baselineskip\nopagebreak[4]%
        \par\noindent
        \ifx\mtc@rule\relax
        \begin{tabular}{@{}p{\columnwidth}@{}}
        \reset@font\mtifont\do@mtilf{\mtc@v\mlftitle}\\
        \end{tabular}%
	\else
        \begin{tabular}{@{}p{\columnwidth}@{}}
        \reset@font\mtifont\do@mtilf{\mtc@v\mlftitle}\\\hline
        \end{tabular}%
	\fi
        \nopagebreak[4]\null\leavevmode\mtc@zrule\\\mtc@BBR%
        \leftmargin\mtcindent
        \rightmargin\mtcindent
        \itemindent=\z@\labelwidth=\z@%
        \labelsep=\z@\listparindent=\z@%
        % depth does not matter for minilof
        \begin{mtc@verse}%\c@tocdepth=\c@minitocdepth%
        \leavevmode\\\mtc@BBR% this blank line is necessary to avoid
                % a wild negative indentation
        \vskip -.5\baselineskip
\begingroup
  \makeatletter
  \@ifundefined{mlf@pgno}%
  {\let\@dottedtocline\@undottedtocline}{}
  \@fileswfalse\mtc@hook@beforeinputfile\@input{\jobname.\@tocfile}
  % v36-2002/02/11 % adjust space under minitocs
  \vspace{-1ex} \vspace{-\baselineskip} % v36-2002/02/11
  \leavevmode\mtc@strut                 % v36-2002/02/11
  \global\@nobreakfalse\endgroup
        \end{mtc@verse}%
        \kern-1.\baselineskip%
%        \kern0.\baselineskip%
        \nopagebreak[4]\mtc@rule\null\leavevmode\\%
        \vskip-1.0\baselineskip\mtc@zrule\end{samepage}% %## the \\ is essential
        \par\pagebreak[1]\vspace*{-1ex}\fi}% %\fi v35-2001/01/09
        % some space under the minilof

% Added in version #13
% this command must be used after \chapter
% if you need a minilot (no automatic minilot)
\def\minilot{\@ifnextchar[{\minilot@}{\minilot@[d]}}

\def\minilot@[#1]{%
\if@longextensions%
\def\@tocfile{mlt\The@mtc}%  % UNIX
\else
\def\@tocfile{T\The@mtc}%    % MS-DOS
\fi
        \mtc@CkFile{\jobname.\@tocfile}               % v35 2001/01/09
        \if@mtc@FE                                    % v35 2001/01/09
        \typeout{\jobname.\@tocfile\space is empty}   % v35 2001/01/09
        \else                                         % v35 2001/01/09
        \relax\begin{samepage}% we begin a local group here, using samepage
        \if #1e\let\do@mtilt\e@mti
        \else\if #1n\let\do@mtilt\n@mti
        \else\if #1c\let\do@mtilt\c@mti
        \else\if #1l\let\do@mtilt\l@mti
        \else\if #1r\let\do@mtilt\r@mti
        \else\if #1d\let\do@mtilt\df@mtilt
        \fi\fi\fi\fi\fi\fi
%-v36-2002/02/15 If \mlttitle is empty, acts like \minilot[e]
%-v36-2002/03/15 We test the emptyness of \mlttitle
%	\mtc@ifmtarg{\mlttitle}{\let\do@mtilt\e@mti\relax}{} %-v36-2002/03/15
        \mtc@CkStr{\mlttitle}\if@mtc@FE \let\do@mtilt\e@mti\relax\fi %v38 2003/01/30
        \raggedright % added #14
        \parskip=\z@%
        \reset@font\mltfont%
        \parindent=\z@%
        \nopagebreak[4]%
        \kern-0.8\baselineskip\nopagebreak[4]%
        \par\noindent
        \ifx\mtc@rule\relax
        \begin{tabular}{@{}p{\columnwidth}@{}}
        \reset@font\mtifont\do@mtilt{\mtc@v\mlttitle}\\
        \end{tabular}%
	\else
        \begin{tabular}{@{}p{\columnwidth}@{}}
        \reset@font\mtifont\do@mtilt{\mtc@v\mlttitle}\\\hline
        \end{tabular}%
	\fi
        \nopagebreak[4]\null\leavevmode\mtc@zrule\\\mtc@BBR%
        \leftmargin\mtcindent
        \rightmargin\mtcindent
        \itemindent=\z@\labelwidth=\z@%
        \labelsep=\z@\listparindent=\z@%
        % depth does not matter for minilot
        \begin{mtc@verse}%\c@tocdepth=\c@minitocdepth%
        \leavevmode\\\mtc@BBR% this blank line is necessary to avoid
                % a wild negative indentation
        \vskip -.5\baselineskip
\begingroup
  \makeatletter
  \@ifundefined{mlt@pgno}%
  {\let\@dottedtocline\@undottedtocline}{}
  \@fileswfalse\mtc@hook@beforeinputfile\@input{\jobname.\@tocfile}
  % v36-2002/02/11 % adjust space under minitocs
  \vspace{-1ex} \vspace{-\baselineskip} % v36-2002/02/11
  \leavevmode\mtc@strut                 % v36-2002/02/11
  \global\@nobreakfalse\endgroup
        \end{mtc@verse}%
        \kern-1.\baselineskip%
%        \kern0.\baselineskip%
        \nopagebreak[4]\mtc@rule\null\leavevmode\\%
        \vskip-1.0\baselineskip\mtc@zrule\end{samepage}% %## the \\ is essential
        \par\pagebreak[1]\vspace*{-1ex}\fi}% %\fi v35-2001/01/09
        % some space under the minilot

% I use a depth of 10000 to inhibit the printing of
% that contentsline.
\def\l@xchapter{\@dottedtocline{\@M}{1em}{2.3em}}
\def\xchapter{xchapter}

\let\sv@chapter\@chapter
\def\@chapter[#1]#2{\sv@chapter[{#1}]{#2}\relax%
\addcontentsline{lof}{xchapter}{#1}%
\addcontentsline{lot}{xchapter}{#1}%
\ignorespaces% %% Added 2000/05/02 (Adam Lewenberg <ahl@uakron.edu>)
}

% tricky code to deal with \chapter*
\let\mtc@schapter\@schapter
\def\@schapter{%
\addtocontents{toc}{\protect\chapterend}\mtc@schapter%
}
\def\@schapter{%
\addtocontents{@@@}{\protect\chapterbegin}\mtc@schapter%
}
\let\chapterend\relax
\let\chapterbegin\relax

%v28b
\@ifundefined{chapter}%
{\@ifundefined{section}{}{\def\addstarredsection#1{\addst@rred{section}{#1}}}}
{\def\addstarredchapter#1{\addst@rred{chapter}{#1}}}
\@ifundefined{part}{}%
{\def\addstarredpart#1{\addst@rred{part}{#1}}}

% for havlick COFFEE
\def\addcoffeeline#1#2#3{%
  \addtocontents{#1}{\protect\coffeeline{#2}{#3}{\null}}}
\def\coffeeline#1{\csname l@#1\endcsname}
\newcommand*\l@coffee{\@Undottedtocline{1}{1.5em}{2.3em}}
\def\@Undottedtocline#1#2#3#4#5{%
  \ifnum #1>\c@tocdepth \else
    \vskip \z@ \@plus.2\p@
    {\leftskip #2\relax \rightskip \@tocrmarg \parfillskip -\rightskip
     \parindent #2\relax\@afterindenttrue
     \interlinepenalty\@M
     \leavevmode
     \@tempdima #3\relax
     \advance\leftskip \@tempdima \null\nobreak\hskip -\leftskip
     {\coffeefont #4}\nobreak
%     \leaders\hbox{$\m@th
%        \mkern \@dotsep mu\hbox{.}\mkern \@dotsep
%        mu$}%
%        \hfill
     \nobreak\null
%     \hb@xt@\@pnumwidth{\hfil\normalfont \normalcolor #5}%
     \par}%
  \fi}

% The same but with the page number
%

\def\@Undottedtoclinep#1#2#3#4#5{%
  \ifnum #1>\c@tocdepth \else
    \vskip \z@ \@plus.2\p@
    {\leftskip #2\relax \rightskip \@tocrmarg \parfillskip -\rightskip
     \parindent #2\relax\@afterindenttrue
     \interlinepenalty\@M
     \leavevmode
     \@tempdima #3\relax
     \advance\leftskip \@tempdima \null\nobreak\hskip -\leftskip
     {#4}\nobreak
%     \leaders\hbox{$\m@th
%        \mkern \@dotsep mu\hbox{.}\mkern \@dotsep
%        mu$}%
        \hfill
     \nobreak\null
     \hb@xt@\@pnumwidth{\hfil\normalfont \normalcolor #5}%
     \par}%
  \fi}

\let\appendixmtc\relax

%
% Hacks to remove the dots in the minitocs
% Bug fixed 2000/04/26 v31
% about optional argument
%

\newif\ifundottedmtc\undottedmtcfalse
\@ifundefined{chapter}{}{%
\let\sv@minitoc@\minitoc@
\def\minitoc@[#1]{{\ifundottedmtc\let\@dottedtocline\@Undottedtoclinep\fi
\sv@minitoc@[#1]}}
\let\sv@minilof@\minilof@
\def\minilof@[#1]{{\ifundottedmtc\let\@dottedtocline\@Undottedtoclinep\fi
\sv@minilof@[#1]}}
\let\sv@minilot@\minilot@
\def\minilot@[#1]{{\ifundottedmtc\let\@dottedtocline\@Undottedtoclinep\fi
\sv@minilot@[#1]}}}

\@ifundefined{part}{}{%
\let\sv@parttoc@\parttoc@
\def\parttoc@[#1]{{\ifundottedmtc\let\@dottedtocline\@Undottedtoclinep\fi
\sv@parttoc@[#1]}}
\let\sv@partlof@\partlof@
\def\partlof@[#1]{{\ifundottedmtc\let\@dottedtocline\@Undottedtoclinep\fi
\sv@partlof@[#1]}}
\let\sv@partlot@\partlot@
\def\partlot@[#1]{{\ifundottedmtc\let\@dottedtocline\@Undottedtoclinep\fi
\sv@partlot@[#1]}}}


\@ifundefined{chapter}{%
\@ifundefined{section}{}{%
\let\sv@secttoc@\secttoc@
\def\secttoc@[#1]{{\ifundottedmtc\let\@dottedtocline\@Undottedtoclinep\fi
\sv@secttoc@[#1]}}
\let\sv@sectlof@\sectlof@
\def\sectlof@[#1]{{\ifundottedmtc\let\@dottedtocline\@Undottedtoclinep\fi
\sv@sectlof@[#1]}}
\let\sv@sectlot@\sectlot@
\def\sectlot@[#1]{{\ifundottedmtc\let\@dottedtocline\@Undottedtoclinep\fi
\sv@sectlot@[#1]}}}}{}


% this command extracts info from the .toc file
% and create the .mtcN files (.mtc -> .M on MS-DOS)
\def\@dominitoc#1{{%
  \makeatletter
  \setcounter{mtc}{0} % START VALUE
  \MTC@next#1.toc\relax\\}\setcounter{mtc}{0}} %23: raz
% this command extracts info from the .lof file
% and create the .mlfN files (.mlf -> .F on MS-DOS)
\def\@dominilof#1{{%
  \makeatletter
  \setcounter{mtc}{0} % START VALUE
  \MLF@next#1.lof\relax\\}\setcounter{mtc}{0}} %23: raz
% this command extracts info from the .lot file
% and create the .mltN files (.mlt -> .T on MS-DOS)
\def\@dominilot#1{{%
  \makeatletter
  \setcounter{mtc}{0} % START VALUE
  \MLT@next#1.lot\relax\\}\setcounter{mtc}{0}} %23: raz

\def\dominitoc{\@ifnextchar[{\dominitoc@}{\dominitoc@[l]}}
\def\dominilof{\@ifnextchar[{\dominilof@}{\dominilof@[l]}}
\def\dominilot{\@ifnextchar[{\dominilot@}{\dominilot@[l]}}

\def\dominitoc@[#1]{%
\if #1e\let\df@mtitc\e@mti%
\else\if #1n\let\df@mtitc\n@mti%
\else\if #1c\let\df@mtitc\c@mti%
\else\if #1l\let\df@mtitc\l@mti%
\else\if #1r\let\df@mtitc\r@mti%
\fi\fi\fi\fi\fi%
\@@dominitoc}

\def\dominilof@[#1]{%
\if #1e\let\df@mtilf\e@mti%
\else\if #1n\let\df@mtilf\n@mti%
\else\if #1c\let\df@mtilf\c@mti%
\else\if #1l\let\df@mtilf\l@mti%
\else\if #1r\let\df@mtilf\r@mti%
\fi\fi\fi\fi\fi%
\@@dominilof}

\def\dominilot@[#1]{%
\if #1e\let\df@mtilt\e@mti%
\else\if #1n\let\df@mtilt\n@mti%
\else\if #1c\let\df@mtilt\c@mti%
\else\if #1l\let\df@mtilt\l@mti%
\else\if #1r\let\df@mtilt\r@mti%
\fi\fi\fi\fi\fi%
\@@dominilot}

\def\@@dominitoc{\@dominitoc{\jobname}\immediate\closeout\tf@mtc}
\def\@@dominilof{\@dominilof{\jobname}\immediate\closeout\tf@mtc}
\def\@@dominilot{\@dominilot{\jobname}\immediate\closeout\tf@mtc}

\def\MTC@next#1\relax#2\\{%
  \edef\MTC@list{#2}%
  \MTC@loop{#1}%
}
\def\MTC@toc{%
  \ifx\MTC@list\@empty\else\expandafter\MTC@explist\fi
}


\def\MTC@contentsline#1#2#3#4{% %%HO/BJ: 4 instead of 3 parameters
  \gdef\themtc{\arabic{mtc}}% %%HO: space removed
  \expandafter\ifx\csname #1\endcsname\chapter
    \stepcounter{mtc}% % the mtc counter simulates the chapter counter
    \if@longextensions%
      \typeout{Writing\space\jobname.mtc\themtc}%     % UNIX
      \def\mtcname{\jobname.mtc\themtc}%              % UNIX
    \else
      \typeout{Writing\space\jobname.M\themtc}%       % MS-DOS
      \def\mtcname{\jobname.M\themtc}%                % MS-DOS
    \fi
    \immediate\closeout\tf@mtc % close current .mtcN .mtc->.M on MS-DOS
    \immediate\openout\tf@mtc=\mtcname % open next .mtcN (.mtc->.M if MS-DOS)
  \fi
  \mtc@toks{\noexpand\leavevmode #2}%
% extracts and writes info for sections, etc.
  \expandafter\ifx\csname #1\endcsname\section
    \MTC@WriteContentsline{#1}{mtcS}{#3}{#4}%
  \fi
  \expandafter\ifx\csname #1\endcsname\coffee
    \MTC@WriteCoffeeline{#1}{#3}%
  \fi
  \expandafter\ifx\csname #1\endcsname\subsection
    \MTC@WriteContentsline{#1}{mtcSS}{#3}{#4}%
  \fi
  \expandafter\ifx\csname #1\endcsname\subsubsection
    \MTC@WriteContentsline{#1}{mtcSSS}{#3}{#4}%
  \fi
  \expandafter\ifx\csname #1\endcsname\paragraph
    \MTC@WriteContentsline{#1}{mtcP}{#3}{#4}%
  \fi
  \expandafter\ifx\csname #1\endcsname\subparagraph
    \MTC@WriteContentsline{#1}{mtcSP}{#3}{#4}%
  \fi
% Added v25: \starchapter and co.
% extracts and writes info for sections, etc.
  \expandafter\ifx\csname #1\endcsname\starchapter
    \stepcounter{mtc}% % the mtc counter simulates the chapter counter
    \if@longextensions
      \typeout{Writing\space\jobname.mtc\themtc}%     % UNIX
      \def\mtcname{\jobname.mtc\themtc}%              % UNIX
    \else
      \typeout{Writing\space\jobname.M\themtc}%       % MS-DOS
      \def\mtcname{\jobname.M\themtc}%                % MS-DOS
    \fi
    \immediate\closeout\tf@mtc % close current .mtcN .mtc->.M on MS-DOS
    \immediate\openout\tf@mtc=\mtcname % open next .mtcN (.mtc->.M if MS-DOS)
  \fi
% extracts and writes info for sections, etc.
  \expandafter\ifx\csname #1\endcsname\starsection
    \MTC@WriteContentsline{#1}{mtcS}{#3}{#4}%
  \fi
  \expandafter\ifx\csname #1\endcsname\starsubsection
    \MTC@WriteContentsline{#1}{mtcSS}{#3}{#4}%
  \fi
  \expandafter\ifx\csname #1\endcsname\starsubsubsection
    \MTC@WriteContentsline{#1}{mtcSSS}{#3}{#4}%
  \fi
  \expandafter\ifx\csname #1\endcsname\starparagraph
    \MTC@WriteContentsline{#1}{mtcP}{#3}{#4}%
  \fi
  \expandafter\ifx\csname #1\endcsname\starsubparagraph
    \MTC@WriteContentsline{#1}{mtcSP}{#3}{#4}%
  \fi
}

\def\MTC@explist{\expandafter\MTC@next\MTC@list\\}
\def\MTC@loop#1{\openin\@inputcheck#1\relax
  \ifeof\@inputcheck
    \typeout{^^JNo file #1^^JMINITOCS NOT PREPARED.^^J}%
    \expandafter\MTC@toc
  \else
    \typeout{PREPARING MINITOCS FROM #1}%
    \expandafter\MTC@read
  \fi
}
\def\MTC@read{%
  \read\@inputcheck to\MTC@line
  \expandafter\MTC@test\MTC@line.....\MTC@% %%HO: . added
}%
%%HO/BJ: now patch \MTC@test,
%%HO/BJ: call \MTC@contentsline with 4 instead of 3 parameters
\long\def\MTC@test#1#2#3#4#5#6\MTC@{% %%HO: #6 added
  \ifx#1\contentsline
    \let\mtc@string\string
    \MTC@contentsline{#2}{#3}{#4}{#5}%
    %%HO/BJ: 4. parameter added by Tony Roberts
    \let\mtc@string\relax
  \else\ifx#1\@input
    \edef\MTC@list{\MTC@list#2\relax}%
  \else\ifx#1\chapterend % \chapter* closes .mtcN (.mtc->.M on MS-DOS)
    \immediate\closeout\tf@mtc
    \immediate\openout\tf@mtc=\jobname.bmt % and opens a scratch file
  \else\ifx#1\chapterbegin
    \addtocounter{mtc}{-1}% % \chapter* has done a parasite increment
  \fi\fi\fi\fi
  \ifeof\@inputcheck
    \expandafter\MTC@toc
  \else
    \expandafter\MTC@read
  \fi
}%

\def\MLF@next#1\relax#2\\{%
  \edef\MLF@list{#2}%
  \MLF@loop{#1}}
\def\MLF@lof{%
  \ifx\MLF@list\@empty\else\expandafter\MLF@explist\fi}

\def\MLF@contentsline#1#2#3#4{% %%HO: added #4
  \gdef\themtc{\arabic{mtc}}% %%HO: space removed
  \expandafter\ifx\csname #1\endcsname\xchapter
    \stepcounter{mtc}% % the mtc counter simulates the chapter counter
    \if@longextensions%
      \typeout{Writing\space\jobname.mlf\themtc}%     % UNIX
      \def\mlfname{\jobname.mlf\themtc}%              % UNIX
    \else
      \typeout{Writing\space\jobname.F\themtc}%       % MS-DOS
      \def\mlfname{\jobname.F\themtc}%                % MS-DOS
    \fi
    \immediate\closeout\tf@mtc % close current .mlfN .mlf->.F on MS-DOS
    \immediate\openout\tf@mtc=\mlfname % open next .mlfN (.mlf->.F if MS-DOS)
  \fi
  % extracts and writes info for sections, etc.
  \expandafter\ifx\csname #1\endcsname\figure
    \mtc@toks{\noexpand\leavevmode#2}%
    \MTC@WriteContentsline{#1}{mlf}{#3}{#4}%
  \fi
}

\def\MLF@explist{\expandafter\MLF@next\MLF@list\\}
\def\MLF@loop#1{\openin\@inputcheck#1\relax
  \ifeof\@inputcheck
    \typeout{^^JNo file #1^^JMINILOFS NOT PREPARED.^^J}%
    \expandafter\MLF@lof
  \else
    \typeout{PREPARING MINILOFS FROM #1}%
    \expandafter\MLF@read\fi}
\def\MLF@read{%
  \read\@inputcheck to\MLF@line
  \expandafter\MLF@test\MLF@line.....\MLF@% %%HO: . added
  }%
\long\def\MLF@test#1#2#3#4#5#6\MLF@{% %%HO: #6 added
  \ifx#1\contentsline
    \let\mtc@string\string
    \MLF@contentsline{#2}{#3}{#4}{#5}% %%HO: #4 added
    \let\mtc@string\relax
  \else\ifx#1\@input
     \edef\MLF@list{\MLF@list#2\relax}%
  \else\ifx#1\chapterend % \chapter* closes .mlfN (.mlf->.F on MS-DOS)
     \immediate\closeout\tf@mtc
     \immediate\openout\tf@mtc=\jobname.bmt % and opens a scratch file
  \else\ifx#1\chapterbegin
    \addtocounter{mtc}{-1}% % \chapter* has done a parasite increment
  \fi\fi\fi\fi
  \ifeof\@inputcheck\expandafter\MLF@lof
  \else\expandafter\MLF@read\fi}%

\def\MLT@next#1\relax#2\\{%
  \edef\MLT@list{#2}%
  \MLT@loop{#1}}
\def\MLT@lot{%
  \ifx\MLT@list\@empty\else\expandafter\MLT@explist\fi}

\def\MLT@contentsline#1#2#3#4{% %%HO: #4 added
  \gdef\themtc{\arabic{mtc}}% %%HO: space removed
  \expandafter\ifx\csname #1\endcsname\xchapter
    \stepcounter{mtc}% % the mtc counter simulates the chapter counter
    \if@longextensions%
      \typeout{Writing\space\jobname.mlt\themtc}%     % UNIX
      \def\mltname{\jobname.mlt\themtc}%              % UNIX
    \else
      \typeout{Writing\space\jobname.T\themtc}%       % MS-DOS
      \def\mltname{\jobname.T\themtc}%                % MS-DOS
    \fi
    \immediate\closeout\tf@mtc % close current .mltN .mlt->.T on MS-DOS
    \immediate\openout\tf@mtc=\mltname % open next .mltN (.mlt->.T if MS-DOS)
  \fi
% extracts and writes info for sections, etc.
  \expandafter\ifx\csname #1\endcsname\table
     \mtc@toks{\noexpand\leavevmode#2}%
     \MTC@WriteContentsline{#1}{mlt}{#3}{#4}%
  \fi
}

\def\MLT@explist{\expandafter\MLT@next\MLT@list\\}
\def\MLT@loop#1{\openin\@inputcheck#1\relax
  \ifeof\@inputcheck
    \typeout{^^JNo file #1^^JMINILOTS NOT PREPARED.^^J}%
    \expandafter\MLT@lot
  \else
    \typeout{PREPARING MINILOTS FROM #1}%
    \expandafter\MLT@read\fi}
\def\MLT@read{%
  \read\@inputcheck to\MLT@line
  \expandafter\MLT@test\MLT@line.....\MLT@% %%HO: . added
  }%
\long\def\MLT@test#1#2#3#4#5#6\MLT@{% %%HO: #6 added
  \ifx#1\contentsline
    \let\mtc@string\string
    \MLT@contentsline{#2}{#3}{#4}{#5}% %%HO: #4 added
    \let\mtc@string\relax
  \else\ifx#1\@input
     \edef\MLT@list{\MLT@list#2\relax}%
  \else\ifx#1\chapterend % \chapter* closes .mltN (.mlt->.T on MS-DOS)
     \immediate\closeout\tf@mtc
     \immediate\openout\tf@mtc=\jobname.bmt % and opens a scratch file
  \else\ifx#1\chapterbegin
        \addtocounter{mtc}{-1}% % \chapter* has done a parasite increment
  \fi\fi\fi\fi
  \ifeof\@inputcheck\expandafter\MLT@lot
  \else\expandafter\MLT@read\fi}%
} % end of chapter level

%%HO: new \MTC@WriteContentsline:
%%HO: * makes definition of \MTC@contentsline shorter
%%HO: * extra \edef level removed.
\def\mtc@dot{.}
\def\MTC@WriteContentsline#1#2#3#4{%
  % #1: #1 of \MTC@contentsline
  % #2: font shorthand ==> \csname #2font\endcsname
  % #3: #3 of \MTC@contentsline
  % #4: #4 of \MTC@contentsline
  \def\mtc@param{#4}%
   \immediate\write\tf@mtc{%
    {%
      \string\reset@font
      \expandafter\string\csname #2font\endcsname
      \string\mtc@string
      \string\contentsline{#1}%
      {\the\mtc@toks}%
      {%
        \string\reset@font
        \expandafter\string\csname #2font\endcsname
        \space #3%
      }%
      \ifx\mtc@dot\mtc@param
      \else
        {#4}% %%HO/BJ: #4 is hyperlink
      \fi
    }%
  }%
}
\def\MTC@WriteCoffeeline#1#2#3{%
  % #1: #1 of \MTC@contentsline
  % #2: #3 of \MTC@contentsline
  \immediate\write\tf@mtc{%
    {%
      \string\reset@font
      \string\coffeefont
      \string\mtc@string
%COFFEE \string\textbf{#1}%
      {\the\mtc@toks}%
      {%
        \string\reset@font
        \string\coffeefont
        \space #3%
      }%
    }%
  }%
}

%%%%%%%%%%%%%%%%%%%%%%%%%
%%
% If \part is defined (book or article-like document),
% the following macros are allowed
% Sometimes, we need to make a difference between book and
% article (is \chapter defined?), to have a different layout.
\@ifundefined{part}{}%
{%
\def\xpart{xpart}
\def\ypart{ypart}
\def\Thepart{\arabic{ptc}} %v28c ; that \arabic{part}
\def\firstpartis#1%
  {\typeout{^^JWARNING*** \string\firstpartis}%
   \typeout{ is an obsolete command^^J}}
\newcounter{ptc}  % counter of parttocs
\setcounter{ptc}{0}
\def\adjustptc{\stepcounter{ptc}}  %32
\def\theptc{\arabic{ptc}}
\newcounter{parttocdepth} % analog to tocdepth, but for parttocs
\setcounter{parttocdepth}{2}

\@ifundefined{chapter}{%
\def\ptc@rule{\rule[3\p@]{\columnwidth}{.4\p@}\vspace*{2.6\p@}}% the \hrule is .4pt high  %kern->vspace* v39-2004/09/09
}{\let\ptc@rule\relax} % no rule before/after parttoc/partlof/partlot
                       % for books % declare \ptcrule if you wnat these rules

\newlength\ptcindent % indentation (left/right) of parttocs
\@ifundefined{chapter}{\ptcindent=24\p@}{\ptcindent=\z@} % defaut value

\@ifundefined{chapter}{%
%#v39
\def\ptcfont{\small\rmfamily\upshape\mdseries}    % font for the parttoc
\def\ptcSfont{\small\rmfamily\upshape\bfseries}   % font for the parttoc (sections)
\let\ptcSSfont\ptcfont     % font for the parttoc (subsections)
\let\ptcSSSfont\ptcfont    % font for the parttoc (subsubsections)
\let\ptcPfont\ptcfont      % font for the parttoc (paragraphs)
\let\ptcSPfont\ptcfont     % font for the parttoc (subparagraphs)
\let\plffont\ptcfont       % font for the partlof (figures)
\let\pltfont\ptcfont       % font for the partlot (tables)
\def\ptifont{\Large\rmfamily\upshape\bfseries}    % font for titles
}{%
\def\ptcfont{\normalsize\rmfamily\upshape\mdseries}    % font for the parttoc
\def\ptcCfont{\normalsize\rmfamily\upshape\bfseries}   % font for the parttoc (chapters)
\def\ptcSfont{\normalsize\rmfamily\upshape\mdseries}   % font for the parttoc (sections)
\let\ptcSSfont\ptcfont     % font for the parttoc (subsections)
\let\ptcSSSfont\ptcfont    % font for the parttoc (subsubsections)
\let\ptcPfont\ptcfont      % font for the parttoc (paragraphs)
\let\ptcSPfont\ptcfont     % font for the parttoc (subparagraphs)
\let\plffont\ptcfont       % font for the partlof (figures)
\let\pltfont\ptcfont       % font for the partlot (tables)
\def\ptifont{\Huge\rmfamily\upshape\bfseries}     % font for titles
}

% Centering, flushleft, flushright or empty titles.
\@ifundefined{chapter}{%
\def\c@pti#1{\null\hfill #1\hfill\null}
\def\l@pti#1{\null #1\hfill\null}
\def\r@pti#1{\null\hfill #1\null}
%\def\e@pti#1{\relax}
%\def\n@pti#1{\relax}
% v36-2002/02/11 avoid an ugly blank space (from FMi)
\def\e@pti#1{\vspace{-\baselineskip}} % v36-2002/02/11
\def\n@pti#1{\vspace{-\baselineskip}} % v36-2002/02/11
}{%
%\def\e@pti#1{\relax}
%\def\n@pti#1{\relax}
% v36-2002/02/11 avoid an ugly blank space (from FMi)
\def\e@pti#1{\vspace{-\baselineskip}} % v36-2002/02/11
\def\n@pti#1{\vspace{-\baselineskip}} % v36-2002/02/11
\def\l@pti#1{\if@twocolumn
    \@topnewpage[\@makephead@l{#1}]%
    \else
    \@makephead@l{#1}%
    \@afterheading
    \fi}
\def\@makephead@l#1{%
    \vspace*{50\p@}%
    {\parindent \z@ \raggedright
     \ptifont
     #1\par
     \nobreak
     \vskip 40\p@
    }}
\def\r@pti#1{\if@twocolumn
    \@topnewpage[\@makephead@r{#1}]%
    \else
    \@makephead@r{#1}%
    \@afterheading
    \fi}
\def\@makephead@r#1{%
    \vspace*{50\p@}%
    {\parindent \z@ \raggedleft
     \ptifont
     #1\par
     \nobreak
     \vskip 40\p@
    }}
\def\c@pti#1{\if@twocolumn
    \@topnewpage[\@makephead@c{#1}]%
    \else
    \@makephead@c{#1}%
    \@afterheading
    \fi}
\def\@makephead@c#1{%
    \vspace*{50\p@}%
    {\parindent \z@ \centering
     \ptifont
     #1\par
     \nobreak
     \vskip 40\p@
    }}%
}

% Default: titles on left
\let\do@ptitc\l@pti
\let\df@ptitc\l@pti
\let\do@ptilf\l@pti
\let\df@ptilf\l@pti
\let\do@ptilt\l@pti
\let\df@ptilt\l@pti

\def\ptc@verse{\let\\=\@centercr
  \list{}{\itemsep\z@\itemindent \z@\listparindent \itemindent
  \iftightmtc
	    \parsep\z@ % v38-20030131  % <<<<<<<<<<<<<<< CHANGED
  \fi
          \topsep=1ex % 20030317
          \leftmargin\ptcindent
          \rightmargin\leftmargin}\item[]}
\def\endptc@verse{\nopagebreak[4]\endlist}

% this command must be used after \part
% if you need a parttoc (no automatic parttoc)
\def\parttoc{\@ifnextchar[{\parttoc@}{\parttoc@[d]}}

\def\parttoc@[#1]{%
\if@longextensions%
\def\@tocfile{ptc\Thepart}%  % UNIX
\else
\def\@tocfile{P\Thepart}%    % MS-DOS
\fi
        \mtc@CkFile{\jobname.\@tocfile}               % v35 2001/01/09
        \if@mtc@FE                                    % v35 2001/01/09
        \typeout{\jobname.\@tocfile\space is empty}   % v35 2001/01/09
        \else                                         % v35 2001/01/09
        \@ifundefined{chapter}{}{\beforeparttoc %32 Yannick Michou (corr. typo)
        \global\let\mtc@markboth\markboth
        \global\let\@mkboth\markboth
%        \thispagestyle{empty}
        \thispageparttocstyle %32
        \mtc@markboth{\uppercase{\ptctitle}}{\uppercase{\ptctitle}}%
        }%
        \relax\begin{samepage}% we begin a local group here, using samepage
        \if #1e\let\do@ptitc\e@pti
        \else\if #1n\let\do@ptitc\n@pti
        \else\if #1c\let\do@ptitc\c@pti
        \else\if #1l\let\do@ptitc\l@pti
        \else\if #1r\let\do@ptitc\r@pti
        \else\if #1d\let\do@ptitc\df@ptitc
        \fi\fi\fi\fi\fi\fi
%-v36-2002/02/15 If \ptctitle is empty, acts like \parttoc[e]
%-v36-2002/03/15 We test the emptyness of \ptctitle
%	\mtc@ifmtarg{\ptctitle}{\let\do@ptitc\e@pti\relax}{} %-v36-2002/03/15
        \mtc@CkStr{\ptctitle}\if@mtc@FE \let\do@ptitc\e@pti\relax\fi %v38 2003/01/30
        \raggedright % added #14
        \parskip=\z@%
        \reset@font\ptcfont%
        \parindent=\z@%
        \nopagebreak[4]%
        \kern-0.8\baselineskip\nopagebreak[4]%
        \par\noindent
        \nopagebreak[4]%
        \ifx\ptc@rule\relax
        \begin{tabular}{@{}p{\columnwidth}@{}}
        \reset@font\ptifont\do@ptitc{\mtc@v\ptctitle}\\
        \end{tabular}%
	\else
        \begin{tabular}{@{}p{\columnwidth}@{}}
        \reset@font\ptifont\do@ptitc{\mtc@v\ptctitle}\\\hline
        \end{tabular}%
	\fi
        \nopagebreak[4]\null\leavevmode\mtc@zrule\\\mtc@BBR%
        \leftmargin\ptcindent
        \rightmargin\ptcindent
        \itemindent=\z@\labelwidth=\z@%
        \labelsep=\z@\listparindent=\z@%
        \begin{ptc@verse}\c@tocdepth=\c@parttocdepth%
        \leavevmode\\\mtc@BBR% this blank line is necessary to avoid
                % a wild negative indentation
        \vskip -.5\baselineskip
\begingroup
  \makeatletter
  \@ifundefined{ptc@pgno}%
  {\let\@dottedtocline\@undottedtocline}{}
  \@fileswfalse\mtc@hook@beforeinputfile\@input{\jobname.\@tocfile}
  % v36-2002/02/11 % adjust space under minitocs
  \vspace{-1ex} \vspace{-\baselineskip} % v36-2002/02/11
  \leavevmode\mtc@strut                 % v36-2002/02/11
  \global\@nobreakfalse\endgroup
        \end{ptc@verse}%
        \kern-1.\baselineskip%
%        \kern0.\baselineskip%
        \nopagebreak[4]\ptc@rule\null\leavevmode\\%
        \vskip-1.0\baselineskip\mtc@zrule\end{samepage}% %## the \\ is essential
        \par\@ifundefined{chapter}{\pagebreak[1]\vspace*{-1ex}}%
        {\afterparttoc}\fi}                  %32 %\fi v35-2001/01/09

% this command must be used after \part
% if you need a partlof (no automatic partlof)
\def\partlof{\@ifnextchar[{\partlof@}{\partlof@[d]}}

\def\partlof@[#1]{%
\if@longextensions%
\def\@tocfile{plf\Thepart}%  % UNIX
\else
\def\@tocfile{G\Thepart}%    % MS-DOS
\fi
        \mtc@CkFile{\jobname.\@tocfile}               % v35 2001/01.09
        \if@mtc@FE                                    % v35 2001/01/09
        \typeout{\jobname.\@tocfile\space is empty}   % v35 2001/01/09
        \else                                         % v35 2001/01/09
        \@ifundefined{chapter}{}{\beforepartlof %32
        \global\let\mtc@markboth\markboth
        \global\let\@mkboth\markboth
%        \thispagestyle{empty}
        \thispagepartlofstyle                   %32
        \mtc@markboth{\uppercase{\plftitle}}{\uppercase{\plftitle}}%
        }%
        \relax\begin{samepage}% we begin a local group here, using samepage
        \if #1e\let\do@ptilf\e@pti
        \else\if #1n\let\do@ptilf\n@pti
        \else\if #1c\let\do@ptilf\c@pti
        \else\if #1l\let\do@ptilf\l@pti
        \else\if #1r\let\do@ptilf\r@pti
        \else\if #1d\let\do@ptilf\df@ptilf
        \fi\fi\fi\fi\fi\fi
%-v36-2002/02/15 If \plftitle is empty, acts like \partlof[e]
%-v36-2002/03/15 We test the emptyness of \plftitle
%	\mtc@ifmtarg{\plftitlel}{\let\do@ptilf\e@pti\relax}{} %-v36-2002/03/15
        \mtc@CkStr{\plftitle}\if@mtc@FE \let\do@ptilf\e@pti\relax\fi %v38 2003/01/30
        \raggedright % added #14
        \parskip=\z@%
        \reset@font\plffont%
        \parindent=\z@%
        \nopagebreak[4]%
        \kern-0.8\baselineskip\nopagebreak[4]%
        \par\noindent
        \ifx\ptc@rule\relax
        \begin{tabular}{@{}p{\columnwidth}@{}}
        \reset@font\ptifont\do@ptilf{\mtc@v\plftitle}\\
        \end{tabular}%
	\else
        \begin{tabular}{@{}p{\columnwidth}@{}}
        \reset@font\ptifont\do@ptilf{\mtc@v\plftitle}\\
        \@ifundefined{chapter}{\hline}{}
        \end{tabular}%
	\fi
        \nopagebreak[4]\null\leavevmode\mtc@zrule\\\mtc@BBR%
        \leftmargin\ptcindent
        \rightmargin\ptcindent
        \itemindent=\z@\labelwidth=\z@%
        \labelsep=\z@\listparindent=\z@%
        % depth does not matter for partlof
        \begin{ptc@verse}%\c@tocdepth=\c@parttocdepth%
        \leavevmode\\\mtc@BBR% this blank line is necessary to avoid
                % a wild negative indentation
        \vskip -.5\baselineskip
\begingroup
  \makeatletter
  \@ifundefined{plf@pgno}%
  {\let\@dottedtocline\@undottedtocline}{}
  \@fileswfalse\mtc@hook@beforeinputfile\@input{\jobname.\@tocfile}
  \global\@nobreakfalse\endgroup
        \end{ptc@verse}%
        \kern-1.\baselineskip%
%        \kern0.\baselineskip%
        \nopagebreak[4]\ptc@rule\null\leavevmode\\%
        \vskip-1.0\baselineskip\mtc@zrule\end{samepage}% %## the \\ is essential
        \par\@ifundefined{chapter}{\pagebreak[1]\vspace*{-1ex}}%
        {\afterpartlof}\fi}                   %32 %\fi v35-2001/01/09

% Added in version #13
% this command must be used after \part
% if you need a minilot (no automatic partlot)
\def\partlot{\@ifnextchar[{\partlot@}{\partlot@[d]}}

\def\partlot@[#1]{%
\if@longextensions%
\def\@tocfile{plt\Thepart}%  % UNIX
\else
\def\@tocfile{U\Thepart}%    % MS-DOS
\fi
        \mtc@CkFile{\jobname.\@tocfile}               % v35 2001/01.09
        \if@mtc@FE                                    % v35 2001/01/09
        \typeout{\jobname.\@tocfile\space is empty}   % v35 2001/01/09
        \else                                         % v35 2001/01/09
        \@ifundefined{chapter}{}{\beforepartlot   %32
        \global\let\mtc@markboth\markboth
        \global\let\@mkboth\markboth
%        \thispagestyle{empty}
        \thispagepartlotstyle                     %32
        \mtc@markboth{\uppercase{\plttitle}}{\uppercase{\plttitle}}%
        }%
        \relax\begin{samepage}% we begin a local group here, using samepage
        \if #1e\let\do@ptilt\e@pti
        \else\if #1n\let\do@ptilt\n@pti
        \else\if #1c\let\do@ptilt\c@pti
        \else\if #1l\let\do@ptilt\l@pti
        \else\if #1r\let\do@ptilt\r@pti
        \else\if #1d\let\do@ptilt\df@ptilt
        \fi\fi\fi\fi\fi\fi
%-v36-2002/02/15 If \plttitle is empty, acts like \partlot[e]
%-v36-2002/03/15 We test the emptyness of \plttitle
%	\mtc@ifmtarg{\plttitle}{\let\do@ptilt\e@pti\relax}{} %-v36-2002/03/15
        \mtc@CkStr{\plttitle}\if@mtc@FE \let\do@ptilt\e@pti\relax\fi %v38 2003/01/30
        \raggedright % added #14
        \parskip=\z@%
        \reset@font\pltfont%
        \parindent=\z@%
        \nopagebreak[4]%
        \kern-0.8\baselineskip\nopagebreak[4]%
        \par\noindent
        \ifx\ptc@rule\relax
        \begin{tabular}{@{}p{\columnwidth}@{}}
        \reset@font\ptifont\do@ptilt{\mtc@v\plttitle}\\
        \end{tabular}%
	\else
        \begin{tabular}{@{}p{\columnwidth}@{}}
        \reset@font\ptifont\do@ptilt{\mtc@v\plttitle}\\
        \@ifundefined{chapter}{\hline}{}
        \end{tabular}%
	\fi
        \nopagebreak[4]\null\leavevmode\mtc@zrule\\\mtc@BBR%
        \leftmargin\ptcindent
        \rightmargin\ptcindent
        \itemindent=\z@\labelwidth=\z@%
        \labelsep=\z@\listparindent=\z@%
        % depth does not matter for partlot
        \begin{ptc@verse}%\c@tocdepth=\c@parttocdepth%
        \leavevmode\\\mtc@BBR% this blank line is necessary to avoid
                % a wild negative indentation
        \vskip -.5\baselineskip
\begingroup
  \makeatletter
  \@ifundefined{plt@pgno}%
  {\let\@dottedtocline\@undottedtocline}{}
  \@fileswfalse\mtc@hook@beforeinputfile\@input{\jobname.\@tocfile}
  \global\@nobreakfalse\endgroup
        \end{ptc@verse}%
        \kern-1.\baselineskip%
%        \kern0.\baselineskip%
        \nopagebreak[4]\ptc@rule\null\leavevmode\\%
        \vskip-1.0\baselineskip\mtc@zrule\end{samepage}% %## the \\ is essential
        \par\@ifundefined{chapter}{\pagebreak[1]\vspace*{-1ex}}%
        {\afterpartlot}\fi}                     %32 %\fi v35-2001/01/09

% I use a depth of 10000 to inhibit the printing of
% that contentsline.
\def\l@xpart{\@dottedtocline{\@M}{1.0em}{2.3em}}
\def\l@ypart{\@dottedtocline{0}{1.0em}{2.3em}}
\def\l@pchapter{\@dottedtocline{1}{1.0em}{2.3em}}
\def\l@psection{\@dottedtocline{2}{1.0em}{2.3em}}

\def\pchapter{pchapter}
\def\psection{psection}

%v28d \let\sv@part\@part
\let\sv@part\mtc@svpart %28d
\def\@part[#1]#2{\sv@part[{#1}]{#2}\relax%
\addcontentsline{lof}{xpart}{#1}%
\addcontentsline{lot}{xpart}{#1}%
\addcontentsline{toc}{xpart}{#1}%v28c
\stepcounter{ptc}%
}

%v28d
%\let\sv@spart\mtc@svspart
\let\sv@spart\@spart
\def\@spart{\stepcounter{ptc}\sv@spart}

% tricky code to deal with \part*
\let\ptc@spart\@spart
\def\@spart{%
\addtocontents{toc}{\protect\partend}\ptc@spart%
}
\def\@spart{%
\addtocontents{toc}{\protect\partbegin}\ptc@spart%
}
\let\partend\relax
\let\partbegin\relax

\let\appendixmtc\relax

% this command extracts info from the .toc file
% and create the .ptcN files (.ptc -> .P on MS-DOS)
\def\@doparttoc#1{{%
  \makeatletter
  \setcounter{ptc}{0} % START VALUE
  \PTC@next#1.toc\relax\\}\setcounter{ptc}{0}} %23; raz
% this command extracts info from the .lof file
% and create the .plfN files (.plf -> .G on MS-DOS)
\def\@dopartlof#1{{%
  \makeatletter
  \setcounter{ptc}{0} % START VALUE
  \PLF@next#1.lof\relax\\}\setcounter{ptc}{0}} %23: raz
% this command extracts info from the .lot file
% and create the .pltN files (.plt -> .U on MS-DOS)
\def\@dopartlot#1{{%
  \setcounter{ptc}{0} % START VALUE
  \makeatletter
  \PLT@next#1.lot\relax\\}\setcounter{ptc}{0}} %23: raz

\def\doparttoc{\@ifnextchar[{\doparttoc@}{\doparttoc@[l]}}
\def\dopartlof{\@ifnextchar[{\dopartlof@}{\dopartlof@[l]}}
\def\dopartlot{\@ifnextchar[{\dopartlot@}{\dopartlot@[l]}}

\def\doparttoc@[#1]{%
\if #1e\let\df@ptitc\e@pti%
\else\if #1n\let\df@ptitc\n@pti%
\else\if #1c\let\df@ptitc\c@pti%
\else\if #1l\let\df@ptitc\l@pti%
\else\if #1r\let\df@ptitc\r@pti%
\fi\fi\fi\fi\fi%
\@@doparttoc}

\def\dopartlof@[#1]{%
\if #1e\let\df@ptilf\e@pti%
\else\if #1n\let\df@ptilf\n@pti%
\else\if #1c\let\df@ptilf\c@pti%
\else\if #1l\let\df@ptilf\l@pti%
\else\if #1r\let\df@ptilf\r@pti%
\fi\fi\fi\fi\fi%
\@@dopartlof}

\def\dopartlot@[#1]{%
\if #1e\let\df@ptilt\e@pti%
\else\if #1n\let\df@ptilt\n@pti%
\else\if #1c\let\df@ptilt\c@pti%
\else\if #1l\let\df@ptilt\l@pti%
\else\if #1r\let\df@ptilt\r@pti%
\fi\fi\fi\fi\fi%
\@@dopartlot}

\def\@@doparttoc{\@doparttoc{\jobname}\immediate\closeout\tf@mtc}
\def\@@dopartlof{\@dopartlof{\jobname}\immediate\closeout\tf@mtc}
\def\@@dopartlot{\@dopartlot{\jobname}\immediate\closeout\tf@mtc}

\def\PTC@next#1\relax#2\\{%
  \edef\PTC@list{#2}%
  \PTC@loop{#1}}
\def\PTC@toc{%
  \ifx\PTC@list\@empty\else\expandafter\PTC@explist\fi}

\def\PTC@contentsline#1#2#3#4{% %%HO/DV: 4 instead of 3 parameters
  \expandafter\ifx\csname #1\endcsname\part
    \stepcounter{ptc}% % the ptc counter simulates the part counter
    \if@longextensions%
      \typeout{Writing\space\jobname.ptc\theptc}%     % UNIX
      \def\ptcname{\jobname.ptc\theptc}%              % UNIX
    \else
      \typeout{Writing\space\jobname.P\theptc}%       % MS-DOS
      \def\ptcname{\jobname.P\theptc}%                % MS-DOS
    \fi
    \immediate\closeout\tf@mtc % close current .ptcN .ptc->.P on MS-DOS
    \immediate\openout\tf@mtc=\ptcname % open next .ptcN (.ptc->.P if MS-DOS)
  \fi
%%%%%%%%%%%%%%%%%%%%%%
% v28c: starpart added
%%%%%%%%%%%%%%%%%%%%%%
  \expandafter\ifx\csname #1\endcsname\starpart\relax
    \stepcounter{ptc}% % the ptc counter simulates the part counter
    \if@longextensions%
      \typeout{Writing\space\jobname.ptc\theptc}%     % UNIX
      \def\ptcname{\jobname.ptc\theptc}%              % UNIX
    \else
      \typeout{Writing\space\jobname.P\theptc}%       % MS-DOS
      \def\ptcname{\jobname.P\theptc}%                % MS-DOS
    \fi
    \immediate\closeout\tf@mtc % close current .ptcN .ptc->.P on MS-DOS
    \immediate\openout\tf@mtc=\ptcname % open next .ptcN (.ptc->.P if MS-DOS)
  \fi
%%%%%%%%%%%%%%%%%%%%%%
  \mtc@toks{\noexpand\leavevmode #2}%
% extracts and writes info for chapters, sections, etc.
  \expandafter\ifx\csname #1\endcsname\chapter
    \MTC@WriteContentsline{#1}{ptcC}{#3}{#4}%
  \fi
%19990316
  \expandafter\ifx\csname #1\endcsname\pchapter
    \MTC@WriteContentsline{#1}{ptcC}{#3}{#4}%
  \fi
  \expandafter\ifx\csname #1\endcsname\section
    \MTC@WriteContentsline{#1}{ptcS}{#3}{#4}%
  \fi
  \expandafter\ifx\csname #1\endcsname\coffee
    \MTC@WriteCoffeeline{#1}{#3}%
  \fi
  \expandafter\ifx\csname #1\endcsname\subsection
    \MTC@WriteContentsline{#1}{ptcSS}{#3}{#4}%
  \fi
  \expandafter\ifx\csname #1\endcsname\subsubsection
    \MTC@WriteContentsline{#1}{ptcSSS}{#3}{#4}%
  \fi
  \expandafter\ifx\csname #1\endcsname\paragraph
    \MTC@WriteContentsline{#1}{ptcP}{#3}{#4}%
  \fi
  \expandafter\ifx\csname #1\endcsname\subparagraph
    \MTC@WriteContentsline{#1}{ptcSP}{#3}{#4}%
  \fi
% Added v25: \starchapter & co.
% extracts and writes info for chapters, sections, etc.
% v28a 960123
  \expandafter\ifx\csname #1\endcsname\starchapter
%%HO: the following line should be disabled:
%%    \stepcounter{mtc}% % the mtc counter simulates the chapter counter
    \MTC@WriteContentsline{#1}{ptcC}{#3}{#4}%
  \fi
  \expandafter\ifx\csname #1\endcsname\starsection
    \MTC@WriteContentsline{#1}{ptcS}{#3}{#4}%
  \fi
  \expandafter\ifx\csname #1\endcsname\starsubsection
    \MTC@WriteContentsline{#1}{ptcSS}{#3}{#4}%
  \fi
  \expandafter\ifx\csname #1\endcsname\starsubsubsection
    \MTC@WriteContentsline{#1}{ptcSSS}{#3}{#4}%
  \fi
  \expandafter\ifx\csname #1\endcsname\starparagraph
    \MTC@WriteContentsline{#1}{ptcP}{#3}{#4}%
  \fi
  \expandafter\ifx\csname #1\endcsname\starsubparagraph
    \MTC@WriteContentsline{#1}{ptcSP}{#3}{#4}%
  \fi
}

\def\PTC@explist{\expandafter\PTC@next\PTC@list\\}
\def\PTC@loop#1{\openin\@inputcheck#1\relax
  \ifeof\@inputcheck
    \typeout{^^JNo file #1^^JPARTTOCS NOT PREPARED.^^J}%
    \expandafter\PTC@toc
  \else
    \typeout{PREPARING PARTTOCS FROM #1}%
    \expandafter\PTC@read\fi}
\def\PTC@read{%
  \read\@inputcheck to\PTC@line
  \expandafter\PTC@test\PTC@line.....\PTC@% %%HO: . added
  }%
\long\def\PTC@test#1#2#3#4#5#6\PTC@{% %%HO: #6 added
  \ifx#1\contentsline
    \let\mtc@string\string
    \PTC@contentsline{#2}{#3}{#4}{#5}%
    %%HO/DV: 4 instead of 3 parameters
    \let\mtc@string\relax
  \else\ifx#1\@input
     \edef\PTC@list{\PTC@list#2\relax}%
  \else\ifx#1\partend % \part* closes .ptcN (.ptc->.P on MS-DOS)
     \immediate\closeout\tf@mtc
     \immediate\openout\tf@mtc=\jobname.bmt % and opens a scratch file
  \else\ifx#1\partbegin
     \addtocounter{ptc}{-1}% % \part* has done a parasite increment
  \fi\fi\fi\fi
  \ifeof\@inputcheck\expandafter\PTC@toc
  \else\expandafter\PTC@read\fi}%

\def\PLF@next#1\relax#2\\{%
  \edef\PLF@list{#2}%
  \PLF@loop{#1}}
\def\PLF@lof{%
  \ifx\PLF@list\@empty\else\expandafter\PLF@explist\fi}

\def\PLF@contentsline#1#2#3#4{% %%HO: #4 added
  \expandafter\ifx\csname #1\endcsname\xpart
    \stepcounter{ptc}% % the ptc counter simulates the part counter
    \if@longextensions%
      \typeout{Writing\space\jobname.plf\theptc}%     % UNIX
      \def\plfname{\jobname.plf\theptc}%              % UNIX
    \else
      \typeout{Writing\space\jobname.G\theptc}%       % MS-DOS
      \def\plfname{\jobname.G\theptc}%                % MS-DOS
    \fi
    \immediate\closeout\tf@mtc % close current .plfN .plf->.G on MS-DOS
    \immediate\openout\tf@mtc=\plfname % open next .plfN (.plf->.G if MS-DOS)
  \fi
  \expandafter\ifx\csname #1\endcsname\ypart
    \stepcounter{ptc}% % the ptc counter simulates the part counter
    \if@longextensions%
      \typeout{Writing\space\jobname.plf\theptc}%     % UNIX
      \def\plfname{\jobname.plf\theptc}%              % UNIX
    \else
      \typeout{Writing\space\jobname.G\theptc}%       % MS-DOS
      \def\plfname{\jobname.G\theptc}%                % MS-DOS
    \fi
    \immediate\closeout\tf@mtc % close current .plfN .plf->.G on MS-DOS
    \immediate\openout\tf@mtc=\plfname % open next .plfN (.plf->.G if MS-DOS)
  \fi
% extracts and writes info for sections, etc.
  \expandafter\ifx\csname #1\endcsname\figure
    \mtc@toks{\noexpand\leavevmode#2}%
    \MTC@WriteContentsline{#1}{plf}{#3}{#4}%
  \fi
}

\def\PLF@explist{\expandafter\PLF@next\PLF@list\\}
\def\PLF@loop#1{\openin\@inputcheck#1\relax
  \ifeof\@inputcheck
    \typeout{^^JNo file #1^^JPARTLOFS NOT PREPARED.^^J}%
    \expandafter\PLF@lof
  \else
    \typeout{PREPARING PARTLOFS FROM #1}%
    \expandafter\PLF@read\fi}
\def\PLF@read{%
  \read\@inputcheck to\PLF@line
  \expandafter\PLF@test\PLF@line.....\PLF@% %%HO: . added
  }%
\long\def\PLF@test#1#2#3#4#5#6\PLF@{% %%HO: #6 added
  \ifx#1\contentsline
    \let\mtc@string\string
    \PLF@contentsline{#2}{#3}{#4}{#5}% %%HO: #4 added
    \let\mtc@string\relax
  \else\ifx#1\@input
     \edef\PLF@list{\PLF@list#2\relax}%
  \else\ifx#1\partend % \part* closes .plfN (.plf->.G on MS-DOS)
     \immediate\closeout\tf@mtc
     \immediate\openout\tf@mtc=\jobname.bmt % and opens a scratch file
  \else\ifx#1\partbegin
     \addtocounter{ptc}{-1}% % \part* has done a parasite increment
  \fi\fi\fi\fi
  \ifeof\@inputcheck\expandafter\PLF@lof
  \else\expandafter\PLF@read\fi}%

\def\PLT@next#1\relax#2\\{%
  \edef\PLT@list{#2}%
  \PLT@loop{#1}}
\def\PLT@lot{%
  \ifx\PLT@list\@empty\else\expandafter\PLT@explist\fi}

\def\PLT@contentsline#1#2#3#4{% %%HO: #4 added
  \expandafter\ifx\csname #1\endcsname\xpart
    \stepcounter{ptc}% % the ptc counter simulates the part counter
    \if@longextensions%
      \typeout{Writing\space\jobname.plt\theptc}%     % UNIX
      \def\pltname{\jobname.plt\theptc}%              % UNIX
    \else
      \typeout{Writing\space\jobname.U\theptc}%       % MS-DOS
      \def\pltname{\jobname.U\theptc}%                % MS-DOS
    \fi
    \immediate\closeout\tf@mtc % close current .pltN .plt->.U on MS-DOS
    \immediate\openout\tf@mtc=\pltname % open next .pltN (.plt->.U if MS-DOS)
  \fi
  \expandafter\ifx\csname #1\endcsname\ypart
    \stepcounter{ptc}% % the ptc counter simulates the part counter
    \if@longextensions%
      \typeout{Writing\space\jobname.plt\theptc}%     % UNIX
      \def\pltname{\jobname.plt\theptc}%              % UNIX
    \else
      \typeout{Writing\space\jobname.U\theptc}%       % MS-DOS
      \def\pltname{\jobname.U\theptc}%                % MS-DOS
    \fi
    \immediate\closeout\tf@mtc % close current .pltN .plt->.U on MS-DOS
    \immediate\openout\tf@mtc=\pltname % open next .pltN (.plt->.U if MS-DOS)
  \fi
% extracts and writes info for chapters, sections, etc.
  \expandafter\ifx\csname #1\endcsname\table
    \mtc@toks{\noexpand\leavevmode#2}%
    \MTC@WriteContentsline{#1}{plt}{#3}{#4}%
  \fi
}

\def\PLT@explist{\expandafter\PLT@next\PLT@list\\}
\def\PLT@loop#1{\openin\@inputcheck#1\relax
  \ifeof\@inputcheck
    \typeout{^^JNo file #1^^JPARTLOTS NOT PREPARED.^^J}%
    \expandafter\PLT@lot
  \else
    \typeout{PREPARING PARTLOTS FROM #1}%
    \expandafter\PLT@read\fi}
\def\PLT@read{%
  \read\@inputcheck to\PLT@line
  \expandafter\PLT@test\PLT@line.....\PLT@% %%HO: . added
  }%
\long\def\PLT@test#1#2#3#4#5#6\PLT@{% %%HO: #6 added
  \ifx#1\contentsline
    \let\mtc@string\string
    \PLT@contentsline{#2}{#3}{#4}{#5}% %%HO: #4 added
    \let\mtc@string\relax
  \else\ifx#1\@input
     \edef\PLT@list{\PLT@list#2\relax}%
  \else\ifx#1\partend % \part* closes .pltN (.plt->.U on MS-DOS)
     \immediate\closeout\tf@mtc
     \immediate\openout\tf@mtc=\jobname.bmt % and opens a scratch file
  \else\ifx#1\partbegin
     \addtocounter{ptc}{-1}% % \part* has done a parasite increment
  \fi\fi\fi\fi
  \ifeof\@inputcheck\expandafter\PLT@lot
  \else\expandafter\PLT@read\fi}%
} % end of part stuff

%%%%%%%%%%%%%%%%%%%%%%%
%%% If \chapter is not defined but \section is, then
%%% the following macros are available (for article-like documents).
%%% Braces are inscrutable!
\@ifundefined{chapter}%
{% CAS \chapter inconnu
\@ifundefined{section}{}{%
\def\firstsectionis#1%
  {\typeout{^^JWARNING*** \string\firstsectionis}%
   \typeout{ is an obsolete command^^J}}
\newcounter{stc}  % counter of secttocs
\setcounter{stc}{0}
\def\adjuststc{\stepcounter{stc}}  %32
\newcounter{secttocdepth} % analog to tocdepth, but for secttocs
\setcounter{secttocdepth}{2}

% rule before/after secttoc/sectlof/sectlot
\def\stc@rule{\rule[3\p@]{\columnwidth}{.4\p@}\vspave*{2.6\p@}} % the \hrule is .4pt high  %kern->vspace* v39-2004/09/09

\newlength\stcindent % indentation (left/right) of secttocs
\stcindent=24\p@      % defaut value
%#v39: NFSS fonts
\def\stcfont{\small\rmfamily\upshape\mdseries}    % font for the secttoc
\def\stcSSfont{\small\rmfamily\upshape\bfseries}  % font for the secttoc (subsections)
\let\stcSSSfont\stcfont    % font for the secttoc (subsubsections)
\let\stcPfont\stcfont      % font for the secttoc (paragraphs)
\let\stcSPfont\stcfont     % font for the secttoc (subparagraphs)
\let\slffont\stcfont       % font for the sectlof (figures)
\let\sltfont\stcfont       % font for the sectlot (tables)
\def\stifont{\large\rmfamily\upshape\bfseries}    % font for titles

% Centering, flushleft, flushright or empty titles.
\def\c@sti#1{\null\hfill #1\hfill\null}
\def\l@sti#1{\null #1\hfill\null}
\def\r@sti#1{\null\hfill #1\null}
%\def\e@sti#1{\relax}
%\def\n@sti#1{\relax}
% v36-2002/02/11 avoid an ugly blank space (from FMi)
\def\e@sti#1{\vspace{-\baselineskip}} % v36-2002/02/11
\def\n@sti#1{\vspace{-\baselineskip}} % v36-2002/02/11

% Default: titles on left
\let\do@stitc\l@sti
\let\df@stitc\l@sti
\let\do@stilf\l@sti
\let\df@stilf\l@sti
\let\do@stilt\l@sti
\let\df@stilt\l@sti

\def\stc@verse{\let\\=\@centercr
  \list{}{\itemsep\z@\itemindent \z@\listparindent \itemindent
          \leftmargin\stcindent
          \rightmargin\leftmargin}\item[]}
\def\endstc@verse{\nopagebreak[4]\endlist}

% this command must be used after \section
% if you need a secttoc (no automatic secttoc)
\def\secttoc{\@ifnextchar[{\secttoc@}{\secttoc@[d]}}

\def\secttoc@[#1]{%
\if@longextensions%
\def\@tocfile{stc\thestc}%  % UNIX
\else
\def\@tocfile{S\thestc}%    % MS-DOS
\fi
        \mtc@CkFile{\jobname.\@tocfile}               % v35 2001/01/09
        \if@mtc@FE                                    % v35 2001/01/09
        \typeout{\jobname.\@tocfile\space is empty}   % v35 2001/01/09
        \else                                         % v35 2001/01/09
        \relax\begin{samepage}% we begin a local group here, using samepage
        \if #1e\let\do@stitc\e@sti
        \else\if #1n\let\do@stitc\n@sti
        \else\if #1c\let\do@stitc\c@sti
        \else\if #1l\let\do@stitc\l@sti
        \else\if #1r\let\do@stitc\r@sti
        \else\if #1d\let\do@stitc\df@stitc
        \fi\fi\fi\fi\fi\fi
%-v36-2002/02/15 If \stctitle is empty, acts like \secttoc[e]
%-v36-2002/03/15 We test the emptyness of \stctitle
%	\mtc@ifmtarg{\stctitle}{\let\do@stitc\e@sti\relax}{} %-v36-2002/03/15
        \mtc@CkStr{\stctitle}\if@mtc@FE \let\do@stitc\e@sti\relax\fi %v38 2003/01/30
        \raggedright % added #14
        \parskip=\z@%
        \reset@font\stcfont%
        \parindent=\z@%
        \nopagebreak[4]%
        \kern-0.8\baselineskip\nopagebreak[4]%
        \par\noindent
        \nopagebreak[4]%
        \ifx\stc@rule\relax
        \begin{tabular}{@{}p{\columnwidth}@{}}
        \reset@font\stifont\do@stitc{\mtc@v\stctitle}\\
        \end{tabular}%
	\else
        \begin{tabular}{@{}p{\columnwidth}@{}}
        \reset@font\stifont\do@stitc{\mtc@v\stctitle}\\\hline
        \end{tabular}%
	\fi
        \nopagebreak[4]\null\leavevmode\mtc@zrule\\\mtc@BBR%
        \leftmargin\stcindent
        \rightmargin\stcindent
        \itemindent=\z@\labelwidth=\z@%
        \labelsep=\z@\listparindent=\z@%
        \begin{stc@verse}\c@tocdepth=\c@secttocdepth%
        \leavevmode\\\mtc@BBR% this blank line is necessary to avoid
                % a wild negative indentation
        \vskip -.5\baselineskip
\begingroup
  \makeatletter
  \@ifundefined{stc@pgno}%
  {\let\@dottedtocline\@undottedtocline}{}
%   \gdef\thestc{\arabic{stc}} %23
  \@fileswfalse\mtc@hook@beforeinputfile\@input{\jobname.\@tocfile}
  % v36-2002/02/11 % adjust space under minitocs
  \vspace{-1ex} \vspace{-\baselineskip} % v36-2002/02/11
  \leavevmode\mtc@strut                 % v36-2002/02/11
  \global\@nobreakfalse\endgroup
        \end{stc@verse}%
        \kern-1.\baselineskip%
%        \kern0.\baselineskip%
        \nopagebreak[4]\stc@rule\null\leavevmode\\%
        \vskip-1.0\baselineskip\mtc@zrule\end{samepage}% %## the \\ is essential
        \par\pagebreak[1]\vspace*{-1ex}\fi}% %\fi v35-2001/01/09
        % some space under the secttoc

% this command must be used after \section
% if you need a sectlof (no automatic sectlof)
\def\sectlof{\@ifnextchar[{\sectlof@}{\sectlof@[d]}}

\def\sectlof@[#1]{%
\if@longextensions%
\def\@tocfile{slf\thestc}%  % UNIX
\else
\def\@tocfile{H\thestc}%    % MS-DOS
\fi
        \mtc@CkFile{\jobname.\@tocfile}               % v35 2001/01/09
        \if@mtc@FE                                    % v35 2001/01/09
        \typeout{\jobname.\@tocfile\space is empty}   % v35 2001/01/09
        \else                                         % v35 2001/01/09
        \relax\begin{samepage}% we begin a local group here, using samepage
        \if #1e\let\do@stilf\e@sti
        \else\if #1n\let\do@stilf\n@sti
        \else\if #1c\let\do@stilf\c@sti
        \else\if #1l\let\do@stilf\l@sti
        \else\if #1r\let\do@stilf\r@sti
        \else\if #1d\let\do@stilf\df@stilf
        \fi\fi\fi\fi\fi\fi
%-v36-2002/02/15 If \slftitle is empty, acts like \sectlof[e]
%-v36-2002/03/15 We test the emptyness of \slftitle
%	\mtc@ifmtarg{\slftitle}{\let\do@stilf\e@sti\relax}{} %-v36-2002/03/15
        \mtc@CkStr{\slftitle}\if@mtc@FE \let\do@stilf\e@sti\relax\fi %v38 2003/01/30
        \raggedright % added #14
        \parskip=\z@%
        \reset@font\slffont%
        \parindent=\z@%
        \nopagebreak[4]%
        \kern-0.8\baselineskip\nopagebreak[4]%
        \par\noindent
        \ifx\stc@rule\relax % correction 07Nov94 v23
        \begin{tabular}{@{}p{\columnwidth}@{}}
        \reset@font\stifont\do@stilf{\mtc@v\slftitle}\\
        \end{tabular}%
	\else
        \begin{tabular}{@{}p{\columnwidth}@{}}
        \reset@font\stifont\do@stilf{\mtc@v\slftitle}\\\hline
        \end{tabular}%
	\fi
        \nopagebreak[4]\null\leavevmode\mtc@zrule\\\mtc@BBR%
        \leftmargin\stcindent
        \rightmargin\stcindent
        \itemindent=\z@\labelwidth=\z@%
        \labelsep=\z@\listparindent=\z@%
        % depth does not matter for sectlof
        \begin{stc@verse}%\c@tocdepth=\c@secttocdepth%
        \leavevmode\\\mtc@BBR% this blank line is necessary to avoid
                % a wild negative indentation
        \vskip -.5\baselineskip
\begingroup
  \makeatletter
  \@ifundefined{slf@pgno}%
  {\let\@dottedtocline\@undottedtocline}{}
%   \gdef\thestc{\arabic{stc}} %23
  \@fileswfalse\mtc@hook@beforeinputfile\@input{\jobname.\@tocfile}
  \global\@nobreakfalse\endgroup
        \end{stc@verse}%
        \kern-1.\baselineskip%
%        \kern0.\baselineskip%
        \nopagebreak[4]\stc@rule\null\leavevmode\\%
        \vskip-1.0\baselineskip\mtc@zrule\end{samepage}% %## the \\ is essential
        \par\pagebreak[1]\vspace*{-1ex}\fi}% %\fi v35-2001/01/09
        % some space under the secttoc

% Added in version #13
% this command must be used after \section
% if you need a sectlot (no automatic sectlot)
\def\sectlot{\@ifnextchar[{\sectlot@}{\sectlot@[d]}}

\def\sectlot@[#1]{%
\if@longextensions%
\def\@tocfile{slt\thestc}%  % UNIX
\else
\def\@tocfile{I\thestc}%    % MS-DOS
\fi
        \mtc@CkFile{\jobname.\@tocfile}               % v35 2001/01/09
        \if@mtc@FE                                    % v35 2001/01/09
        \typeout{\jobname.\@tocfile\space is empty}   % v35 2001/01/09
        \else                                         % v35 2001/01/09
        \relax\begin{samepage}% we begin a local group here, using samepage
        \if #1e\let\do@stilt\e@sti
        \else\if #1n\let\do@stilt\n@sti
        \else\if #1c\let\do@stilt\c@sti
        \else\if #1l\let\do@stilt\l@sti
        \else\if #1r\let\do@stilt\r@sti
        \else\if #1d\let\do@stilt\df@stilt
        \fi\fi\fi\fi\fi\fi
%-v36-2002/02/15 If \slttitle is empty, acts like \sectlot[e]
%-v36-2002/03/15 We test the emptyness of \slttitle
%	\mtc@ifmtarg{\slttitle}{\let\do@stilt\e@sti\relax}{} %-v36-2002/03/15
        \mtc@CkStr{\slttitle}\if@mtc@FE \let\do@stilt\e@sti\relax\fi %v38 2003/01/30
        \raggedright % added #14
        \parskip=\z@%
        \reset@font\sltfont%
        \parindent=\z@%
        \nopagebreak[4]%
        \kern-0.8\baselineskip\nopagebreak[4]%
        \par\noindent
        \ifx\stc@rule\relax % correction 07Nov94 v23
        \begin{tabular}{@{}p{\columnwidth}@{}}
        \reset@font\stifont\do@stilt{\mtc@v\slttitle}\\
        \end{tabular}%
	\else
        \begin{tabular}{@{}p{\columnwidth}@{}}
        \reset@font\stifont\do@stilt{\mtc@v\slttitle}\\\hline
        \end{tabular}%
	\fi
        \nopagebreak[4]\null\leavevmode\mtc@zrule\\\mtc@BBR%
        \leftmargin\stcindent
        \rightmargin\stcindent
        \itemindent=\z@\labelwidth=\z@%
        \labelsep=\z@\listparindent=\z@%
        % depth does not matter for sectlot
        \begin{stc@verse}%\c@tocdepth=\c@secttocdepth%
        \leavevmode\\\mtc@BBR% this blank line is necessary to avoid
                % a wild negative indentation
        \vskip -.5\baselineskip
\begingroup
  \makeatletter
  \@ifundefined{slt@pgno}%
  {\let\@dottedtocline\@undottedtocline}{}
   \gdef\thestc{\arabic{stc}} %23
  \@fileswfalse\mtc@hook@beforeinputfile\@input{\jobname.\@tocfile}
  \global\@nobreakfalse\endgroup
        \end{stc@verse}%
        \kern-1.\baselineskip%
%        \kern0.\baselineskip%
        \nopagebreak[4]\stc@rule\null\leavevmode\\%
        \vskip-1.0\baselineskip\mtc@zrule\end{samepage}% %## the \\ is essential
        \par\pagebreak[1]\vspace*{-1ex}\fi}% %\fi v35-2001/01/09
        % some space under the secttoc

% I use a depth of 10000 to inhibit the printing of
% that contentsline.
\def\l@xsect{\@dottedtocline{\@M}{1.0em}{2.3em}}
\def\l@schapter{\@dottedtocline{1}{1.0em}{2.3em}}

\def\xsect{xsect}
\def\schapter{schapter}

%\typeout{DEBUG: altering section ****************}
\let\sv@sect\@sect
\gdef\@sect#1#2#3#4#5#6[#7]#8{%
\ifnum #2=1
\addcontentsline{lof}{xsect}{#7}%
\addcontentsline{lot}{xsect}{#7}%
\fi
\sv@sect{#1}{#2}{#3}{#4}{#4}{#5}{#6}[{#7}]{#8}}

\def\@sect#1#2#3#4#5#6[#7]#8{
\expandafter
\ifx\csname #1\endcsname\section\relax % ADDED
\addcontentsline{lof}{xsect}{#7}%        ADDED
\addcontentsline{lot}{xsect}{#7}%        ADDED
\fi                             %        ADDED
\ifx\csname #1\endcsname\starsection\relax % ADDED v25
\addcontentsline{lof}{xsect}{#7}%        ADDED v25
\addcontentsline{lot}{xsect}{#7}%        ADDED v25
\fi                             %        ADDED v25
\ifnum #2>\c@secnumdepth
     \let\@svsec\@empty\else
     \refstepcounter{#1}\edef\@svsec{\csname the#1\endcsname\hskip 1em}\fi
     \@tempskipa #5\relax
      \ifdim \@tempskipa>\z@
        \begingroup #6\relax
          \@hangfrom{\hskip #3\relax\@svsec}{\interlinepenalty \@M #8\par}%
        \endgroup
       \csname #1mark\endcsname{#7}\addcontentsline
         {toc}{#1}{\ifnum #2>\c@secnumdepth \else
                      \protect\numberline{\csname the#1\endcsname}\fi
                    #7}\else
        \def\@svsechd{#6\hskip #3\relax  %% \relax added 2 May 90
                   \@svsec #8\csname #1mark\endcsname
                      {#7}\addcontentsline
                           {toc}{#1}{\ifnum #2>\c@secnumdepth \else
                             \protect\numberline{\csname the#1\endcsname}\fi
                       #7}}\fi
     \@xsect{#5}}
%
% tricky code to deal with \section*
\let\stc@ssect\@ssect
\def\@ssect{%
\addtocontents{toc}{\protect\sectend}\stc@ssect%
}
\def\@ssect{%
\addtocontents{toc}{\protect\sectbegin}\stc@ssect%
}
\let\sectend\relax
\let\sectbegin\relax
\let\appendixmtc\relax

% this command extracts info from the .toc file
% and create the .stcN files (.stc -> .S on MS-DOS)
\def\@dosecttoc#1{{%
  \makeatletter
  \setcounter{stc}{0} % START VALUE
  \STC@next#1.toc\relax\\}\setcounter{stc}{0}} %23: raz

% this command extracts info from the .lof file
% and create the .slfN files (.slf -> .H on MS-DOS)
\def\@dosectlof#1{{%
  \makeatletter
  \setcounter{stc}{0} % START VALUE
  \SLF@next#1.lof\relax\\}\setcounter{stc}{0}} %23: raz

% this command extracts info from the .lot file
% and create the .sltN files (.slt -> .V on MS-DOS)
\def\@dosectlot#1{{%
  \makeatletter
  \setcounter{stc}{0} % START VALUE
  \SLT@next#1.lot\relax\\}\setcounter{stc}{0}} %23: raz

\def\dosecttoc{\@ifnextchar[{\dosecttoc@}{\dosecttoc@[l]}}
\def\dosectlof{\@ifnextchar[{\dosectlof@}{\dosectlof@[l]}}
\def\dosectlot{\@ifnextchar[{\dosectlot@}{\dosectlot@[l]}}

\def\dosecttoc@[#1]{%
\if #1e\let\df@stitc\e@sti%
\else\if #1n\let\df@stitc\n@sti%
\else\if #1c\let\df@stitc\c@sti%
\else\if #1l\let\df@stitc\l@sti%
\else\if #1r\let\df@stitc\r@sti%
\fi\fi\fi\fi\fi%
\@@dosecttoc}

\def\dosectlof@[#1]{%
\if #1e\let\df@stilf\e@sti%
\else\if #1n\let\df@stilf\n@sti%
\else\if #1c\let\df@stilf\c@sti%
\else\if #1l\let\df@stilf\l@sti%
\else\if #1r\let\df@stilf\r@sti%
\fi\fi\fi\fi\fi%
\@@dosectlof}

\def\dosectlot@[#1]{%
\if #1e\let\df@stilt\e@sti%
\else\if #1n\let\df@stilt\n@sti%
\else\if #1c\let\df@stilt\c@sti%
\else\if #1l\let\df@stilt\l@sti%
\else\if #1r\let\df@stilt\r@sti%
\fi\fi\fi\fi\fi%
\@@dosectlot}

\def\@@dosecttoc{\@dosecttoc{\jobname}\immediate\closeout\tf@mtc}
\def\@@dosectlof{\@dosectlof{\jobname}\immediate\closeout\tf@mtc}
\def\@@dosectlot{\@dosectlot{\jobname}\immediate\closeout\tf@mtc}

\def\STC@next#1\relax#2\\{%
  \edef\STC@list{#2}%
  \STC@loop{#1}}
\def\STC@toc{%
  \ifx\STC@list\@empty\else\expandafter\STC@explist\fi}

\def\STC@contentsline#1#2#3#4{% %%HO: #4 added
  \gdef\thestc{\arabic{stc}}% %%HO: space removed
  \expandafter\ifx\csname #1\endcsname\section
    \stepcounter{stc}% % the stc counter simulates the section counter
    \def\thestc{\arabic{stc}} %% HO: removed
    \if@longextensions%
      \typeout{Writing\space\jobname.stc\thestc}%     % UNIX
      \def\stcname{\jobname.stc\thestc}%              % UNIX
    \else
      \typeout{Writing\space\jobname.S\thestc}%       % MS-DOS
      \def\stcname{\jobname.S\thestc}%                % MS-DOS
    \fi
    \immediate\closeout\tf@mtc % close current .stcN .stc->.S on MS-DOS
    \immediate\openout\tf@mtc=\stcname % open next .stcN (.stc->.S if MS-DOS)
  \fi
  %%%
  \mtc@toks{\noexpand\leavevmode #2}%
% COFFEE
  \expandafter\ifx\csname #1\endcsname\coffee
    \MTC@WriteCoffeeline{#1}{#3}%
  \fi
  \expandafter\ifx\csname #1\endcsname\subsection
    \MTC@WriteContentsline{#1}{stcSS}{#3}{#4}%
  \fi
  \expandafter\ifx\csname #1\endcsname\subsubsection
    \MTC@WriteContentsline{#1}{stcSSS}{#3}{#4}%
  \fi
  \expandafter\ifx\csname #1\endcsname\paragraph
    \MTC@WriteContentsline{#1}{stcP}{#3}{#4}%
  \fi
  \expandafter\ifx\csname #1\endcsname\subparagraph
    \MTC@WriteContentsline{#1}{stcSP}{#3}{#4}%
  \fi
% Added v25: \starsection and co.
  \ifx\csname #1\endcsname\starsection
    \stepcounter{stc}% % the stc counter simulates the section counter
    \gdef\thestc{\arabic{stc}}
    \if@longextensions%
      \typeout{Writing\space\jobname.stc\thestc}%     % UNIX
      \def\stcname{\jobname.stc\thestc}%              % UNIX
    \else
      \typeout{Writing\space\jobname.S\thestc}%       % MS-DOS
      \def\stcname{\jobname.S\thestc}%                % MS-DOS
    \fi
    \immediate\closeout\tf@mtc % close current .stcN .stc->.S on MS-DOS
    \immediate\openout\tf@mtc=\stcname % open next .stcN (.stc->.S if MS-DOS)
  \fi
  \expandafter\ifx\csname #1\endcsname\starsubsection
    \MTC@WriteContentsline{#1}{stcSS}{#3}{#4}%
  \fi
  \expandafter\ifx\csname #1\endcsname\starsubsubsection
    \MTC@WriteContentsline{#1}{stcSSS}{#3}{#4}%
  \fi
  \expandafter\ifx\csname #1\endcsname\starparagraph
    \MTC@WriteContentsline{#1}{stcP}{#3}{#4}%
  \fi
  \expandafter\ifx\csname #1\endcsname\starsubparagraph
    \MTC@WriteContentsline{#1}{stcSP}{#3}{#4}%
  \fi
}

\def\STC@explist{\expandafter\STC@next\STC@list\\}
\def\STC@loop#1{\openin\@inputcheck#1\relax
  \ifeof\@inputcheck
    \typeout{^^JNo file #1^^JSECTTOCS NOT PREPARED.^^J}%
    \expandafter\STC@toc
  \else
    \typeout{PREPARING SECTTOCS FROM #1}%
    \expandafter\STC@read\fi}
\def\STC@read{%
  \read\@inputcheck to\STC@line
  \expandafter\STC@test\STC@line.....\STC@% %%HO: . added
  }%
\long\def\STC@test#1#2#3#4#5#6\STC@{% %%HO: #6 added
  \ifx#1\contentsline
    \let\mtc@string\string
    \STC@contentsline{#2}{#3}{#4}{#5}% %%HO: #4 added
    \let\mtc@string\relax
  \else\ifx#1\@input
     \edef\STC@list{\STC@list#2\relax}%
  \else\ifx#1\sectend % \section* closes .stcN (.stc->.S on MS-DOS)
     \immediate\closeout\tf@mtc
     \immediate\openout\tf@mtc=\jobname.bmt % and opens a scratch file
  \else\ifx#1\sectbegin
     \addtocounter{stc}{-1}% % \section* has done a parasite increment
  \fi\fi\fi\fi
  \ifeof\@inputcheck\expandafter\STC@toc
  \else\expandafter\STC@read\fi}%

\def\SLF@next#1\relax#2\\{%
  \edef\SLF@list{#2}%
  \SLF@loop{#1}}
\def\SLF@lof{%
  \ifx\SLF@list\@empty\else\expandafter\SLF@explist\fi}

\def\SLF@contentsline#1#2#3#4{% %%HO: #4 added
  \gdef\thestc{\arabic{stc}}% %%HO: space removed
  \expandafter\ifx\csname #1\endcsname\xsect
    \stepcounter{stc}% % the stc counter simulates the section counter
%%    \gdef\thestc{\arabic{stc}} %%HO: removed
    \if@longextensions%
      \typeout{Writing\space\jobname.slf\thestc}%     % UNIX
      \def\slfname{\jobname.slf\thestc}%              % UNIX
    \else
      \typeout{Writing\space\jobname.G\thestc}%       % MS-DOS
      \def\slfname{\jobname.H\thestc}%                % MS-DOS
    \fi
    \immediate\closeout\tf@mtc % close current .slfN .slf->.H on MS-DOS
%    \stepcounter{stc}% % the stc counter simulates the section counter
    \immediate\openout\tf@mtc=\slfname % open next .slfN (.slf->.H if MS-DOS)
  \fi
  \mtc@toks{\noexpand\leavevmode #2}%
% extracts and writes info for sections, etc.
  \expandafter\ifx\csname #1\endcsname\figure
    \MTC@WriteContentsline{#1}{slf}{#3}{#4}%
  \fi
}

\def\SLF@explist{\expandafter\SLF@next\SLF@list\\}
\def\SLF@loop#1{\openin\@inputcheck#1\relax
  \ifeof\@inputcheck
    \typeout{^^JNo file #1^^JSECTLOFS NOT PREPARED.^^J}%
    \expandafter\SLF@lof
  \else
    \typeout{PREPARING SECTLOFS FROM #1}%
    \expandafter\SLF@read\fi}
\def\SLF@read{%
  \read\@inputcheck to\SLF@line
  \expandafter\SLF@test\SLF@line.....\SLF@% %%HO: . added
  }%
\long\def\SLF@test#1#2#3#4#5#6\SLF@{% %%HO: #6 added
  \ifx#1\contentsline
    \let\mtc@string\string
    \SLF@contentsline{#2}{#3}{#4}{#5}% %%HO: #4 added
    \let\mtc@string\relax
  \else\ifx#1\@input
     \edef\SLF@list{\SLF@list#2\relax}%
  \else\ifx#1\sectend % \section* closes .slfN (.slf->.H on MS-DOS)
     \immediate\closeout\tf@mtc
     \immediate\openout\tf@mtc=\jobname.bmt % and opens a scratch file
  \else\ifx#1\sectbegin
     \addtocounter{stc}{-1}% % \section* has done a parasite increment
  \fi\fi\fi\fi
  \ifeof\@inputcheck\expandafter\SLF@lof
  \else\expandafter\SLF@read\fi}%

\def\SLT@next#1\relax#2\\{%
  \edef\SLT@list{#2}%
  \SLT@loop{#1}}
\def\SLT@lot{%
  \ifx\SLT@list\@empty\else\expandafter\SLT@explist\fi}

\def\SLT@contentsline#1#2#3#4{% %%HO: #4 added
  \gdef\thestc{\arabic{stc}}% %%HO: space removed
  \expandafter\ifx\csname #1\endcsname\xsect
    \stepcounter{stc}% % the stc counter simulates the section counter
%%    \gdef\thestc{\arabic{stc}} %%HO: removed
    \if@longextensions%
      \typeout{Writing\space\jobname.slt\thestc}%     % UNIX
      \def\sltname{\jobname.slt\thestc}%              % UNIX %bug mlt->slt
    \else
      \typeout{Writing\space\jobname.V\thestc}%       % MS-DOS
      \def\sltname{\jobname.V\thestc}%                % MS-DOS
    \fi
    \immediate\closeout\tf@mtc % close current .sltN .slt->.V on MS-DOS
%    \stepcounter{stc}% % the stc counter simulates the section counter
    \immediate\openout\tf@mtc=\sltname % open next .sltN (.slt->.V if MS-DOS)
  \fi
  \mtc@toks{\noexpand\leavevmode #2}%
% extracts and writes info for subsections, etc.
  \expandafter\ifx\csname #1\endcsname\table
    \MTC@WriteContentsline{#1}{slt}{#3}{#4}%
  \fi
}

\def\SLT@explist{\expandafter\SLT@next\SLT@list\\}
\def\SLT@loop#1{\openin\@inputcheck#1\relax
  \ifeof\@inputcheck
    \typeout{^^JNo file #1^^JSECTLOTS NOT PREPARED.^^J}%
    \expandafter\SLT@lot
  \else
    \typeout{PREPARING SECTLOTS FROM #1}%
    \expandafter\SLT@read\fi}
\def\SLT@read{%
  \read\@inputcheck to\SLT@line
  \expandafter\SLT@test\SLT@line.....\SLT@% %%HO: . added
  }%
\long\def\SLT@test#1#2#3#4#5#6\SLT@{% %%HO: #6 added
  \ifx#1\contentsline
    \let\mtc@string\string
    \SLT@contentsline{#2}{#3}{#4}{#5}% %%HO: #4 added
    \let\mtc@string\relax
  \else\ifx#1\@input
     \edef\SLT@list{\SLT@list#2\relax}%
  \else\ifx#1\sectend % \section* closes .sltN (.slt->.V on MS-DOS)
     \immediate\closeout\tf@mtc
     \immediate\openout\tf@mtc=\jobname.bmt % and opens a scratch file
  \else\ifx#1\sectbegin
     \addtocounter{stc}{-1}% % \section* has done a parasite increment
  \fi\fi\fi\fi
  \ifeof\@inputcheck\expandafter\SLT@lot
  \else\expandafter\SLT@read\fi}%
}%
}% FIN CAS \chapter inconnu: \secttoc &co. permis
{} % CAS \chapter connu: pas de \secttoc & co.

\@ifundefined{section}{}{\let\l@listof\l@section} %v27
\@ifundefined{chapter}{}{\let\l@listof\l@chapter} %v27
\@ifundefined{part}{}{\let\l@starpart\l@part}
\@ifundefined{chapter}{}{\let\l@starchapter\l@chapter}
\@ifundefined{section}{}{\let\l@starsection\l@section}
\@ifundefined{subsection}{}{\let\l@starsubsection\l@subsection}
\@ifundefined{subsubsection}{}{\let\l@starsubsubsection\l@subsubsection}
\@ifundefined{paragraph}{}{\let\l@starparagraph\l@paragraph}
\@ifundefined{subparagraph}{}{\let\l@starsubparagraph\l@subparagraph}

\def\noptcrule{\let\ptc@rule\relax}
\def\nomtcrule{\let\mtc@rule\relax}
\def\nostcrule{\let\stc@rule\relax}
\def\ptcrule{\def\ptc@rule{\kern-3\p@%
  \hrule width \columnwidth \kern2.6\p@}} % the \hrule is .4pt high
\def\mtcrule{\def\mtc@rule{\kern-3\p@%
  \hrule width \columnwidth \kern2.6\p@}} % the \hrule is .4pt high
\def\stcrule{\def\stc@rule{\kern-3\p@%
  \hrule width \columnwidth \kern2.6\p@}} % the \hrule is .4pt high
\def\ptc@rule{\rule[3\p@]{\columnwidth}{.4\p@}\vspace*{2.6\p@}}
%kern->vspace* v39-2004/09/09
\def\mtc@rule{\rule[3\p@]{\columnwidth}{.4\p@}\vspace*{2.6\p@}}
%kern->vspace* v39-2004/09/09
\def\stc@rule{\rule[3\p@]{\columnwidth}{.4\p@}\vspace*{2.6\p@}}
%kern->vspace* v39-2004/09/09

%v28b
% init counters
\AtBeginDocument{%
\@ifundefined{c@ptc}{}{\setcounter{ptc}{0}}
\@ifundefined{c@mtc}{}{\setcounter{mtc}{0}}
\@ifundefined{c@stc}{}{\setcounter{stc}{0}}}

%%% tight option
\DeclareOption{tight}{\tightmtctrue}
\DeclareOption{loose}{\tightmtcfalse} % default
%%% checkfiles/nocheckfiles option                  % v35 2001/01/09
\DeclareOption{checkfiles}{\@mtc@checkfilestrue}    % v35 2001/01/09
\DeclareOption{nocheckfiles}{\@mtc@checkfilesfalse} % v35 2001/01/09

%%% undotted option
\DeclareOption{undotted}{\undottedmtctrue}
\DeclareOption{dotted}{\undottedmtcfalse} % default

%%% notoccite option
\DeclareOption{notoccite}{\@mtc@notoccite@true}

%%% options for secttocs % v38 2003/01/30
\newif\if@mtc@ss@insection@ \@mtc@ss@insection@false
\@ifundefined{chapter}{%
\@ifundefined{section}{}%
{%
%\typeout{*** option insection available ***}
\DeclareOption{insection}{%
\@mtc@ss@insection@true}%
%\typeout{*** option insection invoked ***}\relax
}}{}

%%%% Language dependent part
\def\mtcselectlanguage#1{%                          % v35 2001/03/09
     \IfFileExists{#1.mld}%
       {\@input{#1.mld}\PackageWarning{minitoc}{#1 language selected.%
         \MessageBreak}}%
        {\PackageError{minitoc}{%
         #1 is not a known language,
         \MessageBreak #1.mld not found.
         \MessageBreak Command ignored}{Press return.%
         \MessageBreak Correct the source using a valid language name.%
         \MessageBreak}}%
}
\DeclareOption{acadian}{\input{french.mld}} %v39
\DeclareOption{acadien}{\input{french.mld}} %v39
\DeclareOption{afrikaan}{\input{afrikaan.mld}} %v28
\DeclareOption{afrikaans}{\input{afrikaan.mld}} %v28
\DeclareOption{american}{\input{english.mld}}
\DeclareOption{arab}{\input{arab.mld}}   %v27
\DeclareOption{arabic}{\input{arab.mld}}   %v27
\DeclareOption{armenian}{\input{armenian.mld}} %v29
\DeclareOption{austrian}{\input{german.mld}}
\DeclareOption{bahasa}{\input{bahasa.mld}} %v28
\DeclareOption{bangla}{\input{bangla.mld}} %v36
\DeclareOption{basque}{\input{basque.mld}} %v30
\DeclareOption{brazil}{\input{brazil.mld}} %v28
\DeclareOption{bicig}{\input{bicig.mld}} %v29
\DeclareOption{breton}{\input{breton.mld}} %v26
\DeclareOption{bulgarian}{\input{bulgarian.mld}} %v35
\DeclareOption{buryat}{\input{buryat.mld}} %v29
\DeclareOption{canadian}{\input{english.mld}} %v39
\DeclareOption{canadien}{\input{french.mld}} %v39
\DeclareOption{castillan}{\input{castillan.mld}} %v40
\DeclareOption{catalan}{\input{catalan.mld}}
\DeclareOption{croatian}{\input{croatian.mld}}
\DeclareOption{czech}{\input{czech.mld}}
\DeclareOption{danish}{\input{danish.mld}}
\DeclareOption{dutch}{\input{dutch.mld}}
\DeclareOption{english}{\input{english.mld}}
\DeclareOption{esperant}{\input{esperant.mld}} %v26
\DeclareOption{esperanto}{\input{esperant.mld}} %v26
\DeclareOption{estonian}{\input{estonian.mld}} %v35
\DeclareOption{ethiopia}{\input{ethiopia.mld}} %v28
\DeclareOption{ethiopian}{\input{ethiopia.mld}} %v28
\DeclareOption{finnish}{\input{finnish.mld}}
\DeclareOption{francais}{\input{french.mld}}
\DeclareOption{french}{\input{french.mld}}
\DeclareOption{frenchb}{\input{french.mld}}
\DeclareOption{frenchle}{\input{french.mld}}
\DeclareOption{frenchpro}{\input{french.mld}}
\DeclareOption{galician}{\input{galician.mld}}
\DeclareOption{german}{\input{german.mld}}
\DeclareOption{germanb}{\input{germanb.mld}} %v26
\DeclareOption{greek}{\input{greek.mld}} %v26
\DeclareOption{hebrew}{\input{hebrew.mld}} %v35
\DeclareOption{hungarian}{\input{magyar.mld}}
\DeclareOption{icelandic}{\input{icelandic.mld}} %v35
\DeclareOption{interlingua}{\input{interlingua.mld}} %v35
\DeclareOption{irish}{\input{irish.mld}} %v26
\DeclareOption{italian}{\input{italian.mld}}
\DeclareOption{japanese}{\input{japanese.mld}} %v40
\DeclareOption{latin}{\input{latin.mld}} %v35
\DeclareOption{lithuanian}{\input{lithuanian.mld}} %v29
\DeclareOption{lsorbian}{\input{lsorbian.mld}} %v26
\DeclareOption{magyar}{\input{magyar.mld}}
\DeclareOption{mongol}{\input{mongol.mld}} %v29
\DeclareOption{naustrian}{\input{ngermanb.mld}} %v39
\DeclareOption{ngerman}{\input{ngermanb.mld}} %v39
\DeclareOption{ngermanb}{\input{ngermanb.mld}} %v30
\DeclareOption{norsk}{\input{norsk.mld}}
\DeclareOption{nynorsk}{\input{nynorsk.mld}} %v25
\DeclareOption{polish}{\input{polish.mld}}
\DeclareOption{portuges}{\input{portuges.mld}}
\DeclareOption{romanian}{\input{romanian.mld}}
%%%%russian not supported \DeclareOption{russian}{\input{russian.mld}}
\DeclareOption{russianb}{\input{russianb.mld}} %v26
\DeclareOption{russianc}{\input{russianc.mld}} %v29
\DeclareOption{samin}{\input{samin.mld}} %v35
\DeclareOption{scottish}{\input{scottish.mld}} %v26
\DeclareOption{serbian}{\input{serbian.mld}} %v30
\DeclareOption{slovak}{\input{slovak.mld}}
\DeclareOption{slovene}{\input{slovene.mld}}
\DeclareOption{spanish}{\input{spanish.mld}}
\DeclareOption{swedish}{\input{swedish.mld}}
\DeclareOption{turkish}{\input{turkish.mld}}
\DeclareOption{ukraineb}{\input{ukraineb.mld}} %v30
\DeclareOption{usorbian}{\input{usorbian.mld}} %v26
\DeclareOption{vietnam}{\input{vietnam.mld}}   %v27
\DeclareOption{vietnamese}{\input{vietnam.mld}}   %v27
\DeclareOption{welsh}{\input{welsh.mld}}   %v30
%%%%%%%%%
\DeclareOption{shortext}{\@longextensionsfalse %v28
\typeout{*** You have forced the use of short extensions ***}}
%%%%%%%%%
%v40 options hints/nohints (default: nohints).
\newif\if@mtc@hints@ \@mtc@hints@false
\newif\if@mtc@hints@w@ \@mtc@hints@w@false
\DeclareOption{hints}{\@mtc@hints@true}
\DeclareOption{nohints}{\@mtc@hints@false}

% %v40 This command detects potential problems.
\newif\if@mtc@hints@given@ \@mtc@hints@given@false
\def\mtc@hints@begindoc{%
\PackageInfo{minitoc}{***** You  requested the hints option *****\@gobble}%
\PackageInfo{minitoc}{***** Some hints are eventually given below *****\@gobble}%
\@ifpackageloaded{appendix}{%
\@mtc@hints@given@true
\PackageInfo{minitoc}{--- The appendix package is loaded. \MessageBreak
See minitoc.pdf for specific precautions\@gobble}}{}%
\@ifpackageloaded{tocbibind}{%
\@mtc@hints@given@true
\PackageInfo{minitoc}{--- The tocbibind package is loaded. \MessageBreak
See minitoc.pdf for specific precautions\@gobble}}{}%
\@ifpackageloaded{tocloft}{%
\@mtc@hints@given@true
\PackageInfo{minitoc}{--- The tocloft package is loaded. \MessageBreak
See minitoc.pdf for specific precautions\@gobble}}{}%
\@ifpackageloaded{titletoc}{%
\@mtc@hints@given@true
\PackageWarning{minitoc}{--- The titletoc package is loaded. \MessageBreak
It is incompatible with the minitoc package\@gobble}}{}%
\@ifpackageloaded{placeins}{%
\if@mtc@ss@insection@
\@ifpackagewith{placeins}{section,below}{}{%
\@mtc@hints@given@true
\PackageWarning{minitoc}{--- The placeins package is loaded without section and below options. \MessageBreak
but minitoc used the insection option which implies them. \MessageBreak
Try to inverse the loading order and use coherent options. \MessageBreak
You may have got a message ! LaTeX Error: Option clash for package placeins\@gobble}%
}%
\fi
}{}%
%MEMOIR
\@ifclassloaded{memoir}{%
\@mtc@hints@given@true
\PackageInfo{minitoc}{--- The memoir class is loaded. \MessageBreak
See minitoc.pdf for specific precautions\@gobble}{}%
}{}%
% Comparaisons
\@mtc@hints@w@false
\@ifundefined{chapter}{}{\ifx\chapter\mtc@hints@chapter\relax\else\@mtc@hints@w@true\fi}
\@ifundefined{chapter}{}{\ifx\@chapter\mtc@hints@@chapter\relax\else\@mtc@hints@w@true\fi}
\@ifundefined{chapter}{}{\ifx\@schapter\mtc@hints@@schapter\relax\else\@mtc@hints@w@true\fi}
\if@mtc@hints@w@\@mtc@hints@given@true%
  \PackageWarning{minitoc}{--- The \string\chapter\space command is altered after minitoc\@gobble}\fi
\@mtc@hints@w@false
\@ifundefined{part}{}{\ifx\part\mtc@hints@part\relax\else\@mtc@hints@w@true\fi}
\@ifundefined{part}{}{\ifx\@part\mtc@hints@@part\relax\else\@mtc@hints@w@true\fi}
\@ifundefined{part}{}{\ifx\@spart\mtc@hints@@spart\relax\else\@mtc@hints@w@true\fi}
\if@mtc@hints@w@\@mtc@hints@given@true%
  \PackageWarning{minitoc}{--- The \string\part\space command is altered after minitoc\@gobble}\fi
\@mtc@hints@w@false
\@ifundefined{chapter}{%
\@ifundefined{section}{}{\ifx\chapter\mtc@hints@section\relax\else\@mtc@hints@w@true\fi}
\@ifundefined{section}{}{\ifx\@sect\mtc@hints@@sect\relax\else\@mtc@hints@w@true\fi}
\@ifundefined{section}{}{\ifx\@ssect\mtc@hints@@ssect\relax\else\@mtc@hints@w@true\fi}
\if@mtc@hints@w@\@mtc@hints@given@true%
  \PackageWarning{minitoc}{--- The \string\section\space command is altered after minitoc\@gobble}\relax\else\fi}{}%
} % end of \mtc@hints@begindoc%
\def\mtc@hints@enddoc{%
\if@mtc@hints@given@\PackageWarning{minitoc}{***** Some hints have been written in the \jobname.log file. *****\@gobble}\else
\PackageWarning{minitoc}{***** No hints have been written in the \jobname.log file. *****\@gobble}\fi
}
%%%%%%%%%

\ExecuteOptions{english} %v27 % default
\ProcessOptions*
\if@mtc@ss@insection@%\typeout{*** option insection used ***}%
\RequirePackage[section,below]{placeins}[2002/06/27]\fi
\if@mtc@notoccite@%
\RequirePackage{notoccite}\fi
%v40 Apply the hints option
\if@mtc@hints@\AtBeginDocument{\mtc@hints@begindoc}\AtEndDocument{\mtc@hints@enddoc}%
\@ifundefined{chapter}{}{\let\mtc@hints@chapter\chapter
			 \let\mtc@hints@@chapter\@chapter
			 \let\mtc@hints@@schapter\@schapter}
\@ifundefined{part}{}{\let\mtc@hints@part\part
			 \let\mtc@hints@@part\@part
			 \let\mtc@hints@@spart\@spart}
\@ifundefined{section}{}{\let\mtc@hints@section\section
			 \let\mtc@hints@@sect\@sect
			 \let\mtc@hints@@ssect\@ssect}
\fi

\endinput
%%
%% \CharacterTable
%%  {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
%%   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
%%   Digits        \0\1\2\3\4\5\6\7\8\9
%%   Exclamation   \!     Double quote  \"     Hash (number) \#
%%   Dollar        \$     Percent       \%     Ampersand     \&
%%   Acute accent  \'     Left paren    \(     Right paren   \)
%%   Asterisk      \*     Plus          \+     Comma         \,
%%   Minus         \-     Point         \.     Solidus       \/
%%   Colon         \:     Semicolon     \;     Less than     \<
%%   Equals        \=     Greater than  \>     Question mark \?
%%   Commercial at \@     Left bracket  \[     Backslash     \\
%%   Right bracket \]     Circumflex    \^     Underscore    \_
%%   Grave accent  \`     Left brace    \{     Vertical bar  \|
%%   Right brace   \}     Tilde         \~}
%%
%% End of file `minitoc.sty'.

