summaryrefslogtreecommitdiff
path: root/Master/texmf-dist
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist')
-rw-r--r--Master/texmf-dist/tex/latex/titlesec/block.tss37
-rw-r--r--Master/texmf-dist/tex/latex/titlesec/drop.tss55
-rw-r--r--Master/texmf-dist/tex/latex/titlesec/frame.tss61
-rw-r--r--Master/texmf-dist/tex/latex/titlesec/leftmargin.tss54
-rw-r--r--Master/texmf-dist/tex/latex/titlesec/margin.tss54
-rw-r--r--Master/texmf-dist/tex/latex/titlesec/rightmargin.tss51
-rw-r--r--Master/texmf-dist/tex/latex/titlesec/titlesec.sty1453
-rw-r--r--Master/texmf-dist/tex/latex/titlesec/titletoc.sty629
-rw-r--r--Master/texmf-dist/tex/latex/titlesec/ttlkeys.def114
-rw-r--r--Master/texmf-dist/tex/latex/titlesec/ttlps.def504
-rw-r--r--Master/texmf-dist/tex/latex/titlesec/wrap.tss75
11 files changed, 3087 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/titlesec/block.tss b/Master/texmf-dist/tex/latex/titlesec/block.tss
new file mode 100644
index 00000000000..93055c573b7
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/titlesec/block.tss
@@ -0,0 +1,37 @@
+% +--------------------------------------------------+
+% | Typeset titlesec.tex to get the documentation. |
+% +--------------------------------------------------+
+%
+% Copyright (c) 1998-2005 by Javier Bezos.
+% All Rights Reserved.
+%
+% This file is part of the titlesec distribution release 2.6
+% -----------------------------------------------------------
+%
+% This program can be redistributed and/or modified under the terms
+% of the LaTeX Project Public License Distributed from CTAN
+% archives in directory macros/latex/base/lppl.txt; either
+% version 1 of the License, or any later version.
+
+\ProvidesFile{block.tss}[2005/01/22]
+
+\gdef\ttlh@block#1#2#3#4#5#6#7#8{%
+ \gdef\ttl@makeline##1{\ttl@calc\hspace{#6}##1\ttl@calc\hspace{#7}}%
+ \setlength\leftskip{#6}%
+ \setlength\rightskip{#7}%
+ \interlinepenalty\@M
+ \ttl@changecentercr
+ \ttl@beginlongest
+ #1% \ifhmode\ttl@hmode@error\fi
+ \ttl@glcmds
+ \parindent\z@
+ \leavevmode
+ \ifttl@label
+ {#2}%
+ \setlength\@tempskipa{#3}%
+ \ifdim\@tempskipa=\z@\else\ttl@calc\hspace{#3}\fi
+ \fi
+ #4{#8}%
+ \kern\z@\strut\@@par
+ \nobreak\ttl@midlongest#5\@@par
+ \ttl@endlongest}
diff --git a/Master/texmf-dist/tex/latex/titlesec/drop.tss b/Master/texmf-dist/tex/latex/titlesec/drop.tss
new file mode 100644
index 00000000000..823ef3e15f9
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/titlesec/drop.tss
@@ -0,0 +1,55 @@
+% +--------------------------------------------------+
+% | Typeset titlesec.tex to get the documentation. |
+% +--------------------------------------------------+
+%
+% Copyright (c) 1998-2005 by Javier Bezos.
+% All Rights Reserved.
+%
+% This file is part of the titlesec distribution release 2.6
+% -----------------------------------------------------------
+%
+% This program can be redistributed and/or modified under the terms
+% of the LaTeX Project Public License Distributed from CTAN
+% archives in directory macros/latex/base/lppl.txt; either
+% version 1 of the License, or any later version.
+
+\ProvidesFile{drop.tss}[2005/01/22]
+
+\gdef\ttlh@drop#1#2#3#4#5#6#7#8{%
+ \global\@noskipsectrue
+ \gdef\ttl@makeline##1{##1}%
+ \ttl@changecentercr
+ #1\ifhmode\ttl@hmode@error\fi
+ \parindent\z@
+ \global\setbox\ttl@box\vtop{\setlength\hsize{#6}%
+ \color@begingroup
+ \ifttl@label{#2}\ttl@calc\hspace{#3}\fi
+ #4{#8}\kern\z@\strut
+ \@@par
+ \color@endgroup}%
+ \advance\@tempskipa1.5\baselineskip
+ \advance\@tempskipa\ht\ttl@box
+ \advance\@tempskipa\dp\ttl@box
+ \advance\@tempskipa-\pagegoal
+ \advance\@tempskipa\pagestretch
+ \@tempskipb\pagegoal
+ \pagegoal-\@tempskipa
+ \ifdim\bottomtitlespace<\z@\else
+ \def\@textbottom{\vskip\z@\@plus.0001fil}%
+ \fi
+ \penalty9999
+ \pagegoal\@tempskipb
+ \@tempdima\ht\ttl@box \advance\@tempdima\dp\ttl@box
+ \@tempdimb\@tempdima
+ \divide\@tempdima\baselineskip \count@\@tempdima
+ \advance\count@
+ \ifdim\@tempdimb<\the\count@.5\baselineskip\@ne\else\tw@\fi
+ \dp\ttl@box=\z@
+ \if@nobreak\advance\count@\@ne\fi
+ \xdef\@svsechd##1##2{%
+ \noexpand\llap{\box\ttl@box##2}%
+ \setbox\z@\hbox{\noexpand\ttl@calc\noexpand\hspace{#6}\relax##2}%
+ \global\hangindent\wd\z@
+ \global\hangafter-\the\count@\relax}}
+
+\endinput
diff --git a/Master/texmf-dist/tex/latex/titlesec/frame.tss b/Master/texmf-dist/tex/latex/titlesec/frame.tss
new file mode 100644
index 00000000000..3ef381d89b0
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/titlesec/frame.tss
@@ -0,0 +1,61 @@
+% +--------------------------------------------------+
+% | Typeset titlesec.tex to get the documentation. |
+% +--------------------------------------------------+
+%
+% Copyright (c) 1998-2005 by Javier Bezos.
+% All Rights Reserved.
+%
+% This file is part of the titlesec distribution release 2.6
+% -----------------------------------------------------------
+%
+% This program can be redistributed and/or modified under the terms
+% of the LaTeX Project Public License Distributed from CTAN
+% archives in directory macros/latex/base/lppl.txt; either
+% version 1 of the License, or any later version.
+
+\ProvidesFile{frame.tss}[2005/01/22]
+
+\gdef\ttlh@frame#1#2#3#4#5#6#7#8{%
+ \def\ttl@filleft##1{\hfill}%
+ \def\ttl@filright##1{\hfill}%
+ \gdef\ttl@makeline##1{%
+ \ttl@calc\hspace{#6}##1\ttl@calc\hspace{#7}}%
+ \interlinepenalty\@M
+ \ttl@changecentercr
+ #1\ifhmode\ttl@hmode@error\fi
+ \parindent\z@
+ \leavevmode
+ \@tempdima\fboxrule
+ \addtolength\@tempdima{#3}%
+ \setlength\leftskip{#6}%
+ \setlength\rightskip{#7}%
+ \lower\@tempdima\hbox{%
+ \everypar{}%
+ \setbox\z@\hbox{#2}%
+ \addtolength\hsize{-#6}%
+ \addtolength\hsize{-#7}%
+ \@tempdima\dp\z@ % 2002/3/22
+ \advance\@tempdima.5\ht\z@
+ \vbox{%
+ \hbox to \hsize{%
+ \leaders\hrule\@height\fboxrule\ttl@filleft{#3}%
+ \ifttl@label\lower.5\ht\z@\box\z@\fi
+ \leaders\hrule\@height\fboxrule\ttl@filright{#3}}%
+ \vskip-\lineskip
+ \ifttl@label\vskip-\@tempdima\fi
+ \hbox{%
+ \vrule\@width\fboxrule
+ \kern-\fboxrule
+ \vbox{%
+ \ttl@calc\vspace{#3}%
+ \leavevmode
+ \addtolength\leftskip {#3}\addtolength\leftskip{-#6}%
+ \addtolength\rightskip{#3}\addtolength\rightskip{-#7}%
+ \strut#4{#8}\kern\z@\strut\@@par
+ \ttl@calc\vspace{#3}}%
+ \kern-\fboxrule
+ \vrule\@width\fboxrule}%
+ \hrule\@height\fboxrule}}%
+ \@@par\nobreak#5\@@par}
+
+\endinput
diff --git a/Master/texmf-dist/tex/latex/titlesec/leftmargin.tss b/Master/texmf-dist/tex/latex/titlesec/leftmargin.tss
new file mode 100644
index 00000000000..7e10ecfc55d
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/titlesec/leftmargin.tss
@@ -0,0 +1,54 @@
+% +--------------------------------------------------+
+% | Typeset titlesec.tex to get the documentation. |
+% +--------------------------------------------------+
+%
+% Copyright (c) 1998-2005 by Javier Bezos.
+% All Rights Reserved.
+%
+% This file is part of the titlesec distribution release 2.6
+% -----------------------------------------------------------
+%
+% This program can be redistributed and/or modified under the terms
+% of the LaTeX Project Public License Distributed from CTAN
+% archives in directory macros/latex/base/lppl.txt; either
+% version 1 of the License, or any later version.
+
+\ProvidesFile{leftmargin.tss}[2005/01/22]
+
+\gdef\ttlh@leftmargin#1#2#3#4#5#6#7#8{%
+ \global\@noskipsectrue
+ \addtolength\@tempskipb{#6}%
+ \xdef\ttl@makeline##1{\hskip-\the\@tempskipb\relax##1}%
+ \leftskip\z@skip
+ \rightskip\z@skip
+ \ttl@changecentercr
+ #1\ifhmode\ttl@hmode@error\fi
+ \parindent\z@
+ \global\setbox\ttl@box\vtop{%
+ \setlength\hsize{#6}%
+ \linewidth\hsize
+ \everypar{}%
+ \color@begingroup
+ \ifttl@label{\strut#2\strut}\ttl@calc\hspace{#3}\fi
+ \strut#4{#8}\kern\z@\strut\@@par
+ \color@endgroup}%
+ \advance\@tempskipa\ht\ttl@box
+ \advance\@tempskipa\dp\ttl@box
+ \advance\@tempskipa-\pagegoal
+ \advance\@tempskipa\pagestretch
+ \@tempskipb\pagegoal
+ \pagegoal-\@tempskipa
+ \ifdim\bottomtitlespace<\z@\else
+ \def\@textbottom{\vskip\z@\@plus.0001fil}%
+ \fi
+ \penalty9999
+ \pagegoal\@tempskipb
+ \dp\ttl@box=\z@
+ \gdef\@svsechd##1##2{%
+ \llap{\box\ttl@box##2}%
+ \if@afterindent\hskip\parindent\fi}}
+
+\endinput
+
+
+
diff --git a/Master/texmf-dist/tex/latex/titlesec/margin.tss b/Master/texmf-dist/tex/latex/titlesec/margin.tss
new file mode 100644
index 00000000000..3773340c8d3
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/titlesec/margin.tss
@@ -0,0 +1,54 @@
+% +--------------------------------------------------+
+% | Typeset titlesec.tex to get the documentation. |
+% +--------------------------------------------------+
+%
+% Copyright (c) 1998-2005 by Javier Bezos.
+% All Rights Reserved.
+%
+% This file is part of the titlesec distribution release 2.6
+% -----------------------------------------------------------
+%
+% This program can be redistributed and/or modified under the terms
+% of the LaTeX Project Public License Distributed from CTAN
+% archives in directory macros/latex/base/lppl.txt; either
+% version 1 of the License, or any later version.
+
+\ProvidesFile{margin.tss}[2005/01/22]
+
+\gdef\ttlh@margin#1#2#3#4#5#6#7#8{%
+ \global\@noskipsectrue
+ \addtolength\@tempskipb{#6}%
+ \xdef\ttl@makeline##1{\hskip-\the\@tempskipb\relax##1}%
+ \leftskip\z@skip
+ \rightskip\z@skip
+ \ttl@changecentercr
+ #1\ifhmode\ttl@hmode@error\fi
+ \parindent\z@
+ \global\setbox\ttl@box\vtop{%
+ \setlength\hsize{#6}%
+ \linewidth\hsize
+ \everypar{}%
+ \color@begingroup
+ \ifttl@label{\strut#2\strut}\ttl@calc\hspace{#3}\fi
+ \strut#4{#8}\kern\z@\strut\@@par
+ \color@endgroup}%
+ \advance\@tempskipa\ht\ttl@box
+ \advance\@tempskipa\dp\ttl@box
+ \advance\@tempskipa-\pagegoal
+ \advance\@tempskipa\pagestretch
+ \@tempskipb\pagegoal
+ \pagegoal-\@tempskipa
+ \ifdim\bottomtitlespace<\z@\else
+ \def\@textbottom{\vskip\z@\@plus.0001fil}%
+ \fi
+ \penalty9999
+ \pagegoal\@tempskipb
+ \dp\ttl@box=\z@
+ \gdef\@svsechd##1##2{%
+ \llap{\box\ttl@box##2}%
+ \if@afterindent\hskip\parindent\fi}}
+
+\endinput
+
+
+
diff --git a/Master/texmf-dist/tex/latex/titlesec/rightmargin.tss b/Master/texmf-dist/tex/latex/titlesec/rightmargin.tss
new file mode 100644
index 00000000000..199015a4243
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/titlesec/rightmargin.tss
@@ -0,0 +1,51 @@
+% +--------------------------------------------------+
+% | Typeset titlesec.tex to get the documentation. |
+% +--------------------------------------------------+
+%
+% Copyright (c) 1998-2005 by Javier Bezos.
+% All Rights Reserved.
+%
+% This file is part of the titlesec distribution release 2.6
+% -----------------------------------------------------------
+%
+% This program can be redistributed and/or modified under the terms
+% of the LaTeX Project Public License Distributed from CTAN
+% archives in directory macros/latex/base/lppl.txt; either
+% version 1 of the License, or any later version.
+
+\ProvidesFile{rightmargin.tss}[2005/01/22]
+
+\gdef\ttlh@rightmargin#1#2#3#4#5#6#7#8{%
+ \global\@noskipsectrue
+ \addtolength\@tempskipb{#6}%
+ \xdef\ttl@makeline##1{##1\hskip-\the\@tempskipb}%
+ \leftskip\z@skip
+ \rightskip\z@skip
+ \ttl@changecentercr
+ #1\ifhmode\ttl@hmode@error\fi
+ \parindent\z@
+ \global\setbox\ttl@box\vtop{%
+ \setlength\hsize{#6}%
+ \linewidth\hsize
+ \everypar{}%
+ \color@begingroup
+ \ifttl@label{\strut#2\strut}\ttl@calc\hspace{#3}\fi
+ \strut#4{#8}\kern\z@\strut\@@par
+ \color@endgroup}%
+ \advance\@tempskipa\ht\ttl@box
+ \advance\@tempskipa\dp\ttl@box
+ \advance\@tempskipa-\pagegoal
+ \advance\@tempskipa\pagestretch
+ \@tempskipb\pagegoal
+ \pagegoal-\@tempskipa
+ \ifdim\bottomtitlespace<\z@\else
+ \def\@textbottom{\vskip\z@\@plus.0001fil}%
+ \fi
+ \penalty9999
+ \pagegoal\@tempskipb
+ \dp\ttl@box=\z@
+ \gdef\@svsechd##1##2{%
+ \rlap{\hskip\textwidth##2\box\ttl@box}%
+ \if@afterindent\hskip\parindent\fi}}
+
+\endinput
diff --git a/Master/texmf-dist/tex/latex/titlesec/titlesec.sty b/Master/texmf-dist/tex/latex/titlesec/titlesec.sty
new file mode 100644
index 00000000000..b43d0f32fcb
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/titlesec/titlesec.sty
@@ -0,0 +1,1453 @@
+% +--------------------------------------------------+
+% | Typeset titlesec.tex to get the documentation. |
+% +--------------------------------------------------+
+%
+% Copyright (c) 1998-2005 by Javier Bezos.
+% All Rights Reserved.
+%
+% This file is part of the titlesec distribution release 2.6
+% -----------------------------------------------------------
+%
+% This program can be redistributed and/or modified under the terms
+% of the LaTeX Project Public License Distributed from CTAN
+% archives in directory macros/latex/base/lppl.txt; either
+% version 1 of the License, or any later version.
+
+% History of v1.0
+% ~~~~~~~~~~~~~~~
+% 1998/02/25: Added nops option
+% 1998/02/28: Added \@mkboth stuff in \setmarks
+% 1998/03/01: Changed test in \ttl@secnum
+% 1998/03/03: Corrected some \fil... commands
+% 1998/03/03: Replaced the faulty \@hangfrom by new commands
+% 1998/03/03: Some \def replaced by \newcommand
+% 1998/03/04: .dtx/.ins scheme finally rejected. Useless
+% for users, obtrusive for `readers' and proned
+% to errors
+% 1998/03/04: Tidied up documentation
+% 1998/03/06: \wordsep renamed and documented
+% 1998/03/06: Added dummy asignation in \ttl@chap.
+% 1998/03/06: Removed \ttl@xsect and merged into \tl@sect
+% 1998/03/06: Added \ProvidesPackage
+
+% History of v1.1
+% ~~~~~~~~~~~~~~~~
+% 1998/03/25: \chapter corrected, as well as the size options
+% 1998/03/26: Added compact option
+% 1998/03/26: Added flushleft, flushright and center options
+% 1998/04/08: Changed all instances of \noindent by \parindent\z@
+% 1998/04/14: Added \filinner, \filouter
+% 1998/04/14: Added drop shape
+% 1998/05/01: Added rightmargin shape (and margin renamed to
+% leftmargin)
+% 1998/05/03: Added \setheadindent
+%
+% History of v1.2 (unreleased)
+% ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+%
+% 1998/06/01: Compatibility with AMS classes
+% 1998/06/08: On-demand loading of shapes
+% 1998/06/11: Frame shape. Some \fil... command
+% modified to work in the label of this
+% chapter shape.
+% 1998/07/03: Bottomtitle option (at last...)
+% 1998/07/14: ...margin styles bug fixed using a method
+% similar to bottomtitle.
+% 1998/07/29: \titleline
+
+%
+% History of v2.0
+% ~~~~~~~~~~~~~~~~
+%
+% 1998/08/05 to
+% 1998/08/29: Fully reimplemented
+%
+% History of v2.1
+% ~~~~~~~~~~~~~~~~
+% 1999/01/05: We define in this file the three basic shapes.
+% Additional ones remain defined in external files.
+% Unified the shapes for sections and chapters.
+% 1999/01/05: \ttl@shape merged into \ttl@format@iii.
+% 1999/01/05: \titlerule
+% 1999/01/07: \ttl@defkeys splitted from \ttl@keys
+% 1999/01/10: Added the \part stuff, including a definition of \@openright
+% 1999/01/11: Removed unnecessary \ttl@numsecfalse in \ttl@sect@i.
+% 1999/01/14: Optimized \titlerule
+% 1999/01/27: Changed \titleline to correct the spacing at the
+% top page and to fix a bug which changed the mode
+% to horizontal, thus introducing unwanted space
+% (\makebox -> \@makebox).
+% 1999/02/02: \ttl@secnum renamed to \ttl@write and introduced the
+% \ttl@savewrite mechanism to sincronize the toc/marks
+% with the title in case there is a \newpage in <after>.
+% 1999/02/03: wrap shape
+% 1999/02/03: Added a \kern\z@ for not to avoid hyphenation
+% of the last word. Not strictly necessary, but
+% it is more LaTeX-like.
+% 1999/02/05: \partmark defined (and in \setmarks, too).
+% 1999/02/08: \ttl@row@i simplified.
+% 1999/02/08: \ttl@savefn mechanism.
+% 1999/02/10: Removed extra \leavevmode in display
+% 1999/02/13: Now \titleline doesn't add the width. It's set.
+% 1999/02/17: The part mark is catched, even if unused.
+% 1999/02/17: old/newparttoc added.
+% 1999/02/18: Changed many TeX assignments to the LaTeX
+% counterpart.
+% 1999/02/19: Introduced \ttl@startargs.
+%
+% History of v2.1.1
+% ~~~~~~~~~~~~~~~~~
+% 1999/08/04: Moved misplaced lines in \ttl@makeboth
+%
+% History of v2.2 (unreleased)
+% ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+% 1999/11/03: We load titleps if pagestyles are required, but
+% some old definitions are restored.
+% 1999/11/06: Improved outermarks test in \ttl@sect@i. Formerly
+% the section number could be printed if a page ended
+% with an unnumebered section followed by a numbered one.
+% 1999/11/06: \ttl@startargs now adds (and passes) automatically the
+% section name. Involved macros modified accordingly.
+% 1999/11/06: Replaced explicit part names by the parameter in
+% \ttl@part@i. The same for chapter.
+% 1999/11/21: \ttl@try's are not given explicitly, but built by
+% \ttl@setkeys. Intruduced the \ttl@key@... and
+% \ttl@extra@... commands.
+% 1999/11/23: Minor problems with keys fixed.
+% 1999/12/10: Added the nobottomtitles* option and \ttl@addstretch.
+% 2000/01/07: First steps towards the calcwidth feature (basic code).
+% 2000/01/08: (Continued.) \titleline* for rules of width \titlewidth.
+% Option calcwidth implemented.
+% 2000/01/12: Finished with changes in wrap.tss (no longer
+% "experimental" :-) )
+%
+% History of v2.3
+% ~~~~~~~~~~~~~~~
+% 2000/01/19: All keys are grouped in a single file tttkeys. Removed
+% page.tsk and deleted the corresponding code in the sty.
+% 2000/01/19: Classes begun.
+% 2000/01/19: The level numbers are stored in \ttll@ macros, and not
+% passed as arguments.
+% 2000/01/21: Introduced the new mark scheme. It's mostly compatible
+% with the old one, but a compatibility mode seems
+% imposible (it was introduced in a preliminary test
+% but eventually removed).
+% 2000/01/23: loadonly package option.
+% 2000/02/01: Classes finished. Many things had to be rewritten.
+% 2000/02/02: Made partially compatible with hyperref (dvips).
+% 2000/02/08: \ttl@savewrite moved from shapes to classes. But
+% explicit page breaks expand it, too, to avoid wrong
+% toc entries.
+% 2000/02/18: A new box named \ttl@box stores the title in runin
+% leftmargin etc shapes, to increase reliability.
+%
+% (2.3.1 -- 2.3.3: No changes on this file)
+%
+% History of v2.3.4
+% ~~~~~~~~~~~~~~~~~
+% 2000/05/12: nonindentfirst redefine \titlespacing instead of
+% \@afterindent... so that they don't interfere with
+% the first entry in tocs.
+% 2000/05/17: The marks in \ttl@select are protected to prevent
+% endless loop if the title is expanded, say, by
+% \MakeUppercase.
+%
+% History of v2.3.5
+% ~~~~~~~~~~~~~~~~~
+% 2000/05/21: Restores missing test for secnumdepth in \ttl@mkchap,
+% and instead of setting \ttl@toclevel in ttlps now is
+% done in \secdef. Except inside the macros, \ttl@toclevel
+% is false, so that an explicit \...mark works.
+% 2000/06/04: \partmark defined with \providecommand
+% 2000/06/14: A patch mechanism added, for small bug fixes.
+%
+% History of v2.4
+% ~~~~~~~~~~~~~~~~
+% 2001/01/18: Minor changes in code. Essentialy an incremental
+% update.
+% 2001/01/22: \titleformat has a new "easy" starred variant.
+%
+% History of v2.5
+% ~~~~~~~~~~~~~~~
+% 2002/01/02 New macros for \ttl@assign. Now * length allow
+% non integer values.
+% 2002/03/22 Added \ttl@calc and \ttl@calcneg to make titlesec
+% calc-savvy.
+% - Merged bug fixes of .new into this file.
+% - Bugs in frame fixed -- gap in lines, misplaced
+% label, wrong margins (sometimes),
+% - \leftskip, \rightskip and \linewidth (re)set in
+% margin shapes.
+% - Removed obsolete flush... options.
+% - indentafter and noindentafter, new names for
+% indentfirst and nonindentfirst.
+% - A new level (\titleclass) without its "location"
+% now raises a meaningful error.
+% - Bug in top-level \titleclass fixed.
+% 2002/03/23 Tests for undefined and unformatted sectioning levels,
+% and horizontal material in <format>.
+% - Missing \if@openright inside \if@twoside in
+% page class added.
+% - Removed extra (but inoffensive) \expandafter
+% in \ttl@class@iii.
+% 2002/03/27 Added \titlewidthfirst and ...last
+% - «Not definable» gives a more meaningful message in
+% the context of the package.
+%
+% History of v.2.6
+% ~~~~~~~~~~~~~~~~
+% 2004/08/30 Corrected typo in margin \hsiz -> \hsize.
+% 2004/10/17 Added a couple of missing \noexpand's in drop.
+% 2004/12/01 Removed the error about the mode in block because this
+% style is general purpose.
+% 2005/01/16 Missing braces around #2 in the last else part of
+% \ttl@headinline added
+% - Replaced explicit \makeatother's by a saved value as
+% the macros can be used in a class/package file.
+% 2005/01/18 newlinetospace mechanism
+% 2005/01/18 // does not break pages; option pageatnewline to
+% restore the LaTeX behaviour.
+% 2005/01/19 \...break in top shape.
+% - Renumbered several scratch registers to follow the
+% TeXbook (p. 346), with \ttl@box in a few cases. In
+% wrap \titlewidthfirst and \titlewidthlast made global.
+% - Float heads and foots have now a further argument for
+% additional stuff (eg, to remove rules). Option is now
+% psfloats while floatps enters in compatibility mode.
+% - \ttl@savetitle in all classes. Option toctitles.
+% 2005/01/21 Changed pageatnewline to make it compatible with
+% titletoc, with \ttl@changecentercr.
+% 2005/01/22 \...tolist in top class.
+%
+% Notes
+% ~~~~~
+%
+% The following tags are used:
+% ttl@ : the generic tag used through the style
+% ttlh@ : a shape definition
+% ttlf@ : a macro containing the title format
+% ttls@ : id. the title space
+% ttlp@ : page key related macros
+% ttll@ : level number
+%
+% The ttlf@ and ttls@ contains data in the form {..}{..}.
+% Perhaps in future releases they should be converted
+% to a prop-like list, similar to that proposed by the
+% latex team.
+%
+% Admittedly, the current implementation seems too
+% complicated, but that's necessary in order to provide
+% certain compatibility with the sections as defined by the
+% used class. Other packages opt for providing the sections
+% as defined by standard classes ignoring the class; for
+% instance sectsty which does a simple task in a simple and
+% nice way. However, that was not my goal.
+%
+% Release
+% ~~~~~~~
+
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{titlesec}[2005/01/22 v2.6 Sectioning titles]
+
+% Initialization
+% ~~~~~~~~~~~~~~
+
+\newif\ifttl@ps
+\ttl@psfalse
+
+% The \ttl@label switch is used when printing the label in titles.
+% A numberless variant makes it to true.
+% There is a \ttl@toclabel as well, which is true iff the
+% title is numbered; used in toc entries (except default part
+% and chapter) and marks (only in titlesec pagestyles).
+
+\newif\ifttl@label
+\newif\ifttl@toclabel
+
+\newbox\ttl@box
+
+% A provision for the report style:
+
+\@ifundefined{if@mainmatter}
+ {\let\if@mainmatter\iftrue}{}
+
+\@ifundefined{if@openright}
+ {\let\if@openright\iftrue}{}
+
+% and the ams styles as well
+
+\@ifundefined{@chapapp}
+ {\let\@chapapp\chaptername}{}
+
+\def\ttl@trylist{\ttl@try{}}
+
+\def\ttl@getkeys#1#2{%
+ \if\expandafter @\@gobble#1@\@empty
+ \edef\ttl@b{\expandafter\@gobble\string#1}%
+ \let\ttl@a\ttl@b
+ \else
+ \makeatletter
+ \edef\ttl@d{%
+ \noexpand\input{ttlkeys.def}%
+ \catcode`\noexpand\@=\the\catcode`\@}%
+ \ttl@d
+ \ttl@getkeys{#1}{#2}%
+ \fi}
+
+% A more meaningful error for \@notdefinable
+
+\expandafter\AtEndOfPackage\expandafter{\expandafter
+ \gdef\expandafter\@notdefinable\expandafter{\@notdefinable}}
+
+\def\@notdefinable{%
+ \PackageError{titlesec}%
+ {Incompatible package}%
+ {Titlesec cannot continue defining its own macros
+ because\MessageBreak
+ \@backslashchar\reserved@a\space is already used by other package,
+ the class\MessageBreak
+ or the document.}}
+
+% +-----------------+
+% | C L A S S E S |
+% +-----------------+
+
+\def\ttl@useclass#1#2{%
+ \@ifstar
+ {\ttl@labelfalse#1{#2}[]}%
+ {\ttl@labeltrue\@dblarg{#1{#2}}}}
+
+\def\ttl@straightclass{\ttl@useclass\ttl@straight@i}
+\def\ttl@partclass{\ttl@useclass\ttl@part@i}
+\def\ttl@topclass{\ttl@useclass\ttl@top@i}
+\def\ttl@pageclass{\ttl@useclass\ttl@page@i}
+
+\newcommand\titleclass[1]{%
+ \edef\ttl@a{\expandafter\@gobble\string#1}%
+ \@ifnextchar[{\@tempswatrue\ttl@class@i{#1}}%
+ {\@tempswafalse\ttl@class@ii{#1}}}
+
+\def\ttl@class@i#1[#2]{%
+ \@namedef{ttll@\ttl@a}{#2}%
+ \expandafter\providecommand\csname\ttl@a title\endcsname{}%%%%
+ \@ifundefined{ttl@toplevel}{}%
+ {\expandafter\let\csname ttlss@\ttl@a\expandafter\endcsname
+ \csname ttlss@\ttl@toplevel\endcsname}%
+ \edef\ttl@toplevel{\ttl@a}%
+ \ttl@class@ii{#1}}
+
+\def\ttl@class@ii#1#2{%
+ \@ifundefined{ttl@#2class}%
+ {\PackageError{titlesec}{Unknown sectioning class}%
+ {Valid names are top, page and stright}}%
+ {\expandafter\let\csname ttl@compat\ttl@a\endcsname\relax
+ \@ifundefined{\ttl@a mark}%
+ {\@namedef{\ttl@a mark}{\@gobble}}%
+ {}%
+ \edef#1{%
+ \expandafter\noexpand\csname ttl@#2class\endcsname{\ttl@a}}}%
+ \if@tempswa
+ \expandafter\@gobble
+ \else
+ \expandafter\@firstofone
+ \fi
+ {\@ifnextchar[%
+ {\ttl@class@iii}%
+ {\@ifundefined{ttll@\ttl@a}%
+ {\PackageError{titlesec}{Unknown sectioning level}%
+ {\string\titleclass\space with no optional arguments\MessageBreak
+ only changes the class of an *existing* level}}}}}
+
+\def\ttl@class@iii[#1]{%
+ \edef\ttl@b{\expandafter\@gobble\string#1}%
+ \expandafter\let\csname ttlss@\ttl@a\expandafter\endcsname
+ \csname ttlss@\ttl@b\endcsname
+ \expandafter\edef\csname ttlss@\ttl@b\endcsname{\ttl@a}%
+ \let\ttl@a\ttl@toplevel
+ \count@\csname ttll@\ttl@toplevel\endcsname
+ \ttl@class@iv}% \expandafter
+
+\def\ttl@class@iv{%
+ \@ifundefined{ttlss@\ttl@a}{}%
+ {\advance\count@\@ne
+ \edef\ttl@a{\csname ttlss@\ttl@a\endcsname}%
+ \expandafter\edef\csname ttll@\ttl@a\endcsname{\the\count@}%
+ \ttl@class@iv}}
+
+% Typesetting Classes: General tools
+% ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+% The following command handles the *n spacing
+% Some tricks are necessary to multiply a
+% skip by a non integer number
+
+\newskip\beforetitleunit
+\beforetitleunit=1ex\@plus.3ex\@minus.06ex
+\newskip\aftertitleunit
+\aftertitleunit=1ex\@plus.1ex
+
+\newdimen\ttl@plus
+\newdimen\ttl@minus
+
+\def\ttl@assign#1{%
+ \@ifstar
+ {\ttl@assign@i{#1}}%
+ {\ttl@assign@d{#1}}}
+
+\def\ttl@assign@i#1#2\relax#3{%
+ \ttl@plus\z@
+ \ttl@minus\z@
+ \afterassignment\ttl@assign@ii
+ \dimen@\the#3, % <- space
+ #1 = #2\dimen@
+ plus #2\ttl@plus
+ minus #2\ttl@minus}
+
+\def\ttl@assign@ii#1 {% <- space
+ \if#1,\else\afterassignment\ttl@assign@ii\fi
+ \csname ttl@\string#1\endcsname}
+
+\def\ttl@assign@d#1#2\relax#3{\setlength#1{#2}}
+
+% To be used with \v/vspace to make them calc-savvy
+
+\def\ttl@calc#1#2{%
+ {\setlength\@tempskipa{#2}%
+ #1\@tempskipa}}
+
+\def\ttl@calcneg#1#2{%
+ {\setlength\@tempskipa{#2}%
+ #1{-\@tempskipa}}}
+
+% Gets from ttls@ and passes the spacing parameters:
+
+\def\ttl@startargs#1#2{% Get the first arguments, with the spacing
+ \@ifundefined{ttlp@#2}%
+ {\let\ttl@key@page\@empty}%
+ {\ttlp@fetch{#2}}%
+ \begingroup
+ \def\ttl@b{ttls@#2}%
+ \edef\ttl@key@numberless{\ifttl@label//\else/*\fi}%
+ \def\ttl@a##1{\csname ttl@key@##1\endcsname}% Used as elt in try
+ \ttl@trylist
+ \xdef\ttl@b{\ttl@c}%
+ \endgroup
+ \ifx\ttl@b\@empty
+ \PackageError{titlesec}{Format/spacing not found}%
+ {I was unable to find the format corresponding to #2.\MessageBreak
+ Maybe you haven't set it with \string\titleformat\space and
+ \string\titlespacing}
+ \fi
+ \expandafter#1\ttl@b{#2}}
+
+% Used in ttl@select
+
+\def\ttl@savefn#1[#2]#3{%
+ \ifcase#1%
+ \footnotemark[#2]%
+ \gdef\ttl@fn{\footnotetext[#2]{#3}}%
+ \else
+ \footnotemark
+ \gdef\ttl@fn{\footnotetext{#3}}%
+ \fi}
+
+\def\ttl@nest@error{%
+ \PackageError{titlesec}{Nested titles}{Titles must not be nested}}
+
+\def\ttl@hmode@error{%
+ \PackageError{titlesec}{Entered in horizontal mode}
+ {The <format> argument cannot contain horizontal material\MessageBreak
+ such as text, \string\noindent, \string\makebox, etc.}}
+
+% \ttl@select not only selects the right version to be
+% used. It also take steps to ensure that a mark
+% is not lost inside a box by saving it into \ttl@mk,
+% which in turn is used by the sect and chap commands.
+
+\def\ttl@gmk#1{\gdef\ttl@mk{#1}}
+
+\def\ttl@select#1#2#3#4{%
+ \ttl@Hy@saveanchor
+ \global\let\ttl@mk\@empty % global because of rigidchapters
+ \global\let\ttl@fn\@empty
+ \begingroup
+ \everypar{\setbox\z@\lastbox\strut}% or \hskip-\parindent?
+ \let\ttl@straight@i\ttl@nest@error
+ \let\ttl@top@i \ttl@nest@error
+ \let\ttl@part@i \ttl@nest@error
+ \let\ttl@page@i \ttl@nest@error
+ \let\ttl@newpage\newpage
+ \def\newpage{\ttl@savewrite\ttl@newpage}%
+ \def\markboth##1##2{\protect\ttl@gmk{\protect\markboth{##1}{##2}}}%
+ \def\markright##1{\protect\ttl@gmk{\protect\markright{##1}}}%
+ \def\@mkboth##1##2{\protect\ttl@gmk{\protect\@mkboth{##1}{##2}}}%
+ \def\footnote{\@ifnextchar[%
+ {\ttl@savefn\z@}{\ttl@savefn\@ne[]}}%
+ \edef\ttl@key@numberless{\ifttl@label//\else/*\fi}%
+ \def\ttl@b{ttlf@#1}%
+ \def\ttl@a##1{\csname ttl@key@##1\endcsname}% Used as elt in try
+ \ttl@trylist
+ \ttl@c{#2}{#3}{#4}% ttl@c is returned by ttl@try with ttlf@...
+ \endgroup}
+
+\let\ttl@savewrite\@empty
+
+\def\ttl@finmarks{%
+ \ttl@savewrite
+ \ttl@mk % Contains a possible mark, returned by \ttl@select
+ \ttl@fn} % And a footnote
+
+\def\ttl@try#1{%
+ \edef\ttl@c{#1}% #1 is a list in the form \ttl@a{key}\ttl@a{key}
+ \@ifundefined{\ttl@b\ttl@c}{}{%
+ \edef\ttl@c{\expandafter\noexpand\csname\ttl@b\ttl@c\endcsname}%
+ \def\ttl@a##1{\csname ttl@extra@##1\endcsname}%
+ #1%
+ \let\ttl@try\@gobble}} % locally modified to `break' testings
+
+% \ttl@write writes marks and toc. tocdepth is taken
+% care of when the toc is typesetted and not here.
+% Used always through ttl@savewrite
+
+\def\ttl@write#1#2{%
+ \ttl@blinemarks
+ \csname#1mark\endcsname{#2}%
+ \def\ttl@a{\protect\numberline{\@nameuse{the#1}}}%
+ \@nameuse{ttl@toc#1}% eg, \ttl@tocpart modifies \ttl@a
+ \ttl@addcontentsline{#1}{#2}% Depends on toctitles
+ \ttl@elinemarks
+ \global\ttl@toclabelfalse}
+
+% Must be preceded by a default \ttl@savewrite, which is used
+% in starred variants--\@empty in top and straight classes.
+% In straight class, it is preceded by the setting of
+% prev marks to provide a "fixed" top mark. Otherwise,
+% the default prev mark (= curr mark) is used (restored
+% after ttl@labelling in straight). This is the command
+% to be hacked if you want to change the behaviour of
+% starred variants.
+
+\def\ttl@labelling#1#2{%
+ \let\ttl@Hy@saveanchor\@empty
+ \ifttl@label % First: if star
+ \def\ttl@savewrite{\ttl@write{#1}{#2}}%
+ \@nameuse{ttl@#1label}% eg, sets if mainmatter in chapter.
+ \ifttl@label % Second, eg, if not main matter
+ \ifnum\@nameuse{ttll@#1}>\c@secnumdepth\relax
+ \ttl@labelfalse % Third: if too deep
+ \else
+ \ttl@Hy@refstepcounter{#1}%
+ \fi
+ \fi
+ \fi
+ \let\ifttl@toclabel\ifttl@label
+ \ifx\ttl@savewrite\@empty\else % If marks
+ \ifttl@ps
+ \ttl@blinemarks
+ \csname#1mark\endcsname{#2}%
+ \ttl@elinemarks
+ \fi
+ \ifttl@label\else\ttl@Hy@steplink{#1}\fi
+ \fi}
+
+% Executed by ttl@labelling if the name of section is chapter:
+
+\def\ttl@chapterlabel{%
+ \if@mainmatter\else\ttl@labelfalse\fi
+ \typeout{\chaptertitlename\space\thechapter.}}
+
+% Straight class
+% ~~~~~~~~~~~~~
+% Default for nobottomtitles. Changed by nobottomtitles*
+
+\def\ttl@addstretch{\advance\@tempskipa-\pagestretch}
+
+% 1:name 2:level 3:indent 4:before 5:after 6:afind [7]:cap 8:title
+% The second argument of ttl@sect is the level, which
+% is empty if the star version is used. In this case
+% neither the toc nor the marks are written.
+
+\def\ttl@straight@i#1[#2]#3{%
+ \def\@currentlabelname{#2}% for nameref
+ \gdef\ttl@savemark{\csname#1mark\endcsname{#3}}%
+ \let\ttl@savewrite\@empty
+ \def\ttl@savetitle{#3}%
+ \gdef\thetitle{\csname the#1\endcsname}%
+ \if@noskipsec \leavevmode \fi
+ \par
+ \ifttl@ps
+ \protected@xdef\ttl@prevmarks{\ttl@marks}%
+ \fi
+ \ttl@labelling{#1}{#2}%
+ \ifttl@ps
+ \gdef\ttl@prevmarks{\ttl@marks}%
+ \fi
+ \ttl@startargs\ttl@straight@ii{#1}{#3}}
+
+% 1:left 2:right 3:before 4:after 5:afterindent 6:name 7:title
+
+\def\ttl@straight@ii#1#2#3#4#5#6#7{%
+ \ttl@assign\@tempskipa#3\relax\beforetitleunit
+ \if@nobreak
+ \ttl@titlespace{\@tempskipa}%
+ \else
+ \@ifundefined{#6break}%
+ {\addpenalty{\@secpenalty}}%
+ {\csname#6break\endcsname}%
+ \addvspace{\@tempskipa}%
+ \ifdim\bottomtitlespace<\z@
+ \else
+ \begingroup
+ \@tempskipb\pagegoal
+ \@tempskipa\pagegoal
+ \ttl@addstretch % \relax if nobottomtitle*
+ \advance\@tempskipa-\bottomtitlespace\relax % not a register
+ \pagegoal\@tempskipa
+ \def\@textbottom{\vskip\z@\@plus.0001fil}%
+ \penalty9999
+ \pagegoal\@tempskipb
+ \endgroup
+ \fi
+ \fi
+ \@afterindenttrue
+ \ifcase#5 \@afterindentfalse\fi
+ \ttl@assign\@tempskipb#4\relax\aftertitleunit
+ \ttl@select{#6}{#1}{#2}{#7}%
+ \ttl@finmarks
+ \@ifundefined{ttlp@#6}{}{\ttlp@write{#6}}%
+ \if@noskipsec
+ \global\@nobreakfalse
+ \everypar{%
+ \if@noskipsec
+ \global\@noskipsecfalse
+ \clubpenalty\@M
+ \hskip-\parindent
+ \begingroup
+ \@svsechd\unskip{\hspace{\@tempskipb}}%
+ \endgroup
+ \else
+ \clubpenalty\@clubpenalty\everypar{}%
+ \fi}%
+ \else
+ \par\nobreak
+ \vspace{\@tempskipb}%
+ \@afterheading
+ \fi
+ \ignorespaces}
+
+% Part class
+% ~~~~~~~~~~
+
+\providecommand\partmark[1]{\markboth{}{}}
+
+\def\ttl@part@i#1[#2]#3{%
+ \gdef\ttl@savemark{\csname#1mark\endcsname{#3}}%
+ \def\ttl@savewrite{\ttl@write{#1}{#3}}% A default value. Not #2!
+ \def\ttl@savetitle{#3}%
+ \ttl@labelling{#1}{#2}%
+ \ttl@startargs\ttl@part@ii{#1}{#3}}
+
+\def\ttl@part@ii#1#2#3#4#5#6#7{%
+ \ttl@assign\@tempskipa#3\relax\beforetitleunit
+ \vspace*{\@tempskipa}%
+ \global\@afterindenttrue
+ \ifcase#5 \global\@afterindentfalse \fi
+ \ttl@assign\@tempskipb#4\relax\aftertitleunit
+ \ttl@select{#6}{#1}{#2}{#7}%
+ \ttl@finmarks
+ \@ifundefined{ttlp@#6}{}{\ttlp@write{#6}}%
+ \par\nobreak
+ \vspace{\@tempskipb}%
+ \@afterheading}
+
+% Page class
+% ~~~~~~~~~~
+
+\def\ttl@page@i#1[#2]#3{%
+ \gdef\ttl@savemark{\csname#1mark\endcsname{#3}}%
+ \def\ttl@savewrite{\ttl@write{#1}{#3}}% A default value. Not #2!
+ \def\ttl@savetitle{#3}%
+ \ttl@labelling{#1}{#2}%
+ \ttl@startargs\ttl@page@ii{#1}{#3}}
+
+\def\ttl@page@ii#1#2#3#4#5#6#7{%
+ \ttl@assign\@tempskipa#3\relax\beforetitleunit
+ \if@openright
+ \cleardoublepage
+ \else
+ \clearpage
+ \fi
+ \thispagestyle{plain}%
+ \if@twocolumn
+ \onecolumn
+ \@tempswatrue
+ \else
+ \@tempswafalse
+ \fi
+ \vspace*{\@tempskipa}%
+ \@afterindenttrue
+ \ifcase#5 \@afterindentfalse\fi
+ \ttl@assign\@tempskipb#4\relax\aftertitleunit
+ \ttl@select{#6}{#1}{#2}{#7}%
+ \ttl@finmarks
+ \@ifundefined{ttlp@#6}{}{\ttlp@write{#6}}%
+ \vspace{\@tempskipb}%
+ \newpage
+ \if@twoside
+ \if@openright
+ \null
+ \thispagestyle{empty}%
+ \newpage
+ \fi
+ \fi
+ \if@tempswa
+ \twocolumn
+ \fi
+ \ignorespaces}
+
+% Top class and some makechapterhead stuff
+% ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+%
+% \ttl@mkchap is the new make(s)chapterhead.
+
+\def\ttl@mkchap#1#2#3#4#5#6#7{%
+ \gdef\ttl@savemark{\csname#6mark\endcsname{#7}}%
+ \let\ttl@savewrite\@empty
+ \let\ttl@Hy@saveanchor\@empty
+ \let\ifttl@toclabel\ifttl@label
+ \ttl@mkchap@i{#1}{#2}{#3}{#4}{#5}{#6}{#7}}
+
+% But \ttl@mkchap@i is used by both makechapterhead and
+% the top class.
+
+\def\ttl@mkchap@i#1#2#3#4#5#6#7{%
+ \ttl@assign\@tempskipa#3\relax\beforetitleunit
+ \vspace*{\@tempskipa}%
+ \global\@afterindenttrue
+ \ifcase#5 \global\@afterindentfalse\fi
+ \ttl@assign\@tempskipb#4\relax\aftertitleunit
+ \ttl@topmode{\@tempskipb}{%
+ \ttl@select{#6}{#1}{#2}{#7}}%
+ \ttl@finmarks % Outside the box!
+ \@ifundefined{ttlp@#6}{}{\ttlp@write{#6}}}
+
+\def\ttl@top@i#1[#2]#3{%
+ \gdef\ttl@savemark{\csname#1mark\endcsname{#3}}%
+ \let\ttl@savewrite\@empty
+ \def\ttl@savetitle{#3}%
+ \ttl@labelling{#1}{#2}%
+ \ttl@startargs\ttl@top@ii{#1}{#3}}
+
+\def\ttl@top@ii#1#2#3#4#5#6#7{%
+ \@ifundefined{#6break}%
+ {\if@openright
+ \cleardoublepage
+ \else
+ \clearpage
+ \fi}%
+ {\csname#6break\endcsname}%
+ \thispagestyle{plain}%
+ \global\@topnum\z@
+ \@ifundefined{#6tolists}%
+ {\addtocontents{lof}{\protect\ttl@tocsep}%
+ \addtocontents{lot}{\protect\ttl@tocsep}}
+ {\@nameuse{#6tolists}}%
+ \if@twocolumn
+ \@topnewpage[\ttl@mkchap@i{#1}{#2}{#3}{#4}{#5}{#6}{#7}]%
+ \else
+ \ttl@mkchap@i{#1}{#2}{#3}{#4}{#5}{#6}{#7}%
+ \@afterheading
+ \fi
+ \ignorespaces}
+
+
+% \def\ttl@noskipsectrue{%
+% \if@noskipsec
+% \PackageError{titlesec}{Invalid shape for top class}%
+% {The selected shape only makes sense when merged into\MessageBreak
+% a paragraph. That is impossible in the top class}%
+% \else
+
+\newcommand\chaptertitlename{\@chapapp}
+\def\ttl@tocsep{\addvspace{10\p@}}
+
+% +-----------------+
+% | S H A P E S |
+% +-----------------+
+%
+% % Reformatting Titles: Interface
+% ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+% The surrounding space is stored in a macro
+% named \ttls@<section> whose content is
+% {left}{right}{before}{after}{afterindent}.
+% But if there is the page key, the name is
+% \ttls@<section>/<page>
+
+\newcommand\titlespacing{%
+ \@ifstar{\ttl@spacing@i{\z@}}{\ttl@spacing@i{\@ne}}}
+
+\def\ttl@spacing@i#1#2#3#4#5{%
+ \ttl@getkeys{#2}{titlesec}%
+ \@ifnextchar[{%
+ \ttl@spacing@ii{#1}{#3}{#4}{#5}%
+ }{%
+ \ttl@spacing@ii{#1}{#3}{#4}{#5}[\z@]}}
+
+\def\ttl@spacing@ii#1#2#3#4[#5]{%
+ \expandafter\def\csname ttls@\ttl@a\endcsname
+ {{#2}{#5}{#3}{#4}{#1}}}
+
+% The section name is built in \ttl@a.
+% The format is stored in a macro named \ttlf@<section>,
+% or \ttlf@<section>/<page> if there is the page spec,
+% or \ttlf@.../* if numberless is true
+% whose content is
+% \ttl@<shape>{format}{label}{sep}{before}{after}
+
+\newcommand\titleformat{%
+ \@ifstar{\ttl@format@s}%
+ {\ttl@format@i}}
+
+\def\ttl@format@s#1#2{%
+ \edef\ttl@a{\expandafter\@gobble\string #1}%
+ \@ifundefined{ttlf@\ttl@a}%
+ {\PackageError{titlesec}{Not allowed in `easy' settings}
+ {The sectiong command you are trying to redefine\MessageBreak
+ is not handled by the starred variant (eg, \string\part)}}{}
+ \expandafter\expandafter\expandafter
+ \ttl@format@si\csname ttlf@\ttl@a \endcsname
+ {#2}}
+
+\def\ttl@format@si#1#2#3#4#5#6#7{%
+ \@namedef{ttlf@\ttl@a}{#1{#7}{#3}{#4}{#5}{#6}}}
+
+\def\ttl@format@i#1{%
+ \@ifnextchar[{\ttl@format@ii{#1}}{\ttl@format@ii{#1}[hang]}}
+
+\def\ttl@format@ii#1[#2]#3#4#5#6{%
+ \ttl@getkeys{#1}{titlesec}%
+ \@ifnextchar[{%
+ \ttl@format@iii{#2}{#3}{#4}{#5}{#6}%
+ }{%
+ \ttl@format@iii{#2}{#3}{#4}{#5}{#6}[]}}
+
+% First, we get the shape -- if not defined it loads
+% the corresponding file.
+
+
+\def\ttl@format@iii#1#2#3#4#5[#6]{%
+ \@ifundefined{ttlh@#1}{%
+ \begingroup
+ \makeatletter
+ \InputIfFileExists{#1.tss}{}{%
+ \PackageError{titlesec}{Unknown shape}%
+ {Shapes are defined in files with extension tss\MessageBreak
+ Either you have misspelled the shape\MessageBreak
+ or there is no a #1.tss file}}%
+ \endgroup}{}%
+ \expandafter\def\csname ttlf@\ttl@a\expandafter\endcsname
+ \expandafter{\csname ttlh@#1\endcsname{#2}{#3}{#4}{#5}{#6}}%
+ \csname ttl@compat\ttl@a\endcsname}
+
+% Styles
+% ~~~~~~
+
+% 1:global 2:label 3:sep 4:style 5:after 6:left 7:right 8:title
+% \ttl@<shape> and \ttlh@<shape> take the following eight
+% arguments:
+% {format}{label}{sep}{before}{after}{left}{right}{title}
+% where before and after refer to the format.
+
+\def\ttlh@display#1#2#3#4#5#6#7#8{%
+ \gdef\ttl@makeline##1{\ttl@calc\hspace{#6}##1\ttl@calc\hspace{#7}}%
+ \setlength\leftskip{#6}%
+ \setlength\rightskip{#7}%
+ \interlinepenalty\@M
+ \ttl@changecentercr
+ \ttl@beginlongest
+ #1\ifhmode\ttl@hmode@error\fi
+ \ttl@glcmds
+ \parindent\z@
+ \ifttl@label
+ {#2\strut\@@par}\nobreak\ttl@calc\vspace{#3}%
+ \fi
+ #4{#8}%
+ \kern\z@\strut\@@par
+ \nobreak\ttl@midlongest#5\@@par
+ \ttl@endlongest}
+
+\def\ttlh@hang#1#2#3#4#5#6#7#8{%
+ \gdef\ttl@makeline##1{\ttl@calc\hspace{#6}##1\ttl@calc\hspace{#7}}%
+ \setlength\leftskip{#6}%
+ \setlength\rightskip{#7}%
+ \interlinepenalty\@M
+ \ttl@changecentercr
+ \ttl@beginlongest
+ #1{\ifhmode\ttl@hmode@error\fi
+ \ttl@glcmds
+ \parindent\z@
+ \leavevmode
+ \begingroup
+ \ifttl@label
+ \sbox\z@{#2\strut\ttl@calc\hspace{#3}}%
+ \advance\leftskip\wd\z@
+ \llap{\box\z@}%
+ \fi
+ #4{#8}%
+ \kern\z@\strut\@@par
+ \endgroup
+ \nobreak\ttl@midlongest#5\@@par}%
+ \ttl@endlongest}
+
+\def\ttlh@runin#1#2#3#4#5#6#7#8{%
+ \global\@noskipsectrue
+ \gdef\ttl@makeline##1{##1}%
+ \ttl@changecentercr
+ #1{\ifhmode\ttl@hmode@error\fi
+ \global\sbox\ttl@box{%
+ \ttl@calc\hspace{#6}%
+ \ifttl@label{\strut#2}\ttl@calc\hspace{#3}\fi
+ #4{#8}#5\unskip}}%
+ \gdef\@svsechd{\unhbox\ttl@box}}
+
+% +-----------------+
+% | T O O L S |
+% +-----------------+
+%
+% calcwidth
+% ~~~~~~~~~
+% Implemented after code from soul (but much modified...)
+
+\newdimen\titlewidth
+\newdimen\titlewidthlast
+\newdimen\titlewidthfirst
+
+\let\ttl@glcmds\relax
+\let\ttl@beginlongest\@empty
+\let\ttl@midlongest\@empty
+\let\ttl@endlongest\@empty
+
+\def\ttl@xbeginlongest#1\ttl@endlongest{%
+ \titlewidth\z@
+ \titlewidthlast\z@
+ \setbox\ttl@box\vbox{%
+ \def\ttl@glcmds{%
+ \def\\{\@ifstar{\@ifnextchar[{\ttl@bs}{\newline}}%
+ {\@ifnextchar[{\ttl@bs}{\newline}}}%
+ \def\ttl@bs[####1]{\newline}%
+ \let\@centercr\\%
+ \def\ttl@midlongest####1\@@par{}% Very dirty...
+ \advance\rightskip 1\leftskip plus 1fil
+ \leftskip=\z@}%
+ #1}%
+ \ttl@boxprocess
+ #1}
+
+\def\ttl@boxprocess{%
+ \setbox\ttl@box=\vbox{%
+ \unvcopy\ttl@box
+ \unskip\unpenalty
+ \global\setbox\@ne=\lastbox}%
+ \ifvoid\@ne
+ \else
+ \setbox\tw@=\hbox{\hskip-\leftskip\unhbox\@ne\hskip-\rightskip}%
+ \titlewidthfirst\wd\tw@
+ \ifdim\titlewidth<\titlewidthfirst
+ \titlewidth\titlewidthfirst
+ \fi
+ \ifdim\titlewidthlast=\z@
+ \titlewidthlast\titlewidthfirst
+ \fi
+ \expandafter\ttl@boxprocess
+ \fi}
+
+% Rules
+% ~~~~~
+
+\providecommand\titleline{%
+ \@ifstar{\ttl@line@i{\hb@xt@\titlewidth}}%
+ {\ttl@line@i{}}}
+
+\def\ttl@line@i#1{%
+ \@ifnextchar[{\ttl@line{#1}}{\ttl@line{#1}[s]}}
+
+\def\ttl@line#1[#2]#3{%
+ \vskip\topskip
+ \hrule \@height \z@
+ \nobreak
+ \vskip-\topskip
+ \begingroup
+ \parindent\z@
+ \everypar{}%
+ \leftskip\z@
+ \rightskip\z@ % #1 is either \hb@xt@\titlewidth or empty:
+ \@makebox[\hsize][#2]{\ttl@makeline{#1{#3}}}%
+ \par
+ \endgroup
+ \hrule height \z@
+ \nobreak}
+
+\providecommand\titlerule{\@ifstar{\ttl@row}{\ttl@rule}}
+
+\let\ttl@leaders\xleaders % For titletoc compatibility
+
+\def\ttl@row{\@ifnextchar[{\ttl@row@i}{\ttl@row@i[\wd\z@]}}
+\def\ttl@row@i[#1]#2{%
+ \ifvmode\expandafter\titleline\fi
+ {\sbox\z@{#2}%
+ \ttl@calcneg\hspace{#1}%
+ \hskip\wd\z@
+ \ttl@leaders\hb@xt@#1{\hss\box\z@}%
+ \hfill\kern\z@}}
+
+\def\ttl@rule{\@ifnextchar[{\ttl@rule@i}{\ttl@rule@i[.4\p@]}}
+\def\ttl@rule@i[#1]{%
+ \ifvmode\expandafter\titleline\fi
+ {\leaders\hrule height #1\hfill\kern\z@}}
+
+% Par shapes and space
+% ~~~~~~~~~~~~~~~~~~~~
+
+\providecommand\filright{%
+ \gdef\ttl@filleft##1{\hskip##1}%
+ \gdef\ttl@filright##1{\hfill}%
+ \let\\\@centercr
+ \advance\rightskip\z@ \@plus 1fil\relax}
+\providecommand\filleft{%
+ \gdef\ttl@filleft##1{\hfill}%
+ \gdef\ttl@filright##1{\hskip##1}%
+ \let\\\@centercr
+ \advance\leftskip\z@ \@plus 1fil
+ \parfillskip\z@}
+\providecommand\filcenter{\filleft\filright
+ \gdef\ttl@filleft##1{\hfill}}
+\providecommand\fillast{%
+ \gdef\ttl@filleft##1{\hfill}%
+ \gdef\ttl@filright##1{\hfill}%
+ \let\\\@centercr
+ \filleft\advance\rightskip\z@ \@plus -1fil
+ \parfillskip\z@ \@plus 2fil\relax}
+\newcommand\filinner{%
+ \if@twoside
+ \ifodd\count\z@\filleft\else\filright\fi
+ \else
+ \filleft
+ \fi}
+\newcommand\filouter{%
+ \if@twoside
+ \ifodd\count\z@\filright\else\filleft\fi
+ \else
+ \filright
+ \fi}
+
+\newcommand\wordsep{\fontdimen\tw@\font \@plus
+ \fontdimen\thr@@\font \@minus \fontdimen4\font}
+
+% +-----------------+
+% | O P T I O N S |
+% +-----------------+
+
+
+\DeclareOption{pagestyles}{\let\sectiontitle\@empty}
+\DeclareOption{floatps}{%
+ \ifx\sectiontitle\@empty
+ \let\ttl@replace\space
+ \else
+ \PackageWarning{titlesec}{Ignoring `floatps' without
+ `pagestyles'. This option is now deprecated.}%
+ \fi}
+\DeclareOption{psfloats}{%
+ \ifx\sectiontitle\@empty
+ \let\ttl@replace\@empty
+ \else
+ \PackageWarning{titlesec}{Ignoring `psfloats' without
+ `pagestyles'}%
+ \fi}
+
+\DeclareOption{loadonly}{\let\ttl@extract\@empty}
+
+\DeclareOption{outermarks}{%
+ \def\ttl@titlemarks{\outertitlemarks}}
+\DeclareOption{topmarks}{
+ \def\ttl@titlemarks{\toptitlemarks}}
+\DeclareOption{botmarks}{%
+ \def\ttl@titlemarks{\bottitlemarks}}
+\DeclareOption{innermarks}{%
+ \def\ttl@titlemarks{\innertitlemarks}}
+
+\DeclareOption{footmarks}{} % Backward compat
+
+\DeclareOption{clearempty}{%
+ \def\cleardoublepage{%
+ \clearpage{\ps@empty\if@twoside\ifodd\c@page\else
+ \hbox{}\newpage\if@twocolumn\hbox{}\newpage\fi\fi\fi}}}
+
+\DeclareOption{rigidchapters}{%
+ \def\ttl@topmode#1#2{\vbox to #1{#2\vfil}}%
+ \def\ttl@chapafter{.26\textheight}}
+\DeclareOption{rubberchapters}{%
+ \def\ttl@topmode#1#2{{#2}\ttl@calc\vspace{#1}}%
+ \def\ttl@chapafter{40\p@}}
+
+\DeclareOption{bottomtitles}{%
+ \def\bottomtitlespace{-1\p@}}
+\DeclareOption{nobottomtitles}{%
+ \def\bottomtitlespace{.2\textheight}}
+\DeclareOption{nobottomtitles*}{%
+ \let\ttl@addstretch\relax
+ \def\bottomtitlespace{.2\textheight}}
+
+\DeclareOption{calcwidth}{%
+ \let\ttl@beginlongest\ttl@xbeginlongest}
+
+\DeclareOption{aftersep}{%
+ \let\ttl@titlespace\@gobble}
+\DeclareOption{largestsep}{%
+ \let\ttl@titlespace\addvspace}
+
+\DeclareOption{oldparttoc}{%
+ \def\ttl@tocpart{\def\ttl@a{\thepart\hspace{1em}}}}
+\DeclareOption{newparttoc}{%
+ \let\ttl@tocpart\relax}
+
+\DeclareOption{rm}{%
+ \protected@xdef\ttl@fonts{\ttl@fonts\protect\rmfamily}}
+\DeclareOption{sf}{%
+ \protected@xdef\ttl@fonts{\ttl@fonts\protect\sffamily}}
+\DeclareOption{tt}{%
+ \protected@xdef\ttl@fonts{\ttl@fonts\protect\ttfamily}}
+\DeclareOption{md}{%
+ \protected@xdef\ttl@fonts{\ttl@fonts\protect\mdseries}}
+\DeclareOption{bf}{%
+ \protected@xdef\ttl@fonts{\ttl@fonts\protect\bfseries}}
+\DeclareOption{up}{%
+ \protected@xdef\ttl@fonts{\ttl@fonts\protect\upshape}}
+\DeclareOption{it}{%
+ \protected@xdef\ttl@fonts{\ttl@fonts\protect\itshape}}
+\DeclareOption{sl}{%
+ \protected@xdef\ttl@fonts{\ttl@fonts\protect\slshape}}
+\DeclareOption{sc}{%
+ \protected@xdef\ttl@fonts{\ttl@fonts\protect\scshape}}
+
+\DeclareOption{big}{%
+ \gdef\ttl@sizes#1{\ifcase#1\relax\Huge\or\Large\or\large
+ \or\normalsize\or\or\or\huge\fi}}
+\DeclareOption{medium}{%
+ \gdef\ttl@sizes#1{\ifcase#1\relax\huge\or\Large\or\large
+ \or\normalsize\or\or\or\LARGE\fi}}
+\DeclareOption{small}{%
+ \gdef\ttl@sizes#1{\ifcase#1\relax\LARGE\or\large
+ \or\normalsize\or\normalsize\or\or\or\Large\fi}}
+\DeclareOption{tiny}{%
+ \gdef\ttl@sizes#1{\ifcase#1\relax\large\or\normalsize\or
+ \normalsize\or\normalsize\or\or\or\normalsize\fi}}
+
+\DeclareOption{raggedleft}{%
+ \gdef\ttl@fil{\filleft}}
+\DeclareOption{center}{%
+ \gdef\ttl@fil{\filcenter}}
+\DeclareOption{raggedright}{%
+ \gdef\ttl@fil{\filright}}
+
+\DeclareOption{compact}{%
+ \gdef\ttl@space{1}%
+ \gdef\ttl@chapafter{30\p@}}
+
+% Deprecated. To be remmoved in a major upgrade (3.0)
+\DeclareOption{indentfirst}{%
+ \gdef\@afterindentfalse{\let\if@afterindent\iftrue}%
+ \@afterindenttrue
+ \def\titlespacing{%
+ \@ifstar{\ttl@spacing@i{\@ne}}{\ttl@spacing@i{\@ne}}}}
+\DeclareOption{nonindentfirst}{%
+ \def\titlespacing{%
+ \@ifstar{\ttl@spacing@i{\z@}}{\ttl@spacing@i{\z@}}}}
+
+% New names
+\DeclareOption{indentafter}{%
+ \gdef\@afterindentfalse{\let\if@afterindent\iftrue}%
+ \@afterindenttrue
+ \def\titlespacing{%
+ \@ifstar{\ttl@spacing@i{\@ne}}{\ttl@spacing@i{\@ne}}}}
+\DeclareOption{noindentafter}{%
+ \def\titlespacing{%
+ \@ifstar{\ttl@spacing@i{\z@}}{\ttl@spacing@i{\z@}}}}
+
+% newlinetospace
+\let\ttl@blinemarks\relax
+\let\ttl@elinemarks\relax
+
+\DeclareRobustCommand\ttl@linetosp{%
+ \@ifstar{\ttl@linetosp@i}{\ttl@linetosp@i}}%
+
+\def\ttl@linetosp@i{%
+ \ifdim\lastskip>\z@\else\space\fi
+ \ignorespaces}
+
+\DeclareOption{newlinetospace}{%
+ \def\ttl@blinemarks{%
+ \let\ttl@e\\%
+ \def\\{\ttl@linetosp}}%
+ \def\ttl@elinemarks{\let\\\ttl@e}}%
+
+% toctitles
+\def\ttl@addcontentsline#1#2{%
+ \addcontentsline{toc}{#1}{\ifttl@toclabel\ttl@a\fi#2}}
+
+\DeclareOption{toctitles}{%
+ \def\ttl@addcontentsline#1#2{%
+ \addcontentsline{toc}{#1}{\ifttl@toclabel\ttl@a\fi\ttl@savetitle}}}
+
+% pageatnewline
+
+\def\ttl@changecentercr{%
+ \let\ttl@centercr\@centercr
+ \def\@centercr{\@ifstar{\ttl@centercr*}{\ttl@centercr*}}}
+
+\DeclareOption{pageatnewline}{\let\ttl@changecentercr\relax}
+
+\def\ttl@fonts{}
+
+\ExecuteOptions{rubberchapters,bottomtitles,aftersep,oldparttoc,%
+ innermarks}
+
+\ProcessOptions
+
+% +-----------------+
+% | H Y P E R R E F |
+% +-----------------+
+%
+% These two commands are provided by hyperref. But if they
+% are not defined at \begin{document} hyperref has not been
+% loaded or it is an old version.
+
+\AtBeginDocument{%
+ \ifx\ttl@Hy@steplink\@undefined
+ \let\ttl@Hy@steplink\@gobble
+ \let\ttl@Hy@refstepcounter\refstepcounter
+ \fi}
+
+% +-----------------+
+% | PAGE STYLES |
+% +-----------------+
+
+% Old pagestyles
+% ~~~~~~~~~~~~~~
+
+\providecommand\newpagestyle{%
+ \let\ttl@compatps\@empty % marks the ``old interface''
+ \makeatletter
+ \edef\ttl@d{%
+ \noexpand\input{ttlps.def}%
+ \catcode`\noexpand\@=\the\catcode`\@}%
+ \ttl@d
+ \newpagestyle}
+
+\providecommand\renewpagestyle{%
+ \let\ttl@compatps\@empty % marks the ``old interface''
+ \makeatletter
+ \edef\ttl@d{%
+ \noexpand\input{ttlps.def}%
+ \catcode`\noexpand\@=\the\catcode`\@}%
+ \ttl@d
+ \renewpagestyle}
+
+\providecommand\widenhead{%
+ \let\ttl@compatps\@empty % marks the ``old interface''
+ \makeatletter
+ \edef\ttl@d{%
+ \noexpand\input{ttlps.def}%
+ \catcode`\noexpand\@=\the\catcode`\@}%
+ \ttl@d
+ \widenhead}
+
+% New pagestyles
+% ~~~~~~~~~~~~~~
+
+\@ifundefined{sectiontitle}{}{\input{ttlps.def}}
+
+% +-----------------+
+% | C O M P A T |
+% +-----------------+
+% Easy setup, i.e., that of package options, is
+% taken care of, if necessary.
+
+\renewcommand\secdef[2]{%
+ \@ifstar
+ {\ttl@labelfalse
+ #2}
+ {\ttl@labeltrue
+ \ifx#1\@chapter
+ \if@mainmatter\else\ttl@labelfalse\fi
+ \ifnum\ttll@chapter>\c@secnumdepth\ttl@labelfalse\fi
+ \else\ifx#1\@part
+ \ifnum\ttll@part>\c@secnumdepth\ttl@labelfalse\fi
+ \fi\fi
+ \let\ifttl@toclabel\ifttl@label
+ \@dblarg{#1}}}
+
+\@ifundefined{ttl@extract}{}{% Load patches here if we exit
+ \InputIfFileExists{titlesec.new}{}{}%
+ \endinput}
+
+\newcommand\titlelabel[1]{%
+ \def\@seccntformat##1{#1}}
+
+\expandafter\ifx\csname chapter\endcsname\relax
+
+ \def\ttl@compatpart{\titleclass{\part}{part}\relax}
+
+\else
+
+ \def\ttl@compatchapter{%
+ \def\@makechapterhead{%
+ \ttl@labeltrue
+ \if@mainmatter\else\ttl@labelfalse\fi
+ \ifnum\ttll@chapter>\c@secnumdepth\ttl@labelfalse\fi
+ \ttl@startargs\ttl@mkchap{chapter}}%
+ \def\@makeschapterhead{%
+ \ttl@labelfalse
+ \if@mainmatter\else\ttl@labelfalse\fi
+ \ifnum\ttll@chapter>\c@secnumdepth\ttl@labelfalse\fi
+ \ttl@startargs\ttl@mkchap{chapter}}}
+
+ \def\ttl@compatpart{\titleclass{\part}{page}\relax}
+
+\fi
+
+\def\ttl@@extract#1\@startsection#2#3#4#5#6#7#8{%
+ \@tempskipa=#5
+ \@tempskipb=#6
+ \ifdim\@tempskipa<\z@
+ \toks@{\titlespacing*#8{#4}}%
+ \@tempskipa-\@tempskipa
+ \else
+ \toks@{\titlespacing#8{#4}}%
+ \fi
+ \@ifundefined{ttl@space}{}{%
+ \ttl@assign\@tempskipa*\ttl@space\relax\beforetitleunit}%
+ \ifdim\@tempskipb<\z@
+ \if@tempswa
+ \titleformat#8[runin]%
+ {\ttl@fonts\ttl@sizes{#3}}{\@seccntformat{#2}}{\z@}{}%
+ \else
+ \titleformat#8[runin]{#7}{\@seccntformat{#2}}{\z@}{}%
+ \fi
+ \@tempskipb-\@tempskipb
+ \else
+ \if@tempswa
+ \titleformat#8%
+ {\ttl@fil\ttl@fonts\ttl@sizes{#3}}{\@seccntformat{#2}}{\z@}{}%
+ \else
+ \titleformat#8{#7}{\@seccntformat{#2}}{\z@}{}%
+ \fi
+ \@ifundefined{ttl@space}{}{%
+ \ttl@assign\@tempskipb*\ttl@space\relax\aftertitleunit}%
+ \fi
+ \edef\ttl@a{\the\toks@{\the\@tempskipa}{\the\@tempskipb}}
+ \ttl@a}
+
+\def\ttl@extract#1{%
+ \expandafter\in@\expandafter\@startsection\expandafter{#1}%
+ \ifin@
+ \expandafter\ttl@@extract#1#1%
+ \else
+ \PackageWarningNoLine{titlesec}%
+ {Non standard sectioning command detected\MessageBreak
+ Using default spacing and no format}
+ \titlespacing*#1{\z@}{*3}{*2}%
+ \fi}
+
+\@tempswafalse
+
+\ifx\ttl@fonts\@empty
+ \def\ttl@fonts{\bfseries}
+\else
+ \@tempswatrue
+\fi
+
+\expandafter\ifx\csname ttl@sizes\endcsname\relax
+ \gdef\ttl@sizes#1{\ifcase#1\relax\Huge\or\Large\or\large
+ \or\normalsize\or\or\or\huge\fi}
+\else
+ \@tempswatrue
+\fi
+
+\expandafter\ifx\csname ttl@fil\endcsname\relax
+ \let\ttl@fil\@empty
+\else
+ \@tempswatrue
+\fi
+
+\if@tempswa
+
+ \expandafter\ifx\csname chapter\endcsname\relax\else
+ \titleformat\chapter[display]%
+ {\@ifundefined{ttl@fil}{\raggedright}{\ttl@fil}\ttl@fonts\ttl@sizes6}
+ {\@chapapp\space\thechapter}{.8\baselineskip}{\ttl@sizes\z@}
+ \fi
+
+\fi
+
+\ttl@extract\section
+\ttl@extract\subsection
+\ttl@extract\subsubsection
+\ttl@extract\paragraph
+\ttl@extract\subparagraph
+
+\let\ttl@extract\@undefined
+\let\ttl@@extract\@undefined
+
+\def\ttl@toplevel{part}
+
+\expandafter\ifx\csname chapter\endcsname\relax
+
+ \@namedef{ttll@part}{0}
+ \titleclass{\section}{straight}[\part]
+
+ \titlespacing*{\part}
+ {\z@}
+ {4ex}
+ {3ex}
+
+\else
+
+ \let\ttl@save@mkchap\@makechapterhead
+ \let\ttl@save@mkschap\@makeschapterhead
+
+ \def\@makechapterhead#1{%
+ \gdef\ttl@savemark{\chaptermark{#1}}\ttl@save@mkchap{#1}}
+
+ \def\@makeschapterhead#1{%
+ \gdef\ttl@savemark{\chaptermark{#1}}\ttl@save@mkschap{#1}}
+
+ \@namedef{ttll@part}{-1}
+ \@namedef{ttlss@part}{chapter}
+ \@namedef{ttll@chapter}{0}
+ \titleclass{\section}{straight}[\chapter]
+
+% The following is unoperant, unless when \chapter / \part
+% format is redefined
+
+ \titlespacing*{\part}
+ {\z@}
+ {\z@\@plus1fil}
+ {\z@\@plus1fil}
+
+ \titlespacing*\chapter
+ {\z@}%
+ {50\p@}%
+ {\ttl@chapafter}%
+
+\fi
+
+\titleclass{\subsection} {straight}[\section]
+\titleclass{\subsubsection}{straight}[\subsection]
+\titleclass{\paragraph} {straight}[\subsubsection]
+\titleclass{\subparagraph} {straight}[\paragraph]
+
+% Load patches if necessary
+
+\InputIfFileExists{titlesec.new}{}{}
+
+\endinput
diff --git a/Master/texmf-dist/tex/latex/titlesec/titletoc.sty b/Master/texmf-dist/tex/latex/titlesec/titletoc.sty
new file mode 100644
index 00000000000..8f01805fc50
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/titlesec/titletoc.sty
@@ -0,0 +1,629 @@
+% +---------------------------------------------+
+% | Documentation is in the titlesec.tex file. |
+% +---------------------------------------------+
+%
+% Copyright (c) 1998-2005 by Javier Bezos.
+% All Rights Reserved.
+%
+% This file is part of the titlesec distribution release 2.6
+% -----------------------------------------------------------
+%
+% This program can be redistributed and/or modified under the terms
+% of the LaTeX Project Public License Distributed from CTAN
+% archives in directory macros/latex/base/lppl.txt; either
+% version 1 of the License, or any later version.
+
+% History of v1.1
+% ~~~~~~~~~~~~~~~
+% 99/04/22: A bug fix. Some missing global assignments in \ttl@tocentry
+% were missing, and page numbers messed up with
+% \titlecontents*
+%
+% History of v1.2
+% ~~~~~~~~~~~~~~~~
+% 99/10/20: Added \contentsafter. \ttl@tocentry modified to accept
+% the new command for grouping in a paragraph entries of
+% different levels.
+% 99/10/27: Instead of defining the level numbers explicitly, that's
+% done with \ttl@setlevels and \ttl@levels.
+% 99/10/27: Added the basic code for multiple indexes.
+% 99/10/29: Added the toctop test to the \ttl@savel@... commands.
+% 99/12/28: Simplified \ttl@savel@... with \ttl@lselect.
+% 00/01/12: \contentsafter rejected. An aditional optional parameter
+% is used instead. (Too) many thing had to be rewritten.
+% 00/01/27: Removed \ttl@setlevels. Any change of levels are
+% best done with titlesec.
+% 00/02/14: Moved misplaced \vskip in ttl@tocentry.
+% 00/02/16: A few changes in the "block" separators.
+% 00/02/16: Fixed bug in \ttl@margin. For the right margin the
+% correction was used instead of the margin.
+%
+% History of v1.2.1
+% ~~~~~~~~~~~~~~~~~
+% 00/04/25: Dirty trick to make sure that \ttl@finish is the very
+% last thing in lists of floats (lof, lot, etc.).
+% 00/05/14: Missing \global before \ttl@labelfalse added.
+%
+% History of 1.2.2
+% ~~~~~~~~~~~~~~~~
+% 00/06/05: The optional argument no longer mandatory, but
+% still reporting an error if the length is missing.
+% Minor internal changes, and a patch mechanism added.
+%
+% History of 1.3
+% ~~~~~~~~~~~~~~
+% 01/01/12: Minor changes and some missing \globals added for
+% partial tocs to work inside a group.
+% 01/01/21: Added \dottedcontents.
+%
+% History of 1.4
+% ~~~~~~~~~~~~~~
+% 02/03/27: titletoc.new merged into this file
+% 02/03/27: \ttl@finish written by the last \newpage.
+% 02/03/27: \ttl@lsection broke paragraphs always. Now
+% only if the sublevel is typeset.
+% 02/03/27: \ttl@finish -> \contentsfinish
+%
+% History of 1.5
+% ~~~~~~~~~~~~~~
+% 03/06/14: \contentspush didn't work because of the change of
+% (.new) \leftskip was done inside a group before the
+% corresponding \par
+% 03/06/14: Added an useful error if a partial TOC is not
+% (.new) defined.
+% 05/01/17: New options rubber/rigidseps, to remove if desired
+% the small vertical "plus" between entries.
+% 05/01/20: Begin work on partial lists.
+% 05/01/21: \ttl@outblock and \ttl@outnoblock just to avoid a
+% huge definition and to ease patching.
+% 05/01/22: Work on partial lists finished (but to be resumed).
+
+\ProvidesPackage{titletoc}[2005/01/22 v1.5 TOC entries]
+
+% The following tags are used:
+% ttl@ : the generic one, shared with titlesec
+% ttlb@ : starting punctuation for block format
+% ttlm@ : and middle
+% ttle@ : and ending
+% ttll@ : section level
+% ttlx@ : file extension
+%
+% Fistly, comes the
+% common stuff with titlesec
+% ~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+\newif\ifttl@label
+\newif\ifttl@fromblock
+
+\providecommand\titleline{%
+ \@ifstar{\ttl@line@i{\hb@xt@\titlewidth}}%
+ {\ttl@line@i{}}}
+
+\def\ttl@line@i#1{%
+ \@ifnextchar[{\ttl@line{#1}}{\ttl@line{#1}[s]}}
+
+\def\ttl@line#1[#2]#3{%
+ \vskip\topskip
+ \hrule \@height \z@
+ \nobreak
+ \vskip-\topskip
+ \begingroup
+ \parindent\z@
+ \everypar{}%
+ \leftskip\z@
+ \rightskip\z@ % #1 is either \hb@xt@\titlewidth or empty:
+ \@makebox[\hsize][#2]{\ttl@makeline{#1{#3}}}%
+ \par
+ \endgroup
+ \hrule height \z@
+ \nobreak}
+
+% Fillers:
+
+\providecommand\titlerule{\@ifstar{\ttl@row}{\ttl@rule}}
+
+\let\ttl@leaders\xleaders
+
+\def\ttl@row{\@ifnextchar[{\ttl@row@i}{\ttl@row@i[\wd\z@]}}
+\def\ttl@row@i[#1]#2{%
+ \ifvmode\expandafter\titleline\fi
+ {\sbox\z@{#2}%
+ \hspace{-#1}%
+ \hskip\wd\z@
+ \ttl@leaders\hb@xt@#1{\hss\box\z@}%
+ \hfill\kern\z@}}
+
+\def\ttl@rule{\@ifnextchar[{\ttl@rule@i}{\ttl@rule@i[.4pt]}}
+\def\ttl@rule@i[#1]{%
+ \ifvmode\expandafter\titleline\fi
+ {\leaders\hrule height #1\hfill\kern\z@}}
+
+\providecommand\filright{%
+ \gdef\ttl@filleft##1{\hskip##1}%
+ \gdef\ttl@filright##1{\hfill}%
+ \let\\\@centercr
+ \advance\rightskip\z@ \@plus 1fil\relax}
+\providecommand\filleft{%
+ \gdef\ttl@filleft##1{\hfill}%
+ \gdef\ttl@filright##1{\hskip##1}%
+ \let\\\@centercr
+ \advance\leftskip\z@ \@plus 1fil
+ \parfillskip\z@}
+\providecommand\filcenter{\filleft\filright
+ \gdef\ttl@filleft##1{\hfill}}
+\providecommand\fillast{%
+ \gdef\ttl@filleft##1{\hfill}%
+ \gdef\ttl@filright##1{\hfill}%
+ \let\\\@centercr
+ \filleft\advance\rightskip\z@ \@plus -1fil
+ \parfillskip\z@ \@plus 2fil\relax}
+
+% Now, the specific titletoc part
+
+% User interface
+% ~~~~~~~~~~~~~~
+% Tools:
+
+\DeclareOption{dotinlabels}{\def\ttl@idot{.}}
+\DeclareOption{nodotinlabels}{\let\ttl@idot\@empty}
+
+\DeclareOption{rigidseps}{%
+ \def\ttl@contentsstretch{\vskip\z@}}
+\DeclareOption{rubberseps}{%
+ \def\ttl@contentsstretch{\vskip\z@\@plus.1\p@}}
+
+\DeclareOption{leftlabels}{%
+ \renewcommand\numberline[1]{\hb@xt@\@tempdima{#1\ttl@idot\hfil}}%
+ \newcommand\contentslabel[2][\thecontentslabel\ttl@idot]{%
+% \let\ttl@a\thecontentslabel %%%%% For the star variant
+% \def\thecontentslabel{#2}% %%% To be fully implemented... when?
+% \setbox\z@\hbox{#1}%
+% \dimen@\wd\z@
+% \let\thecontentslabel\ttl@a
+% \hspace*{-\dimen@}\hb@xt@\dimen@{#1\hfil}
+ \hspace*{-#2}\hb@xt@#2{#1\hfil}}}
+
+\DeclareOption{rightlabels}{%
+ \renewcommand\numberline[1]{\hb@xt@\@tempdima{\hss#1\ttl@idot\enspace}}%
+ \let\contentslabel\relax
+ \newcommand\contentslabel[2][\thecontentslabel\ttl@idot\enspace]{%
+ \hspace*{-#2}\hb@xt@#2{\hfil#1}}}
+
+\newcommand\contentspage[1][\thecontentspage]{%
+ \hb@xt@\@pnumwidth{\hfil#1}%
+ \hspace*{-\@pnumwidth}}
+
+\newcommand\contentspush[1]{%
+ \sbox\z@{#1}%
+ \xdef\ttl@b{\advance\leftskip\the\wd\z@}%
+ \aftergroup\ttl@b
+ \leavevmode\llap{\box\z@}}
+
+% General commands. A level register. Explicit numbers
+% because they are used in csnames. Ignored if already defined.
+
+\ifx\ttll@section\@undefined
+
+ \@ifundefined{chapter}
+ {\def\ttll@part{0}}
+ {\def\ttll@part{-1}%
+ \def\ttll@chapter{0}}
+ \def\ttll@section{1}
+ \def\ttll@subsection{2}
+ \def\ttll@subsubsection{3}
+ \def\ttll@paragraph{4}
+ \def\ttll@subparagraph{5}
+
+\fi
+
+% We make sure that a series of * entries are finished and
+% that a \titlecontents in the middle of a document is
+% written to the right file. We need ship out floats before;
+% that's very tricky.
+
+\newcommand\contentsuse[2]{%
+ \expandafter\def\csname ttlx@#1\endcsname{#2}%
+ \expandafter\def\csname ttll@#1\endcsname{-1000}%
+ \expandafter\def\expandafter\ttl@finishall\expandafter{%
+ \ttl@finishall
+ \@writefile{#2}{\contentsfinish}}}
+
+\def\ttl@finishall{\@writefile{toc}{\contentsfinish}}
+
+\AtEndDocument{%
+ \ttl@startlists
+ \let\ttl@newpage\newpage
+ \def\newpage{%
+ \let\newpage\ttl@newpage
+ \newpage
+ \if@filesw
+ \immediate\write\@mainaux{\string\ttl@finishall}%
+ \fi}}
+
+\contentsuse{figure}{lof}
+\contentsuse{table}{lot}
+
+\def\contentsfinish{%
+ \ifttl@fromblock
+ \xdef\ttl@b{-10000}% ships out any saved punctuation
+ \ttl@preend
+ \@@par
+ \endgroup
+ \global\ttl@fromblockfalse
+ \fi}
+
+% The two basic commands. First \contentsmargin:
+
+\newcommand\contentsmargin[1][\z@]{%
+ \def\ttl@corr{#1}\def\@pnumwidth}
+
+% The following is the value of \contentsmargin when
+% used inside \ttl@tocenty (ie, \titlecontents).
+
+\newcommand\ttl@margin[2][\z@]{%
+ \def\ttl@corr{#1}%
+ \advance\rightskip-\@pnumwidth\relax
+ \advance\rightskip#2\relax
+ \def\@pnumwidth{#2}}
+
+% \titlecontents deals with concepts, not commands; hence no
+% escape char
+
+\newcommand\titlecontents{%
+ \@ifstar{\ttl@contents{\z@}}%
+ {\ttl@contents{\@ne}}}
+
+\def\ttl@contents#1#2{%
+ \@ifnextchar[{\ttl@contents@i{#1}{#2}}%
+ {\ttl@contents@i{#1}{#2}[\@nil]}}
+
+\def\ttl@contents@i#1#2[#3]#4#5#6#7{%
+ \expandafter\def\csname l@#2\endcsname
+ {\ttl@tocentry{#1}{#2}{#3}{#4}{{#5}{#6}}{#7}}%
+ \@ifnextchar[{\ttl@contents@ii{#1}{#2}}%
+ {\ttl@contents@ii{#1}{#2}[]}}
+
+\def\ttl@contents@ii#1#2[#3]{%
+ \ifcase#1\relax
+ \expandafter\@firstoftwo
+ \else
+ \expandafter\@secondoftwo
+ \fi
+ {\@ifnextchar[{\ttl@contents@iii{#1}{#2}{#3}}%
+ {\ttl@contents@iii{#1}{#2}{#3}[]}}%
+ {\ttl@contents@iv{#1}{#2}{#3}[][]}}
+
+\def\ttl@contents@iii#1#2#3[#4]{%
+ \@ifnextchar[{\@tempswatrue\ttl@contents@iv{#1}{#2}{#3}[#4]}%
+ {\@tempswafalse\ttl@contents@iv{#1}{#2}{#3}[#4][]}}
+
+\def\ttl@contents@iv#1#2#3[#4][#5]{%
+ \ifcase#1\relax
+ \if@tempswa
+ \ttl@contents@v{#2}{#3}{#4}{#5}%
+ \else
+ \ttl@contents@v{#2}{}{#3}{#4}%
+ \fi
+ \else
+ \ttl@contents@v{#2}{}{}{#3}%
+ \fi}
+
+\def\ttl@contents@v#1#2#3#4{%
+ \expandafter\def\csname ttlb@#1\endcsname{#2}%
+ \expandafter\def\csname ttlm@#1\endcsname{#3}%
+ \expandafter\def\csname ttle@#1\endcsname{#4}}
+
+\begingroup
+\catcode`\-=12\catcode`\>=12
+\gdef\ttl@strip#1->#2\@@#3{\def#3{#2}}
+\endgroup
+
+\AtBeginDocument{%
+ \def\ttl@change@i#1#2#3#4#5#6#7{%
+ \expandafter\def\csname l@#2\endcsname
+ {\ttl@tocentry{#1}{#2}{#3}{#4}{{#5}{#6}}{#7}}}%
+ \let\ttl@change@v\ttl@contents@v
+ \def\ttl@contents@i#1#2[#3]#4#5#6#7{%
+ \def\ttl@a{\ttl@change@i{#1}{#2}{#3}{#4}{#5}{#6}{#7}}%
+ \@ifnextchar[{\ttl@contents@ii{#1}{#2}}%
+ {\ttl@contents@ii{#1}{#2}[]}}%
+ \def\ttl@contents@v#1#2#3#4{%
+ \def\ttl@b{\ttl@change@v{#1}{#2}{#3}{#4}}%
+ \expandafter\ttl@strip\meaning\ttl@a\@@\ttl@a
+ \expandafter\ttl@strip\meaning\ttl@b\@@\ttl@b
+ \edef\ttl@c{%
+ \expandafter\ifx\csname ttlx@#2\endcsname\relax
+ toc%
+ \else
+ \csname ttlx@#2\endcsname
+ \fi}%
+ \addtocontents{\ttl@c}{\ttl@a\relax}%
+ \addtocontents{\ttl@c}{\ttl@b\relax}}}
+
+% Printing the toc entry
+% ~~~~~~~~~~~~~~~~~~~~~~
+
+\def\ttl@lasttoc{-1000} % An inital dummy assignment
+
+% 1 ifblock, 2 sect name, 3 left, 4 before,
+% 5 {with}{without}, 6 filler/page, 7 title 8 pageno
+
+\let\ttl@preend\@empty
+
+\def\ttl@outpunct{%
+ \ifnum\ttl@c>\ttl@b\relax
+ \ttl@preend
+ \fi}
+
+\def\ttl@outblock#1#2#3{%
+ \ifcase#1\relax
+ \ifnum\ttl@b>\ttl@a\relax
+ \begingroup
+ \protected@edef\ttl@preend{%
+ \@nameuse{ttle@#2}%
+ \endgroup
+ \protect\@namedef{ttl@c}{\ttl@a}%
+ \protect\ttl@outpunct}%
+ #3%
+ \@nameuse{ttlb@#2}%
+ \else\ifnum\ttl@b<\ttl@a\relax
+ \ttl@preend
+ \@nameuse{ttlm@#2}%
+ \else
+ \@nameuse{ttlm@#2}%
+ \fi\fi
+ \else
+ \ttl@preend
+ \@@par
+ \endgroup
+ \@firstoftwo
+ \fi}
+
+\def\ttl@outnoblock#1#2#3{%
+ \begingroup
+ \ifnum\ttl@b>\ttl@a
+ \nobreak
+ \else\ifnum\ttl@b<\ttl@a
+ \addpenalty{\@secpenalty}%
+ \else
+ \addpenalty{\z@}%
+ \fi\fi
+ \ttl@contentsstretch
+ \nobreak
+ \ifcase#1\relax\else\interlinepenalty\@M\fi
+ \parindent\z@
+ \ifx\@nil#2%
+ \PackageError{titletoc}{Unimplemented}%
+ {The optional argument is currently mandatory}%
+ \else
+ \setlength\leftskip{#2}%
+ \fi
+ \setlength\rightskip{\@pnumwidth}%
+ \let\contentsmargin\ttl@margin
+ \def\ttl@makeline##1{##1}%
+ #3%
+ \addtolength{\parfillskip}{-\ttl@corr}%
+ \addtolength{\rightskip}{\ttl@corr}%
+ \let\ttl@leaders\leaders}
+
+\def\ttl@tocentry#1#2#3#4#5#6#7#8{%
+ \xdef\ttl@b{\csname ttll@#2\endcsname}%
+ \ifnum\ttl@b>\c@tocdepth\else
+ \ifnum\ttl@b<\ttl@toctop\else
+ \edef\ttl@a{\ttl@lasttoc}%
+ \gdef\thecontentspage{#8}%
+ \global\let\thecontentslabel\@empty
+ \global\ttl@labelfalse
+ \sbox\z@{% Unused box. It just catch the numberline
+ \def\numberline##1{\global\ttl@labeltrue\gdef\thecontentslabel{##1}}%
+ #7}% \ttl@b = current \ttl@a = previous
+ \ifttl@fromblock
+ \ttl@outblock{#1}{#2}{#4}%
+ \else
+ \ttl@outnoblock{#1}{#3}{#4}%
+ \fi
+ \def\numberline##1{\ignorespaces}%
+ \ifttl@label
+ {\leavevmode\strut\@firstoftwo#5{#7}\strut\kern\z@}%
+ \else
+ {\leavevmode\strut\@secondoftwo#5{#7}\strut\kern\z@}%
+ \fi
+ {#6}%
+ \ifcase#1\relax
+ \ifttl@fromblock\else
+ \protected@edef\ttl@preend{\@nameuse{ttle@#2}}%
+ \fi
+ \global\ttl@fromblocktrue
+ \else
+ \@@par
+ \nobreak
+ \csname ttle@#2\endcsname
+ \endgroup
+ \global\ttl@fromblockfalse
+ \fi
+ \xdef\ttl@lasttoc{\csname ttll@#2\endcsname}%
+ \fi
+ \fi
+ \ignorespaces}
+
+\newcommand\dottedcontents{}
+\def\dottedcontents#1[#2]#3#4#5{%
+ \titlecontents{#1}[#2]{#3}%
+ {\contentslabel{#4}}%
+ {\hspace*{-#4}}%
+ {\titlerule*[#5]{.}\contentspage}}
+
+\ExecuteOptions{leftlabels,nodotinlabels,rubberseps}
+
+\ProcessOptions
+
+% Multiple tocs and lists
+% ~~~~~~~~~~~~~~~~~~~~~~~~
+% After some attemps to adapt titletoc to minitoc, I've decided
+% to implement my own solution, because entries as written by
+% minitoc are non standard and unmanageable. The new commands
+% provides a good deal of flexibility, too.
+
+\let\ttl@startlists\@empty
+\let\ttl@writefile\@writefile
+
+\def\ttl@partialtoc{ptc}
+\def\ttl@partiallof{plf}
+\def\ttl@partiallot{plt}
+
+\def\ttl@writepartial#1#2{%
+ \ttl@topartial{toc}{#1}{#2}%
+ \ttl@topartial{lof}{#1}{#2}%
+ \ttl@topartial{lot}{#1}{#2}%
+ \ttl@writefile{#1}{#2}}
+
+\def\ttl@topartial#1#2#3{%
+ \def\ttl@a{#1}%
+ \def\ttl@b{#2}%
+ \ifx\ttl@a\ttl@b
+ \ttl@writefile{\csname ttl@partial#2\endcsname}{#3}%
+ \fi}
+
+\def\ttl@xstartlist#1{%
+ \@ifundefined{ttl@startlist#1}{%
+ \global\@namedef{ttl@startlist#1}{%
+ \let\@writefile\ttl@writepartial
+ \if@filesw
+ \expandafter\newwrite\csname tf@#1\endcsname
+ \immediate\openout\csname tf@#1\endcsname\jobname.#1\relax
+ \fi
+ \@nobreakfalse}%
+ \expandafter\gdef\expandafter\ttl@startlists\expandafter{%
+ \ttl@startlists
+ \@nameuse{ttl@startlist#1}}}{}}
+
+\newcommand\startcontents[1][default]{\startlist[#1]{toc}}
+
+\newcommand\startlist[2][default]{%
+ \expandafter\ttl@xstartlist\csname ttl@partial#2\endcsname
+ \@ifundefined{ttl@#2@#1}%
+ {\expandafter\newcount\csname ttl@#2@#1\endcsname}%
+ {\stoplist[#1]{#2}}%
+ \global\advance\csname ttl@#2@#1\endcsname\@ne
+ \resumelist[#1]{#2}}
+
+\newcommand\stopcontents[1][default]{\stoplist[#1]{toc}}
+
+\newcommand\stoplist[2][default]{%
+ \protected@write\@auxout{}{%
+ \string\ttl@writefile{\csname ttl@partial#2\endcsname}{%
+ \string\ttl@stoptoc{#1@\the\csname ttl@#2@#1\endcsname}}}}
+
+\newcommand\resumecontents[1][default]{\resumelist[#1]{toc}}
+
+\newcommand\resumelist[2][default]{%
+ \protected@write\@auxout{}{%
+ \string\ttl@writefile{\csname ttl@partial#2\endcsname}{%
+ \string\ttl@starttoc{#1@\the\csname ttl@#2@#1\endcsname}}}}
+
+\def\ttl@starttoc#1{%
+ \ifx\@writefile\@gobbletwo\else % Is this test necessary?
+ \def\ttl@a{#1}%
+ \ifx\ttl@a\ttl@ptoc
+ \let\contentsline\ttl@contentsline
+ \fi
+ \fi
+ \ignorespaces}
+
+\def\ttl@stoptoc#1{%
+ \ifx\@writefile\@gobbletwo\else % Is this test necessary?
+ \def\ttl@a{#1}%
+ \ifx\ttl@a\ttl@ptoc
+ \let\contentsline\ttl@gobblecontents
+ \fi
+ \fi
+ \ignorespaces}
+
+\newcommand\printcontents[4][default]{%
+ \ttl@printlist[#1]{toc}{#2}{#3}{#4}}
+
+\newcommand\printlist[4][default]{%
+ \ttl@printlist[#1]{#2}{#3}{-1001}{#4}}
+
+\newcommand\ttl@printlist[5][default]{%
+ \begingroup
+ \@ifundefined{ttl@#2@#1}%
+ {\PackageError{titletoc}{No partial #2 named #1}%
+ {You must start before a partial toc/list\MessageBreak
+ with \string/startcontents/\string\startlist.}}{}%
+ \edef\ttl@ptoc{#1@\the\csname ttl@#2@#1\endcsname}%
+ \def\ttl@toctop{#4}%
+ #5%
+ \let\ttl@xcontentsline\contentsline
+ \let\contentsline\ttl@gobblecontents
+ \def\ttl@contentsline##1{%
+ \@ifundefined{ttll@#3##1}%
+ {\expandafter\let\csname ttll@#3##1\expandafter\endcsname
+ \csname ttll@##1\endcsname}{}%
+ \@ifundefined{l@#3##1}%
+ {\ttl@xcontentsline{##1}}%
+ {\ttl@xcontentsline{#3##1}}}%
+ \makeatletter
+ \@input{\jobname.\csname ttl@partial#2\endcsname}%
+ \makeatother
+ \@nobreakfalse
+ \endgroup}
+
+\AtBeginDocument{%
+ \ifx\ttl@gobblecontents\@undefined
+ \def\ttl@gobblecontents#1#2#3{\ignorespaces}%
+ \fi}
+
+\def\ttl@toctop{-1000}
+
+% Now the we add \contentsfinish to the current definitions
+% and a "selector" for partial tocs
+
+\def\ttl@lselect#1{%
+ \ifnum\csname ttll@#1\endcsname>\c@tocdepth\else
+ \contentsfinish
+ \fi
+ \ifnum\csname ttll@#1\endcsname<\ttl@toctop\relax
+ \expandafter\@gobbletwo
+ \else
+ \expandafter\expandafter\csname ttl@savel@#1\endcsname
+ \fi}
+
+\let\ttl@savel@part\l@part
+\def\l@part{\ttl@lselect{part}}
+
+\let\ttl@savel@chapter\l@chapter
+\def\l@chapter{\ttl@lselect{chapter}}
+
+\let\ttl@savel@section\l@section
+\def\l@section{\ttl@lselect{section}}
+
+\let\ttl@savel@subsection\l@subsection
+\def\l@subsection{\ttl@lselect{subsection}}
+
+\let\ttl@savel@subsubsection\l@subsubsection
+\def\l@subsubsection{\ttl@lselect{subsubsection}}
+
+\let\ttl@savel@paragraph\l@paragraph
+\def\l@paragraph{\ttl@lselect{paragraph}}
+
+\let\ttl@savel@subparagraph\l@subparagraph
+\def\l@subparagraph{\ttl@lselect{subparagraph}}
+
+\let\ttl@savel@figure\l@figure
+\def\l@figure{\ttl@lselect{figure}}
+
+\let\ttl@savel@table\l@table
+\def\l@table{\ttl@lselect{table}}
+
+\@tempskipa\@pnumwidth
+\edef\@pnumwidth{\the\@tempskipa}
+\advance\@tempskipa-\@tocrmarg
+\edef\ttl@corr{-\the\@tempskipa}
+
+% Load patches if necessary
+
+\InputIfFileExists{titletoc.new}{}{}
+
+\endinput
+
diff --git a/Master/texmf-dist/tex/latex/titlesec/ttlkeys.def b/Master/texmf-dist/tex/latex/titlesec/ttlkeys.def
new file mode 100644
index 00000000000..02d44976628
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/titlesec/ttlkeys.def
@@ -0,0 +1,114 @@
+% +--------------------------------------------------+
+% | Typeset titlesec.tex to get the documentation. |
+% +--------------------------------------------------+
+%
+% Copyright (c) 1998-2005 by Javier Bezos.
+% All Rights Reserved.
+%
+% This file is part of the titlesec distribution release 2.6
+% -----------------------------------------------------------
+%
+% This program can be redistributed and/or modified under the terms
+% of the LaTeX Project Public License Distributed from CTAN
+% archives in directory macros/latex/base/lppl.txt; either
+% version 1 of the License, or any later version.
+
+\ProvidesFile{ttlkeys.def}[2005/01/22]
+
+% This command takes a list in "keyval" format, \ttl@a containing the
+% star spec, and returns \ttl@a with the full string name to be defined
+% and \ttl@b with the string sectioning name (without tag). But if the
+% argument has no keys then simply does the last step. Finally, an
+% error is reported if the sectioning command does not exist. All these
+% testing must be improved (still).
+
+\@ifundefined{define@key}{\RequirePackage{keyval}}{}%
+
+\def\ttl@getkeys#1#2{%
+ \let\ttl@a\@empty
+ \if\expandafter @\@gobble#1@\@empty % if there is a single token
+ \edef\ttl@b{\expandafter\@gobble\string#1}%
+ \let\ttl@a\ttl@b
+ \else
+ \ttl@labelfalse % A temporary flag: true if there is page key
+ \setkeys{#2}{#1}%
+ \ifttl@label
+ \@ifundefined{ttlp@\ttl@b}{%
+ \expandafter\let\csname ttlp@\ttl@b\endcsname\@empty}{}%
+ \fi
+ \edef\ttl@a{\ttl@b\ttl@a}%
+ \fi}
+
+\define@key{titlesec}{name}{%
+ \edef\ttl@b{\expandafter\@gobble\string#1}}
+
+\define@key{titlesec}{numberless}[true]{%
+ \csname @tempswa#1\endcsname
+ \if@tempswa
+ \edef\ttl@a{\ttl@a/*}%
+ \fi}
+
+\define@key{titlesec}{page}{%
+ \ttl@labeltrue % Used as flag
+ \edef\ttl@a{/#1\ttl@a}}
+
+\def\ttl@extra@numberless{\ttl@labeltrue}% The actual meaning
+
+\let\ttl@key@numberless\@empty
+%\let\ttl@key@matter\@empty
+
+\let\ttlp@append\@gobbletwo
+
+\def\ttl@setkeys#1{%
+ \def\ttl@trylist{\ttl@try{}}%
+ \@for\ttl@b:=#1\do{%
+ \begingroup
+ \let\ttl@a\relax
+ \def\ttl@try##1{%
+ \noexpand\ttl@try{##1\ttl@a{\ttl@b}}%
+ \noexpand\ttl@try{##1}}%
+ \xdef\ttl@trylist{\ttl@trylist}%
+ \endgroup}}
+
+\ttl@setkeys{page,numberless} % matter
+
+%___
+\if@twoside
+
+\newcounter{ttlp@side}
+\newcount\ttlp@side
+
+\def\ttlp@theside{\ifodd\c@page o\else e\fi}
+
+\def\ttlp@append#1#2{%
+ {\let\@elt\relax
+ \expandafter\xdef\csname ttlp@#1\endcsname{%
+ \csname ttlp@#1\endcsname\@elt #2}}}
+
+\def\ttlp@write#1{%
+ {\let\ttlp@theside\relax
+ \protected@write\@auxout{}%
+ {\string\ttlp@append{#1}{\ttlp@theside}}}}
+
+\def\ttlp@fetch#1{%
+ \stepcounter{ttlp@side}%
+ \global\advance\ttlp@side\@ne
+ \@whilenum\ttlp@side<\c@ttlp@side\do{%
+ \expandafter\@next\expandafter\@tempa\csname ttlp@#1\endcsname{}{}%
+ \global\advance\ttlp@side\@ne}%
+ \expandafter\@next\expandafter\ttl@b\csname ttlp@#1\endcsname{%
+ \xdef\ttl@key@page{/\if\ttl@b oodd\else even\fi}%
+ }{%
+ \xdef\ttl@key@page{/\ifodd\c@page odd\else even\fi}%
+ \@@warning{Unsynchronized `#1' title on page \thepage}}}
+
+%___
+\else
+
+\let\ttlp@write\@gobble
+\def\ttlp@fetch#1{\gdef\ttl@key@page{/odd}}
+
+%___
+\fi
+
+\endinput
diff --git a/Master/texmf-dist/tex/latex/titlesec/ttlps.def b/Master/texmf-dist/tex/latex/titlesec/ttlps.def
new file mode 100644
index 00000000000..6246743cf99
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/titlesec/ttlps.def
@@ -0,0 +1,504 @@
+% +--------------------------------------------------+
+% | Typeset titlesec.tex to get the documentation. |
+% +--------------------------------------------------+
+%
+% Copyright (c) 1998-2005 by Javier Bezos.
+% All Rights Reserved.
+%
+% This file is part of the titlesec distribution release 2.6
+% -----------------------------------------------------------
+%
+% This program can be redistributed and/or modified under the terms
+% of the LaTeX Project Public License Distributed from CTAN
+% archives in directory macros/latex/base/lppl.txt; either
+% version 1 of the License, or any later version.
+
+% History of v1.0 (actually not 1.0)
+% ~~~~~~~~~~~~~~~
+% 99/11/03: Split from titlesec.sty
+% 99/11/03: Changed \setmarks, \ttl@sethead, \ttl@setfoot to follow
+% the new scheme
+% 99/11/03: Removed the redefinition of \markboth. The arguments are
+% expanded on the fly by the corresponding \...mark.
+% 00/01/06: Added the \newtitlemark device.
+% 00/01/19: Rejected the idea of a separate package (for the time
+% being). Now it's ttlps.def.
+% 00/01/20: Starred versions of \widenhead, \sethead, \setfoot.
+% 00/01/23: Added \ifthe..., \iftitle, etc.
+% 00/02/05: Modified \ifthe... mechanism
+% 00/02/25: Fixed a bug which made enter in an endless loop.
+% Now \ttl@marks is just \relax. The new scheme made
+% compatible with babel. (2.3.1)
+% 00/03/01: Fixed a bug in the previous bug fix. (2.3.2)
+% 00/03/08: Removed the code for AMS and babel. A general procedure
+% to catch the changes of \markboth is introduced, with
+% \ttl@enccode and \ttl@running. (2.3.3)
+% 00/05/05: \setmarks may be used outside of \newpagestyle, with
+% the help of \ttl@setmarks and \ttl@marksset (2.3.4)
+% 00/05/25: Tests for \ttl@toclabel moved to the redefinition of
+% \secdef in titlesec. (2.3.5)
+% 00/06/07: Added the first attempt for pagestyles with floats.
+% With slight changes, it will become the final form
+% for that. (2.3.5)
+% 00/06/14: The default \ifthe... are now defined with \ttl@setifthe
+% so that they are robust from the very beginning. (2.3.5)
+% 01/01/21: Replaced some \defs by \newcommand
+%
+% As before, all marks has two parts but now they don't refer to left or
+% right pages at all. There are some issues related to top marks which
+% are explained by Knuth in \textit{The \TeX book}, pp. 259f, as well
+% as an uncompatibility between them and \LaTeX{} floats. To overcome
+% both limitations, in the \textsf{titlesec} page styles, the second
+% part in |\cs{firstmark}| is a \emph{fixed} top mark and the first one
+% the actual first mark; the right way to get the bot mark is from the
+% second part. Marks are stored at each section and used before and
+% after the title (straight class); the first part contains the values
+% of current title, but the second one contains the previolusly stored
+% values in the mark before the title, and the current values in the
+% mark after.
+
+\ProvidesFile{ttlps.def}[2005/01/22]
+
+%
+% Page Styles
+% ~~~~~~~~~~~
+
+\ifx\ttl@compatps\@undefined\else
+ \PackageWarningNoLine{titlesec}
+ {You are using an old interface for page styles\MessageBreak
+ You could proceed but don't complain if you run\MessageBreak
+ into errors}
+\fi
+
+\ttl@pstrue
+
+\let\parttitle\@empty
+\let\chaptertitle\@empty
+\let\sectiontitle\@empty
+\let\subsectiontitle\@empty
+\let\subsubsectiontitle\@empty
+\let\paragraphtitle\@empty
+\let\subparagraphtitle\@empty
+
+\newcommand\iftitle[1]{%
+ \expandafter\ifx\csname #1title\endcsname\@empty
+ \expandafter\@secondoftwo
+ \else
+ \expandafter\@firstoftwo
+ \fi}
+
+\newcommand\newtitlemark{%
+ \@ifstar{\@tempswafalse\ttl@newmk@i}%
+ {\@tempswatrue\ttl@newmk@i}}
+
+\def\ttl@newmk@i#1{%
+ \edef\ttl@a{{\expandafter\@gobble\string#1}}%
+ \expandafter\ttl@newmk@ii\ttl@a}
+
+\def\ttl@newmk@ii#1{%
+ \if@tempswa
+ \expandafter\def\expandafter\ttl@moremarks\expandafter{%
+ \ttl@moremarks
+ \protect\@namedef{#1}{\@nameuse{#1}}}%
+ \else
+ \expandafter\def\expandafter\ttl@moremarks\expandafter{%
+ \ttl@moremarks
+ \protect\@nameuse{#1}=\the\@nameuse{#1}\relax}%
+ \fi}
+
+\def\ttl@prevmarks{\ttl@marks}
+\let\ttl@marks\relax
+
+\let\ttl@moremarks\@empty
+
+% The following command sets the ifthe... commands to
+% be used in heads. When the call is from inside a sectioning
+% command, toclabel is either true (in most of cases) or false
+% (a chapter in the front matter, for example). Otherwise (an
+% explicit \...mark) is false
+
+\def\ttl@setifthe#1{%
+ \expandafter\protected@edef\csname ifthe#1\endcsname{%
+ \ifttl@toclabel
+ \protect\@firstoftwo
+ \else
+ \protect\@secondoftwo
+ \fi}}
+
+% At this point \ttl@toclabel is always false
+
+\ttl@setifthe{part}
+\ttl@setifthe{chapter}
+\ttl@setifthe{section}
+\ttl@setifthe{subsection}
+\ttl@setifthe{subsubsection}
+\ttl@setifthe{paragraph}
+\ttl@setifthe{subparagraph}
+
+\newtitlemark{\ttl@running}
+\let\ttl@enccode\relax
+\def\ttl@running{\ttl@enccode}
+
+\def\ttl@markboth#1{%
+ \begingroup
+ \let\protect\@unexpandable@protect
+ \let\@mkboth\@gobbletwo
+ \let\ttl@enccode\relax
+ \let\label\relax
+ \let\index\relax
+ \let\glossary\relax
+ \let\ttl@c\mark
+ \def\mark##1{\xdef\ttl@running{\expandafter\@gobble##1}}%
+ \markboth{}{\ttl@enccode}%
+ \expandafter\let\csname#1mark\endcsname\@gobble
+ \xdef\ttl@marks{\ttl@marks}%
+ \gdef\@themark{{\ttl@marks}{\ttl@prevmarks}}%
+ \ttl@c{\@themark}%
+ \if@nobreak\ifvmode\nobreak\fi\fi
+ \endgroup}
+
+\newcommand\setmarks[2]{\def\ttl@marksset{{#1}{#2}}}
+
+\def\ttl@setmarks#1#2{%
+ \expandafter\def\csname#1mark\endcsname##1{%
+ \expandafter\gdef\csname#1title\endcsname{##1}%
+ \ttl@setifthe{#1}%
+ \def\ttl@marks{%
+ \protect\@namedef{#1title}{##1}%
+ \protect\@namedef{#2title}{}%
+ \protect\@namedef{the#1}{\@nameuse{the#1}}%
+ \protect\@namedef{the#2}{}%
+ \protect\@namedef{ifthe#1}{\@nameuse{ifthe#1}}%
+ \protect\@namedef{ifthe#2}{\protect\@secondoftwo}%
+ \ttl@moremarks}%
+ \ttl@markboth{#1}}%
+ \expandafter\def\csname#2mark\endcsname##1{%
+ \expandafter\gdef\csname#2title\endcsname{##1}%
+ \ttl@setifthe{#2}%
+ \def\ttl@marks{%
+ \protect\@namedef{#1title}{\@nameuse{#1title}}%
+ \protect\@namedef{#2title}{##1}%
+ \protect\@namedef{the#1}{\@nameuse{the#1}}%
+ \protect\@namedef{the#2}{\@nameuse{the#2}}%
+ \protect\@namedef{ifthe#1}{\@nameuse{ifthe#1}}%
+ \protect\@namedef{ifthe#2}{\@nameuse{ifthe#2}}%
+ \ttl@moremarks}%
+ \ttl@markboth{#1}}}%
+
+\newcommand\headrule{\setheadrule{.4\p@}}
+\newcommand\footrule{\setfootrule{.4\p@}}
+
+\newcommand\setheadrule[1]{%
+ \ifdim#1=\z@
+ \let\makeheadrule\@empty
+ \else
+ \def\makeheadrule{\rule[-.3\baselineskip]{\linewidth}{#1}}%
+ \fi}
+\newcommand\setfootrule[1]{%
+ \ifdim#1=\z@
+ \let\makefootrule\@empty
+ \else
+ \def\makefootrule{\rule[.7\baselineskip]{\linewidth}{#1}}%
+ \fi}
+
+\renewcommand\newpagestyle[1]{%
+ \begingroup
+ \catcode`\^^M=9
+ \@ifnextchar[%
+ {\ttl@pagestyle\newcommand{#1}}%
+ {\ttl@pagestyle\newcommand{#1}[]}}
+
+\renewcommand\renewpagestyle[1]{%
+ \begingroup
+ \catcode`\^^M=9
+ \@ifnextchar[%
+ {\ttl@pagestyle\renewcommand{#1}}%
+ {\ttl@pagestyle\renewcommand{#1}[]}}
+
+\def\ttl@pagestyle#1#2[#3]#4{%
+ \endgroup
+ \expandafter#1\csname ps@#2\endcsname{%
+ \ttl@defaultps
+ \def\ttl@headfmt{#3}%
+ #4%
+ \def\setmarks####1####2{\def\ttl@marksset{{####1}{####2}}}}}
+
+\def\ttl@userunning#1#2{\csname ttlr@#1#2\endcsname}
+
+\def\ttl@defaultps{%
+ \let\makeheadrule\@empty
+ \let\makefootrule\@empty
+ \def\@mkboth{\ttl@savemark\@gobbletwo}%
+ \def\@oddfoot{\ttl@userunning of}%
+ \def\@evenfoot{\ttl@userunning ef}%
+ \def\@oddhead{\ttl@userunning oh}%
+ \def\@evenhead{\ttl@userunning eh}%
+ \def\ttlr@of{\ttl@makefoot\@empty\@@\ttl@hiol\ttl@hior}%
+ \def\ttlr@ef{\ttl@makefoot\@empty\@@\ttl@hiel\ttl@hier}%
+ \def\ttlr@oh{\ttl@makehead\@empty\@@\ttl@hiol\ttl@hior}%
+ \def\ttlr@eh{\ttl@makehead\@empty\@@\ttl@hiel\ttl@hier}%
+ \let\ttlr@of@b\relax \let\ttlr@of@p\relax
+ \let\ttlr@ef@b\relax \let\ttlr@ef@p\relax
+ \let\ttlr@oh@t\relax \let\ttlr@oh@p\relax
+ \let\ttlr@eh@t\relax \let\ttlr@eh@p\relax
+ \let\setmarks\ttl@setmarks
+ \expandafter\setmarks\ttl@marksset}
+
+\@ifundefined{chapter}%
+ {\setmarks{section}{subsection}}%
+ {\setmarks{chapter}{section}}
+
+\newcommand\usepage{\protect\thepage}
+
+\newcommand\toptitlemarks {\expandafter\@secondoftwo\firstmark{}{}{}}
+\def\firsttitlemarks{%
+ \toks@\expandafter\expandafter\expandafter{%
+ \expandafter\@secondoftwo \firstmark{}{}{}}%
+ \@temptokena\expandafter\expandafter\expandafter{%
+ \expandafter\@secondoftwo \botmark{}{}{}}%
+ \edef\ttl@a{\the\toks@}%
+ \edef\ttl@b{\the\@temptokena}%
+ \ifx\ttl@a\ttl@b
+ \expandafter\@secondoftwo\firstmark{}{}{}%
+ \else
+ \expandafter\@firstoftwo \firstmark{}{}{}%
+ \fi}
+\newcommand\bottitlemarks {\expandafter\@secondoftwo\botmark{}{}{}}
+\newcommand\nexttoptitlemarks{\expandafter\@firstoftwo \botmark{}{}{}}
+\newcommand\outertitlemarks{%
+ \if@twoside
+ \ifodd\c@page\relax
+ \bottitlemarks
+ \else
+ \toptitlemarks
+ \fi
+ \else
+ \toptitlemarks
+ \fi}
+\newcommand\innertitlemarks{%
+ \if@twoside
+ \ifodd\c@page\relax
+ \firsttitlemarks
+ \else
+ \bottitlemarks
+ \fi
+ \else
+ \bottitlemarks
+ \fi}
+
+
+\def\ttl@duplthreeargs#1#2#3#4{#1[#2][#3][#4]{#2}{#3}{#4}}
+\def\ttl@dupltwoargs#1#2#3{#1[#2][#3]{#2}{#3}}
+\def\ttl@duplthreeargsrev#1#2#3#4{#1[#4][#3][#2]{#2}{#3}{#4}}
+\def\ttl@dupltwoargsrev#1#2#3{#1[#3][#2]{#2}{#3}}
+
+\def\ttl@setany#1{%
+ \@ifstar{\ttl@duplthreeargsrev#1}%
+ {\@ifnextchar[{#1}{\ttl@duplthreeargs#1}}}
+
+\newcommand\setfoot{\ttl@setany\ttl@setfoot}
+\newcommand\sethead{\ttl@setany\ttl@sethead}
+
+\def\ttl@setfoot[#1][#2][#3]#4#5#6{%
+ \def\ttlr@ef{\ttl@makefoot{#1}{#2}{#3}\@@\ttl@hiel\ttl@hier}%
+ \def\ttlr@of{\ttl@makefoot{#4}{#5}{#6}\@@\ttl@hiol\ttl@hior}}
+
+\def\ttl@sethead[#1][#2][#3]#4#5#6{%
+ \def\ttlr@eh{\ttl@makehead{#1}{#2}{#3}\@@\ttl@hiel\ttl@hier}%
+ \def\ttlr@oh{\ttl@makehead{#4}{#5}{#6}\@@\ttl@hiol\ttl@hior}}
+
+\def\ttl@headinline#1#2#3{%
+ \ttl@headfmt
+ \def\ttl@a{#1#3}\def\ttl@b{#2}%
+ \ifx\ttl@a\@empty
+ \hfil{#2}\hfil
+ \else\ifx\ttl@b\@empty
+ {#1}\hfil{#3}%
+ \else
+ \sbox\z@ {#1}%
+ \sbox\tw@{#3}%
+ \copy\z@
+ \ifdim\wd\z@<\wd\tw@
+ \kern-\wd\z@\kern\wd\tw@
+ \fi
+ \hfil{#2}\hfil
+ \ifdim\wd\z@>\wd\tw@
+ \kern-\wd\tw@\kern\wd\z@
+ \fi
+ \box\tw@
+ \fi\fi}
+
+\def\ttl@makeboth#1#2#3#4{%
+ \ttl@calcneg\hspace{#3}%
+ \normalsize
+ \linewidth\textwidth
+ \addtolength\linewidth{#3}%
+ \addtolength\linewidth{#4}%
+ \ifx#2\@empty\else
+ \setbox\z@\hb@xt@\linewidth{%
+ \color@begingroup
+ #2%
+ \color@endgroup}%
+ \wd\z@\z@
+ \ht\z@\z@
+ \dp\z@\z@
+ \box\z@
+ \fi
+ \ttl@titlemarks % Must precede the format. Defines \ttl@running
+ \def\ttl@enccode{\ttl@headinline#1{}{}{}}%which contains ttl@enccode
+ \ttl@running
+ \ttl@calcneg\hspace{#4}}%
+
+\def\ttl@makehead#1\@@{\ttl@makeboth{#1}\makeheadrule}
+\def\ttl@makefoot#1\@@{\ttl@makeboth{#1}\makefootrule}
+
+\renewcommand\widenhead{%
+ \@ifstar{\ttl@dupltwoargsrev\ttl@widenhd}%
+ {\@ifnextchar[{\ttl@widenhd}{\ttl@dupltwoargs\ttl@widenhd}}}
+
+\def\ttl@widenhd[#1][#2]#3#4{%
+ \def\ttl@hiel{#1}\def\ttl@hier{#2}%
+ \def\ttl@hiol{#3}\def\ttl@hior{#4}}
+
+\let\setheadindent\widenhead
+
+\def\ttl@hiel{\z@}\def\ttl@hier{\z@}
+\def\ttl@hiol{\z@}\def\ttl@hior{\z@}
+
+% Pagestyles with floats. There macros are defined only with the
+% psfloats package option.
+
+\@ifundefined{ttl@replace}{\endinput}{}
+
+% User interface
+
+\newcommand\setfloatfoot{%
+ \let\ttl@c\@empty % <- current float, empty if general
+ \ttl@setany\ttl@setftfoot}
+
+\newcommand\setfloathead{%
+ \let\ttl@c\@empty % <- current float, empty if general
+ \ttl@setany\ttl@setfthead}
+
+\def\ttl@setftfoot[#1][#2][#3]#4#5#6#7{%
+ \@ifnextchar[{\ttl@setftfoot@i{#1}{#2}{#3}{#4}{#5}{#6}{#7}}%
+ {\ttl@setftfoot@i{#1}{#2}{#3}{#4}{#5}{#6}{#7}[bp]}}
+
+\def\ttl@setfthead[#1][#2][#3]#4#5#6#7{%
+ \@ifnextchar[{\ttl@setfthead@i{#1}{#2}{#3}{#4}{#5}{#6}{#7}}%
+ {\ttl@setfthead@i{#1}{#2}{#3}{#4}{#5}{#6}{#7}[tp]}}
+
+\def\ttl@setftfoot@i#1#2#3#4#5#6#7[#8]{%
+ \@tfor\ttl@b:=#8\do{%
+ \@namedef{ttlr@ef@\ttl@b\ttl@c}%
+ {#7\ttl@makefoot{#1}{#2}{#3}\@@\ttl@hiel\ttl@hier}%
+ \@namedef{ttlr@of@\ttl@b\ttl@c}%
+ {#7\ttl@makefoot{#4}{#5}{#6}\@@\ttl@hiol\ttl@hior}}}
+
+\def\ttl@setfthead@i#1#2#3#4#5#6#7[#8]{%
+ \@tfor\ttl@b:=#8\do{%
+ \@namedef{ttlr@eh@\ttl@b\ttl@c}%
+ {#7\ttl@makehead{#1}{#2}{#3}\@@\ttl@hiel\ttl@hier}%
+ \@namedef{ttlr@oh@\ttl@b\ttl@c}%
+ {#7\ttl@makehead{#4}{#5}{#6}\@@\ttl@hiol\ttl@hior}}}
+
+\newcommand\nextfloathead{%
+ \ttl@nextfree % returns ttl@c with the next float
+ \ttl@setany\ttl@setfthead}
+
+\newcommand\nextfloatfoot{%
+ \ttl@nextfree % returns ttl@c with the next float
+ \ttl@setany\ttl@setftfoot}
+
+% Compat mode with floatps
+
+\ifx\ttl@replace\space
+
+ \let\ttl@setnewfoot\ttl@setftfoot
+ \let\ttl@setnewhead\ttl@setfthead
+
+ \def\ttl@setftfoot[#1][#2][#3]#4#5#6{%
+ \ttl@setnewfoot[#1][#2][#3]{#4}{#5}{#6}{}}
+ \def\ttl@setfthead[#1][#2][#3]#4#5#6{%
+ \ttl@setnewhead[#1][#2][#3]{#4}{#5}{#6}{}}
+
+\fi
+
+% The simple default value of \ttl@userunning is
+% replaced by one more elaborated
+
+\def\ttl@userunning#1#2{%
+ \if@fcolmade % From a post by D. Arseneau to comp.text.tex
+ \def\@elt##1{\edef\ttl@pageft{\string##1}}%
+ \@flsucceed
+ \let\@elt\relax
+ \if#2h%
+ \ttl@replace #1hp\ttl@pageft
+ \else
+ \ttl@replace #1fp\ttl@pageft
+ \ttl@killftps\ttl@pageft
+ \fi
+ \else\if#2h%
+ \ifx\ttl@topft\@empty\else
+ \ttl@replace #1ht\ttl@topft
+ \fi
+ \else
+ \ifx\ttl@botft\@empty\else
+ \ttl@replace #1fb\ttl@botft
+ \fi
+ \fi\fi
+ \csname ttlr@#1#2\endcsname}
+
+% [Don't move above as \ttl@replace is used as a flag.]
+
+\def\ttl@replace#1#2#3#4{%
+ \@ifundefined{ttlr@#1#2@#3#4}%
+ {\@ifundefined{ttlr@#1#2@#3}{}%
+ {\@namedef{ttlr@#1#2}{\@nameuse{ttlr@#1#2@#3}}}}%
+ {\csname ttlr@xx@x#4\endcsname\@gobble
+ {\expandafter\let\csname ttlr@#1#2\expandafter\endcsname
+ \csname ttlr@#1#2@#3#4\endcsname}}}
+
+\def\ttl@nextfree{%
+ \def\@elt##1{%
+ \edef\ttl@c{\string##1}%
+ \let\@elt\@gobble}%
+ \@freelist
+ \let\@elt\relax
+ \@ifundefined{ttlr@xx@x\ttl@c}%
+ {\expandafter\let\csname ttlr@xx@x\ttl@c\endcsname\@secondoftwo
+ \@tfor\ttl@a:={eh@t}{oh@t}{ef@b}{of@b}{eh@p}{oh@p}{ef@p}{of@p}\do{%
+ \expandafter\global\expandafter
+ \let\csname ttlr@\ttl@a\ttl@c\endcsname\relax}}{}}
+
+\def\ttl@killftps#1{%
+ \expandafter\global\expandafter
+ \let\csname ttlr@xx@x#1\endcsname\relax}
+
+\let\ttl@topft\@empty
+\let\ttl@botft\@empty
+\let\ttl@pageft\@empty
+
+\def\ttl@combinefloats{%
+ \ifx\@toplist\@empty\else
+ \def\@elt##1{%
+ \edef\ttl@topft{\string##1}%
+ \def\@elt####1{\ttl@killftps{\string####1}}}%
+ \@toplist
+ \fi
+ \ifx\@botlist\@empty\else
+ \def\@elt##1{%
+ \def\@elt####1{%
+ \def\@elt####1{\ttl@killftps\ttl@botft}%
+ \edef\ttl@botft{\string####1}}%
+ \edef\ttl@botft{\string##1}}%
+ \@botlist
+ \fi
+ \let\@elt\relax
+ \ttl@combinefloats@x}
+
+\AtBeginDocument{%
+ \let\ttl@combinefloats@x\@combinefloats
+ \let\@combinefloats\ttl@combinefloats}
+
+\endinput
diff --git a/Master/texmf-dist/tex/latex/titlesec/wrap.tss b/Master/texmf-dist/tex/latex/titlesec/wrap.tss
new file mode 100644
index 00000000000..a0f7d6c7340
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/titlesec/wrap.tss
@@ -0,0 +1,75 @@
+% +--------------------------------------------------+
+% | Typeset titlesec.tex to get the documentation. |
+% +--------------------------------------------------+
+%
+% Copyright (c) 1998-2002 by Javier Bezos.
+% All Rights Reserved.
+%
+% This file is part of the titlesec distribution release 2.5
+% -----------------------------------------------------------
+%
+% This program can be redistributed and/or modified under the terms
+% of the LaTeX Project Public License Distributed from CTAN
+% archives in directory macros/latex/base/lppl.txt; either
+% version 1 of the License, or any later version.
+
+\ProvidesFile{wrap.tss}[2002/03/23]
+
+\gdef\ttlh@wrap#1#2#3#4#5#6#7#8{%
+ \global\@noskipsectrue
+ \gdef\ttl@makeline##1{##1}%
+ \ttl@changecentercr
+ \begingroup
+ #1\ifhmode\ttl@hmode@error\fi
+ \titlewidth\z@
+ \def\\{\@ifstar{\@ifnextchar[{\ttl@bs}{\newline}}%
+ {\@ifnextchar[{\ttl@bs}{\newline}}}%
+ \def\ttl@bs[##1]{\newline}%
+ \let\@centercr\\%
+ \advance\rightskip 1\leftskip plus 1fil
+ \leftskip=\z@
+ \parindent\z@
+ \global\setbox\ttl@box\vtop{\setlength\hsize{#6}%
+ \color@begingroup
+ \ifttl@label{#2}\ttl@calc\hspace{#3}\fi
+ #4{#8}\kern\z@\strut
+ \@@par
+ \color@endgroup}%
+ \ttl@boxprocess
+ \global\titlewidth\titlewidth
+ \global\titlewidthfirst\titlewidthfirst
+ \global\titlewidthlast\titlewidthlast
+ \endgroup
+ \edef\ttl@maxdimen{\the\titlewidth}%
+ #1\ifhmode\ttl@hmode@error\fi
+ \global\setbox\ttl@box\vtop{\setlength\hsize{\ttl@maxdimen}%
+ \color@begingroup
+ \ifttl@label{#2}\ttl@calc\hspace{#3}\fi#4{#8}\kern\z@\strut
+ \@@par
+ \color@endgroup}%
+ \advance\@tempskipa1.5\baselineskip
+ \advance\@tempskipa\ht\ttl@box
+ \advance\@tempskipa\dp\ttl@box
+ \advance\@tempskipa-\pagegoal
+ \advance\@tempskipa\pagestretch
+ \@tempskipb\pagegoal
+ \pagegoal-\@tempskipa
+ \ifdim\bottomtitlespace<\z@\else
+ \def\@textbottom{\vskip\z@\@plus.0001fil}%
+ \fi
+ \penalty9999
+ \pagegoal\@tempskipb
+ \@tempdima\ht\ttl@box \advance\@tempdima\dp\ttl@box
+ \@tempdimb\@tempdima
+ \divide\@tempdima\baselineskip \count@\@tempdima
+ \advance\count@
+ \ifdim\@tempdimb<\the\count@.5\baselineskip\@ne\else\tw@\fi
+ \dp\ttl@box=\z@
+ \if@nobreak\advance\count@\@ne\fi
+ \xdef\@svsechd##1##2{%
+ \noexpand\llap{\box\ttl@box##2}%
+ \setbox\z@\hbox{\hskip\ttl@maxdimen\relax##2}%
+ \global\hangindent\wd\z@
+ \global\hangafter-\the\count@\relax}}
+
+\endinput