From a3e65cf58603aec6b27742b833f880c0f3372020 Mon Sep 17 00:00:00 2001
From: Karl Berry <karl@freefriends.org>
Date: Wed, 15 Aug 2007 18:44:25 +0000
Subject: titlesec 2.7 (11aug07)

git-svn-id: svn://tug.org/texlive/trunk@4731 c570f23f-e606-0410-a88d-b1316a301751
---
 Master/texmf-dist/tex/latex/titlesec/titlesec.sty | 146 ++++++++++++++++------
 1 file changed, 111 insertions(+), 35 deletions(-)

(limited to 'Master/texmf-dist/tex/latex/titlesec/titlesec.sty')

diff --git a/Master/texmf-dist/tex/latex/titlesec/titlesec.sty b/Master/texmf-dist/tex/latex/titlesec/titlesec.sty
index b43d0f32fcb..7125c5a9055 100644
--- a/Master/texmf-dist/tex/latex/titlesec/titlesec.sty
+++ b/Master/texmf-dist/tex/latex/titlesec/titlesec.sty
@@ -2,16 +2,23 @@
 % | Typeset titlesec.tex to get the documentation.   |
 % +--------------------------------------------------+
 %
-% Copyright (c) 1998-2005 by Javier Bezos.
+% Copyright (c) 1998-2007 by Javier Bezos.
 % All Rights Reserved.
 %
-% This file is part of the titlesec distribution release 2.6
+% This file is part of the titlesec distribution release 2.8
 % -----------------------------------------------------------
 %
-% 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.
+% It may be distributed and/or modified under the
+% conditions of the LaTeX Project Public License, either version 1.3
+% of this license or (at your option) any later version.
+% The latest version of this license is in
+%   http://www.latex-project.org/lppl.txt
+% and version 1.3 or later is part of all distributions of LaTeX
+% version 2003/12/01 or later.
+% 
+% This work has the LPPL maintenance status "maintained".
+% 
+% The Current Maintainer of this work is Javier Bezos.
 
 % History of v1.0
 % ~~~~~~~~~~~~~~~
@@ -191,7 +198,7 @@
 %          -  Removed extra (but inoffensive) \expandafter
 %             in \ttl@class@iii.
 % 2002/03/27  Added \titlewidthfirst and ...last
-%          -  «Not definable» gives a  more meaningful message in
+%          -  "Not definable" gives a  more meaningful message in
 %             the context of the package.
 %
 % History of v.2.6
@@ -218,6 +225,22 @@
 % 2005/01/21  Changed pageatnewline to make it compatible with
 %             titletoc, with \ttl@changecentercr.
 % 2005/01/22  \...tolist in top class.
+%
+% History of v.2.7
+% ~~~~~~~~~~~~~~~~
+% 2007-03-27  Added the `explicit' option.
+% 2007-03-27  Added \titlepagestyle.
+% 2007-03-29  Fixed wrong number for chapter in log
+% 2007-03-29  Patch file named .270 instead of .new
+% 2007-05-09  Added <after> to leftmargin, so that you can add stuff
+%             at the beginning of the paragraph, eg, the sec number.
+% 2007-07-07  Removed the patch mechanism.
+% 2007-08-07  `explicit' improved.
+%
+% History of v.2.8
+% ~~~~~~~~~~~~~~~~
+% 2007-08-12  \titlepagestyle already used by KOMA-Script. Renamed
+%             to \assignpagestyle.
 %  
 % Notes
 % ~~~~~
@@ -247,7 +270,7 @@
 % ~~~~~~~
 
 \NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{titlesec}[2005/01/22 v2.6 Sectioning titles]
+\ProvidesPackage{titlesec}[2007/08/12 v2.8 Sectioning titles]
 
 % Initialization
 % ~~~~~~~~~~~~~~
@@ -365,7 +388,7 @@
   \expandafter\edef\csname ttlss@\ttl@b\endcsname{\ttl@a}%
   \let\ttl@a\ttl@toplevel
   \count@\csname ttll@\ttl@toplevel\endcsname
-  \ttl@class@iv}%  \expandafter
+  \ttl@class@iv}
 
 \def\ttl@class@iv{%
   \@ifundefined{ttlss@\ttl@a}{}%
@@ -463,6 +486,8 @@
 % is not lost inside a box by saving it into \ttl@mk,
 % which in turn is used by the sect and chap commands.
 
+\newif\ifttl@explicit
+
 \def\ttl@gmk#1{\gdef\ttl@mk{#1}}
 
 \def\ttl@select#1#2#3#4{%
@@ -486,7 +511,13 @@
    \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@...
+   \ifttl@explicit
+     \def\ttl@passexplicit{#4}% 
+     \ttl@c{#4}{#2}{#3}{}% ttl@c is returned by ttl@try with ttlf@...
+   \else     
+     \let\ttl@passexplicit\@empty 
+     \ttl@c{#2}{#3}{#4}% ttl@c is returned by ttl@try with ttlf@...
+   \fi
   \endgroup}
 
 \let\ttl@savewrite\@empty
@@ -536,6 +567,7 @@
         \ttl@labelfalse     % Third: if too deep
       \else
         \ttl@Hy@refstepcounter{#1}%
+        \@nameuse{ttl@#1out}%
       \fi
     \fi
   \fi
@@ -551,9 +583,13 @@
 
 % Executed by ttl@labelling if the name of section is chapter:
 
-\def\ttl@chapterlabel{%
-  \if@mainmatter\else\ttl@labelfalse\fi
-  \typeout{\chaptertitlename\space\thechapter.}}
+\def\ttl@chapterlabel{\if@mainmatter\else\ttl@labelfalse\fi}
+
+% Executed by ttl@labelling if chapter has a number. Note
+% you can define messages for other sectioning levels (eg,
+% \ttl@sectionout).
+
+\def\ttl@chapterout{\typeout{\chaptertitlename\space\thechapter.}}
 
 % Straight class
 % ~~~~~~~~~~~~~
@@ -593,6 +629,8 @@
     \@ifundefined{#6break}%
       {\addpenalty{\@secpenalty}}%
       {\csname#6break\endcsname}%
+    \@ifundefined{ttl@ps@\string#6}{}%
+      {\PackageWarning{titlesec}{Page style in straight class ignored}}%
     \addvspace{\@tempskipa}%
     \ifdim\bottomtitlespace<\z@
     \else
@@ -649,6 +687,8 @@
 \def\ttl@part@ii#1#2#3#4#5#6#7{%
   \ttl@assign\@tempskipa#3\relax\beforetitleunit
   \vspace*{\@tempskipa}%
+  \@ifundefined{ttl@ps@\string#6}{}%
+    {\PackageWarning{titlesec}{Page style in part class ignored}}%
   \global\@afterindenttrue
   \ifcase#5 \global\@afterindentfalse \fi
   \ttl@assign\@tempskipb#4\relax\aftertitleunit 
@@ -676,7 +716,9 @@
   \else
     \clearpage
   \fi
-  \thispagestyle{plain}%
+  \@ifundefined{ttl@ps@\string#6}%
+    {\thispagestyle{plain}}%
+    {\thispagestyle{\@nameuse{ttl@ps@\string#6}}}%
   \if@twocolumn
     \onecolumn
     \@tempswatrue
@@ -695,7 +737,9 @@
   \if@twoside
     \if@openright
       \null
-      \thispagestyle{empty}%
+      \@ifundefined{ttl@ps@\string#6}%
+        {\thispagestyle{empty}}%
+        {\thispagestyle{\@nameuse{ttl@ps@\string#6}}}%
       \newpage
     \fi
   \fi
@@ -713,6 +757,8 @@
   \gdef\ttl@savemark{\csname#6mark\endcsname{#7}}%
   \let\ttl@savewrite\@empty
   \let\ttl@Hy@saveanchor\@empty
+  \@ifundefined{ttl@ps@\string#6}{}%
+    {\thispagestyle{\@nameuse{ttl@ps@\string#6}}}%
   \let\ifttl@toclabel\ifttl@label
   \ttl@mkchap@i{#1}{#2}{#3}{#4}{#5}{#6}{#7}}
 
@@ -745,7 +791,9 @@
        \clearpage
      \fi}%
     {\csname#6break\endcsname}%
-  \thispagestyle{plain}%
+  \@ifundefined{ttl@ps@\string#6}%
+    {\thispagestyle{plain}}%
+    {\thispagestyle{\@nameuse{ttl@ps@\string#6}}}%
   \global\@topnum\z@
   \@ifundefined{#6tolists}%
     {\addtocontents{lof}{\protect\ttl@tocsep}%
@@ -804,6 +852,8 @@
 % whose content is
 %  \ttl@<shape>{format}{label}{sep}{before}{after}
 
+\newtoks\ttl@toksa
+
 \newcommand\titleformat{%
   \@ifstar{\ttl@format@s}%
           {\ttl@format@i}}
@@ -826,16 +876,17 @@
 
 \def\ttl@format@ii#1[#2]#3#4#5#6{%
   \ttl@getkeys{#1}{titlesec}%
+  \ttl@toksa{{#3}{#4}{#5}{#6}}% Save  arguments
   \@ifnextchar[{%
-    \ttl@format@iii{#2}{#3}{#4}{#5}{#6}%
+    \ttl@format@iii{#2}%
   }{%
-    \ttl@format@iii{#2}{#3}{#4}{#5}{#6}[]}}
+    \ttl@format@iii{#2}[]}}
 
 % First, we get the shape -- if not defined it loads
 % the corresponding file.
 
 
-\def\ttl@format@iii#1#2#3#4#5[#6]{%
+\def\ttl@format@iii#1[#2]{%
   \@ifundefined{ttlh@#1}{%
     \begingroup
     \makeatletter
@@ -845,8 +896,19 @@
           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}}%
+  \@temptokena{#2}%
+  \ifttl@explicit
+    \edef\ttl@b{%
+      \def\expandafter\noexpand\csname ttlf@\ttl@a\endcsname####1%
+      {\expandafter\noexpand\csname ttlh@#1\endcsname
+       \the\ttl@toksa{\the\@temptokena}}}%
+  \else
+    \edef\ttl@b{%
+      \def\expandafter\noexpand\csname ttlf@\ttl@a\endcsname
+      {\expandafter\noexpand\csname ttlh@#1\endcsname
+       \the\ttl@toksa{\the\@temptokena}}}%
+  \fi
+  \ttl@b
   \csname ttl@compat\ttl@a\endcsname}
 
 % Styles
@@ -857,6 +919,8 @@
 % arguments:
 % {format}{label}{sep}{before}{after}{left}{right}{title}
 % where before and after refer to the format.
+% With the option explicit, #4 contains the title and #8 is
+% empty.
 
 \def\ttlh@display#1#2#3#4#5#6#7#8{%
   \gdef\ttl@makeline##1{\ttl@calc\hspace{#6}##1\ttl@calc\hspace{#7}}%
@@ -1077,6 +1141,8 @@
 
 \DeclareOption{footmarks}{} % Backward compat
 
+\DeclareOption{explicit}{\ttl@explicittrue}
+
 \DeclareOption{clearempty}{%
   \def\cleardoublepage{%
     \clearpage{\ps@empty\if@twoside\ifodd\c@page\else
@@ -1230,6 +1296,10 @@
 %               +-----------------+
 %               |   PAGE STYLES   |
 %               +-----------------+
+%
+% This is generic:
+
+\newcommand\assignpagestyle[2]{\@namedef{ttl@ps@\string#1}{#2}}
 
 % Old pagestyles
 % ~~~~~~~~~~~~~~
@@ -1286,9 +1356,7 @@
      \let\ifttl@toclabel\ifttl@label
      \@dblarg{#1}}}
 
-\@ifundefined{ttl@extract}{}{% Load patches here if we exit
-  \InputIfFileExists{titlesec.new}{}{}%
-  \endinput}
+\@ifundefined{ttl@extract}{}{\endinput}
 
 \newcommand\titlelabel[1]{%
   \def\@seccntformat##1{#1}}
@@ -1329,17 +1397,23 @@
   \ifdim\@tempskipb<\z@
     \if@tempswa
       \titleformat#8[runin]%
-         {\ttl@fonts\ttl@sizes{#3}}{\@seccntformat{#2}}{\z@}{}%
+         {\ttl@fonts\ttl@sizes{#3}}{\@seccntformat{#2}}%
+         {\z@}\ttl@passexplicit
     \else
-      \titleformat#8[runin]{#7}{\@seccntformat{#2}}{\z@}{}%
+      \titleformat#8[runin]%
+         {#7}{\@seccntformat{#2}}%
+         {\z@}\ttl@passexplicit
     \fi
     \@tempskipb-\@tempskipb
   \else
     \if@tempswa
       \titleformat#8%
-        {\ttl@fil\ttl@fonts\ttl@sizes{#3}}{\@seccntformat{#2}}{\z@}{}%
+        {\ttl@fil\ttl@fonts\ttl@sizes{#3}}{\@seccntformat{#2}}%
+        {\z@}\ttl@passexplicit 
     \else
-      \titleformat#8{#7}{\@seccntformat{#2}}{\z@}{}%
+      \titleformat#8%
+        {#7}{\@seccntformat{#2}}%
+        {\z@}\ttl@passexplicit
     \fi
     \@ifundefined{ttl@space}{}{%
       \ttl@assign\@tempskipb*\ttl@space\relax\aftertitleunit}%
@@ -1384,7 +1458,7 @@
   \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@}
+    {\@chapapp\space\thechapter}{.8\baselineskip}{\ttl@sizes\z@\ttl@passexplicit}
   \fi
 
 \fi
@@ -1416,10 +1490,16 @@
   \let\ttl@save@mkschap\@makeschapterhead
 
   \def\@makechapterhead#1{%
-    \gdef\ttl@savemark{\chaptermark{#1}}\ttl@save@mkchap{#1}}
+    \gdef\ttl@savemark{\chaptermark{#1}}%
+    \ttl@save@mkchap{#1}%
+    \@ifundefined{ttl@ps@\string\chapter}{}%
+      {\thispagestyle{\@nameuse{ttl@ps@\string\chapter}}}}
 
   \def\@makeschapterhead#1{%
-    \gdef\ttl@savemark{\chaptermark{#1}}\ttl@save@mkschap{#1}}
+    \gdef\ttl@savemark{\chaptermark{#1}}%
+    \ttl@save@mkschap{#1}%
+    \@ifundefined{ttl@ps@\string\chapter}{}%
+      {\thispagestyle{\@nameuse{ttl@ps@\string\chapter}}}}
 
   \@namedef{ttll@part}{-1}
   \@namedef{ttlss@part}{chapter}
@@ -1446,8 +1526,4 @@
 \titleclass{\paragraph}    {straight}[\subsubsection]
 \titleclass{\subparagraph} {straight}[\paragraph]
 
-% Load patches if necessary
-
-\InputIfFileExists{titlesec.new}{}{}
-
 \endinput
-- 
cgit v1.2.3

