From bb697854fb4e6eca8595e8c660b3a8aaffa47b06 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sat, 17 Dec 2011 00:59:21 +0000 Subject: titlesec/titleps 1.1.0 (15dec11) git-svn-id: svn://tug.org/texlive/trunk@24852 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/tex/latex/titlesec/block.tss | 4 +- Master/texmf-dist/tex/latex/titlesec/drop.tss | 4 +- Master/texmf-dist/tex/latex/titlesec/frame.tss | 4 +- .../texmf-dist/tex/latex/titlesec/leftmargin.tss | 4 +- Master/texmf-dist/tex/latex/titlesec/margin.tss | 4 +- .../texmf-dist/tex/latex/titlesec/rightmargin.tss | 4 +- Master/texmf-dist/tex/latex/titlesec/titleps.sty | 81 ++++-- Master/texmf-dist/tex/latex/titlesec/titlesec.sty | 29 +- Master/texmf-dist/tex/latex/titlesec/titletoc.sty | 4 +- Master/texmf-dist/tex/latex/titlesec/ttlkeys.def | 4 +- Master/texmf-dist/tex/latex/titlesec/ttlps.def | 319 ++++++++++++++++----- Master/texmf-dist/tex/latex/titlesec/wrap.tss | 4 +- 12 files changed, 353 insertions(+), 112 deletions(-) (limited to 'Master/texmf-dist/tex/latex/titlesec') diff --git a/Master/texmf-dist/tex/latex/titlesec/block.tss b/Master/texmf-dist/tex/latex/titlesec/block.tss index 1efb8356e25..34b2747a84f 100644 --- a/Master/texmf-dist/tex/latex/titlesec/block.tss +++ b/Master/texmf-dist/tex/latex/titlesec/block.tss @@ -5,7 +5,7 @@ % Copyright (c) 1998-2011 by Javier Bezos. % All Rights Reserved. % -% This file is part of the titlesec distribution release 2.9.2 +% This file is part of the titlesec distribution release 2.10.0 % ----------------------------------------------------------- % % It may be distributed and/or modified under the @@ -20,7 +20,7 @@ % % The Current Maintainer of this work is Javier Bezos. -\ProvidesFile{block.tss}[2011/11/11] +\ProvidesFile{block.tss}[2011/12/15] \gdef\ttlh@block#1#2#3#4#5#6#7#8{% \gdef\ttl@makeline##1{\ttl@calc\hspace{#6}##1\ttl@calc\hspace{#7}}% diff --git a/Master/texmf-dist/tex/latex/titlesec/drop.tss b/Master/texmf-dist/tex/latex/titlesec/drop.tss index 6d085ff4d0c..be0d638c085 100644 --- a/Master/texmf-dist/tex/latex/titlesec/drop.tss +++ b/Master/texmf-dist/tex/latex/titlesec/drop.tss @@ -5,7 +5,7 @@ % Copyright (c) 1998-2011 by Javier Bezos. % All Rights Reserved. % -% This file is part of the titlesec distribution release 2.9.2 +% This file is part of the titlesec distribution release 2.10.0 % ----------------------------------------------------------- % % It may be distributed and/or modified under the @@ -20,7 +20,7 @@ % % The Current Maintainer of this work is Javier Bezos. -\ProvidesFile{drop.tss}[2011/11/11] +\ProvidesFile{drop.tss}[2011/12/15] \gdef\ttlh@drop#1#2#3#4#5#6#7#8{% \global\@noskipsectrue diff --git a/Master/texmf-dist/tex/latex/titlesec/frame.tss b/Master/texmf-dist/tex/latex/titlesec/frame.tss index 273ab6be723..b386347010e 100644 --- a/Master/texmf-dist/tex/latex/titlesec/frame.tss +++ b/Master/texmf-dist/tex/latex/titlesec/frame.tss @@ -5,7 +5,7 @@ % Copyright (c) 1998-2011 by Javier Bezos. % All Rights Reserved. % -% This file is part of the titlesec distribution release 2.9.2 +% This file is part of the titlesec distribution release 2.10.0 % ----------------------------------------------------------- % % It may be distributed and/or modified under the @@ -20,7 +20,7 @@ % % The Current Maintainer of this work is Javier Bezos. -\ProvidesFile{frame.tss}[2011/11/11] +\ProvidesFile{frame.tss}[2011/12/15] \gdef\ttlh@frame#1#2#3#4#5#6#7#8{% \def\ttl@filleft##1{\hfill}% diff --git a/Master/texmf-dist/tex/latex/titlesec/leftmargin.tss b/Master/texmf-dist/tex/latex/titlesec/leftmargin.tss index 05776d68196..e2d17301f88 100644 --- a/Master/texmf-dist/tex/latex/titlesec/leftmargin.tss +++ b/Master/texmf-dist/tex/latex/titlesec/leftmargin.tss @@ -5,7 +5,7 @@ % Copyright (c) 1998-2011 by Javier Bezos. % All Rights Reserved. % -% This file is part of the titlesec distribution release 2.9.2 +% This file is part of the titlesec distribution release 2.10.0 % ----------------------------------------------------------- % % It may be distributed and/or modified under the @@ -20,7 +20,7 @@ % % The Current Maintainer of this work is Javier Bezos. -\ProvidesFile{leftmargin.tss}[2011/11/11] +\ProvidesFile{leftmargin.tss}[2011/12/15] \gdef\ttlh@leftmargin#1#2#3#4#5#6#7#8{% \global\@noskipsectrue diff --git a/Master/texmf-dist/tex/latex/titlesec/margin.tss b/Master/texmf-dist/tex/latex/titlesec/margin.tss index 73e42342c3d..4fc8cb3729b 100644 --- a/Master/texmf-dist/tex/latex/titlesec/margin.tss +++ b/Master/texmf-dist/tex/latex/titlesec/margin.tss @@ -5,7 +5,7 @@ % Copyright (c) 1998-2011 by Javier Bezos. % All Rights Reserved. % -% This file is part of the titlesec distribution release 2.9.2 +% This file is part of the titlesec distribution release 2.10.0 % ----------------------------------------------------------- % % It may be distributed and/or modified under the @@ -20,7 +20,7 @@ % % The Current Maintainer of this work is Javier Bezos. -\ProvidesFile{margin.tss}[2011/11/11] +\ProvidesFile{margin.tss}[2011/12/15] \gdef\ttlh@margin#1#2#3#4#5#6#7#8{% \global\@noskipsectrue diff --git a/Master/texmf-dist/tex/latex/titlesec/rightmargin.tss b/Master/texmf-dist/tex/latex/titlesec/rightmargin.tss index 39dce213c35..dc35f615985 100644 --- a/Master/texmf-dist/tex/latex/titlesec/rightmargin.tss +++ b/Master/texmf-dist/tex/latex/titlesec/rightmargin.tss @@ -5,7 +5,7 @@ % Copyright (c) 1998-2011 by Javier Bezos. % All Rights Reserved. % -% This file is part of the titlesec distribution release 2.9.2 +% This file is part of the titlesec distribution release 2.10.0 % ----------------------------------------------------------- % % @@ -21,7 +21,7 @@ % % The Current Maintainer of this work is Javier Bezos. -\ProvidesFile{rightmargin.tss}[2011/11/11] +\ProvidesFile{rightmargin.tss}[2011/12/15] \gdef\ttlh@rightmargin#1#2#3#4#5#6#7#8{% \global\@noskipsectrue diff --git a/Master/texmf-dist/tex/latex/titlesec/titleps.sty b/Master/texmf-dist/tex/latex/titlesec/titleps.sty index bc75ccdb675..b52e3d83d04 100644 --- a/Master/texmf-dist/tex/latex/titlesec/titleps.sty +++ b/Master/texmf-dist/tex/latex/titlesec/titleps.sty @@ -5,7 +5,7 @@ % Copyright (c) 1998-2011 by Javier Bezos. % All Rights Reserved. % -% This file is part of the titlesec distribution release 2.9.2 +% This file is part of the titlesec distribution release 2.10.0 % ----------------------------------------------------------- % % It may be distributed and/or modified under the @@ -24,13 +24,11 @@ % ~~~~~~~ \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{titleps}[2011/11/17 v1.0 Page styles] +\ProvidesPackage{titleps}[2011/12/15 v1.1.0 Page styles] % This package is mainly a wrapper for the pagestyle macros provided % by titlesec, so that they can be used without it. Functionality is -% almost similar, but top pagemarks (which require 2 marks, before -% and after the title) do not work directly and therefore they are -% not available (yet). +% almost similar. First, some definitions from titlesec. \newif\ifttl@ps \newif\ifttl@toclabel @@ -40,33 +38,84 @@ {\setlength\@tempskipa{#2}% #1{-\@tempskipa}}} -\DeclareRobustCommand\ttl@naerror[1]{% - \PackageError{titleps}% - {#1\space only available in titlesec.\MessageBreak - Consider using it instead of titleps}% - {titleps provides a subset of the macros\MessageBreak - for pagestyles defined in titlesec.}} +\newif\ifttl@premark % to be used in ttlps.def +\ttl@premarkfalse + +\def\ttl@premark#1#2{% + \protected@xdef\ttl@prevmarks{\ttl@marks}% + \csname#1mark\endcsname{#2}% + \gdef\ttl@prevmarks{\ttl@marks}} + +\let\ttl@savemark\@empty + +% Patching sectioning commands + +\newcommand\TitlepsPatchSection{% + \@ifstar{\ttl@setsec\@gobbletwo}% + {\ttl@setsec\pretitlemark}} + +\def\ttl@setsec#1#2{% + \@ifundefined{#2}{}{% + \expandafter\let\csname ttl@s@#2\expandafter\endcsname + \csname#2\endcsname + \@namedef{#2}{% + \@ifstar{\ttl@presec@s{#2}}% + {\@dblarg{\ttl@presec@x#1{#2}}}}}}% + +% premark/gobble, sect-name, opt, title +\def\ttl@presec@x#1#2[#3]#4{% + #1{#2}{#3}% + \@nameuse{ttl@s@#2}[#3]{#4}} +\def\ttl@presec@s#1#2{% + \gdef\ttl@savemark{\@nameuse{#1mark}{#2}}% + \@nameuse{ttl@s@#1}*{#2}} + +\def\ttl@atbegin{% + \TitlepsPatchSection*{chapter}% + \TitlepsPatchSection{section}% + \TitlepsPatchSection{subsection}% + \TitlepsPatchSection{subsubsection}% + \TitlepsPatchSection{paragraph}% + \TitlepsPatchSection{subparagraph}} + +\AtBeginDocument{\ttl@atbegin} + +% Package options + \DeclareOption{psfloats}{\let\ttl@replace\@empty} % a flag -\DeclareOption{outermarks}{\ttl@naerror{outermarks}} -\DeclareOption{topmarks}{\ttl@naerror{topmarks}} +\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{extramarks}{\let\ttl@fetchmark\@empty} +\DeclareOption{nopatches}{\let\ttl@atbegin\relax} \ExecuteOptions{innermarks} \ProcessOptions +% Load the package body + \let\newpagestyle\@empty \let\renewpagestyle\@empty \let\widenhead\@empty \input ttlps.def -% Raise error if the following are used. +% Raise error if the following are used + +\DeclareRobustCommand\ttl@naerror[1]{% + \PackageError{titleps}% + {#1\space only available in titlesec.\MessageBreak + Consider using it instead of titleps}% + {titleps provides a subset of the macros\MessageBreak + for pagestyles defined in titlesec.}} \def\ttl@setifthe#1{% \expandafter\protected@edef\csname ifthe#1\endcsname{% @@ -80,8 +129,4 @@ \ttl@setifthe{paragraph} \ttl@setifthe{subparagraph} -\renewcommand\toptitlemarks{\ttl@naerror{\string\toptitlemarks}} -\renewcommand\nexttoptitlemarks{\ttl@naerror{\string\nexttoptitlemarks}} -\renewcommand\outertitlemarks{\ttl@naerror{\string\outertitlemarks}} - \endinput \ No newline at end of file diff --git a/Master/texmf-dist/tex/latex/titlesec/titlesec.sty b/Master/texmf-dist/tex/latex/titlesec/titlesec.sty index 63271d50635..c9c4f5d1650 100644 --- a/Master/texmf-dist/tex/latex/titlesec/titlesec.sty +++ b/Master/texmf-dist/tex/latex/titlesec/titlesec.sty @@ -5,7 +5,7 @@ % Copyright (c) 1998-2011 by Javier Bezos. % All Rights Reserved. % -% This file is part of the titlesec distribution release 2.9.2 +% This file is part of the titlesec distribution release 2.10.0 % ----------------------------------------------------------- % % It may be distributed and/or modified under the @@ -48,7 +48,7 @@ % ~~~~~~~ \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{titlesec}[2011/11/11 v2.9.2 Sectioning titles] +\ProvidesPackage{titlesec}[2011/12/15 v2.10.0 Sectioning titles] % Initialization % ~~~~~~~~~~~~~~ @@ -334,6 +334,16 @@ \ttl@elinemarks \global\ttl@toclabelfalse} +\newif\ifttl@premark % to be used in ttlps.def +\ttl@premarkfalse + +\def\ttl@premark#1#2{% + \protected@xdef\ttl@prevmarks{\ttl@marks}% + \ttl@blinemarks + \csname#1mark\endcsname{#2}% + \ttl@elinemarks + \gdef\ttl@prevmarks{\ttl@marks}} + % 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 @@ -360,9 +370,11 @@ \let\ifttl@toclabel\ifttl@label \ifx\ttl@savewrite\@empty\else % If marks \ifttl@ps - \ttl@blinemarks - \csname#1mark\endcsname{#2}% - \ttl@elinemarks + \ifttl@premark + \global\ttl@premarkfalse + \else % if no \pretitlemark + \ttl@premark{#1}{#2}% + \fi \fi \ifttl@label\else\ttl@Hy@steplink{#1}\fi \fi} @@ -396,13 +408,7 @@ \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 @@ -901,6 +907,7 @@ \DeclareOption{pagestyles}{\let\sectiontitle\@empty} +\DeclareOption{extramarks}{\let\ttl@fetchmark\@empty} \DeclareOption{floatps}{% \ifx\sectiontitle\@empty \let\ttl@replace\space diff --git a/Master/texmf-dist/tex/latex/titlesec/titletoc.sty b/Master/texmf-dist/tex/latex/titlesec/titletoc.sty index 945bdb85a83..1e758e76cdf 100644 --- a/Master/texmf-dist/tex/latex/titlesec/titletoc.sty +++ b/Master/texmf-dist/tex/latex/titlesec/titletoc.sty @@ -5,7 +5,7 @@ % Copyright (c) 1998-2011 by Javier Bezos. % All Rights Reserved. % -% This file is part of the titlesec distribution release 2.9.2 +% This file is part of the titlesec distribution release 2.10.0 % ----------------------------------------------------------- % % It may be distributed and/or modified under the @@ -91,7 +91,7 @@ % result with \included (F. Mittelbach) % 07/07/14: Removed the patch mechanism. -\ProvidesPackage{titletoc}[2011/11/11 v1.6 TOC entries] +\ProvidesPackage{titletoc}[2011/12/15 v1.6 TOC entries] % The following tags are used: % ttl@ : the generic one, shared with titlesec diff --git a/Master/texmf-dist/tex/latex/titlesec/ttlkeys.def b/Master/texmf-dist/tex/latex/titlesec/ttlkeys.def index e14837091b4..19d5cac879c 100644 --- a/Master/texmf-dist/tex/latex/titlesec/ttlkeys.def +++ b/Master/texmf-dist/tex/latex/titlesec/ttlkeys.def @@ -5,7 +5,7 @@ % Copyright (c) 1998-2011 by Javier Bezos. % All Rights Reserved. % -% This file is part of the titlesec distribution release 2.9.2 +% This file is part of the titlesec distribution release 2.10.0 % ----------------------------------------------------------- % % It may be distributed and/or modified under the @@ -20,7 +20,7 @@ % % The Current Maintainer of this work is Javier Bezos. -\ProvidesFile{ttlkeys.def}[2011/11/11] +\ProvidesFile{ttlkeys.def}[2011/12/15] % 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 diff --git a/Master/texmf-dist/tex/latex/titlesec/ttlps.def b/Master/texmf-dist/tex/latex/titlesec/ttlps.def index c5156e81280..b68c4ece33c 100644 --- a/Master/texmf-dist/tex/latex/titlesec/ttlps.def +++ b/Master/texmf-dist/tex/latex/titlesec/ttlps.def @@ -5,7 +5,7 @@ % Copyright (c) 1998-2011 by Javier Bezos. % All Rights Reserved. % -% This file is part of the titlesec distribution release 2.9.2 +% This file is part of the titlesec distribution release 2.10.0 % ----------------------------------------------------------- % % It may be distributed and/or modified under the @@ -53,6 +53,12 @@ % 10/12/03: A little addition to the warning, for those who don't % read the docs. % +% History of v1.1 +% ~~~~~~~~~~~~~~~ +% 11/11/26: Add the extra mark mechanim +% 11/12/07: Enlarged, eg, multilevel \newtitlemark, \newtitlemark*, +% premarks +% % 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 @@ -66,7 +72,7 @@ % values in the mark before the title, and the current values in the % mark after. -\ProvidesFile{ttlps.def}[2011/11/11] +\ProvidesFile{ttlps.def}[2011/12/15] % % Page Styles @@ -97,30 +103,39 @@ \expandafter\@firstoftwo \fi} +% \newtitlemarks belongs to a nameless markset (ie, \@empty). +% For named extra marksets see below. + \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} + \@ifstar{\@tempswafalse\ttl@newmk@i\@empty}% + {\@tempswatrue\ttl@newmk@i\@empty}} + +\def\ttl@newmk@i#1#2{% markset, macro/var + \edef\ttl@a{\expandafter\@gobble\string#2}% + \expandafter\ifx\csname\ttl@a\endcsname#2\else + \edef\ttl@a{c@#2}% + \fi + \expandafter\ttl@newmk@ii\expandafter{\ttl@a}{#1}} -\def\ttl@newmk@ii#1{% +\def\ttl@newmk@ii#1#2{% macro/var, markset + \expandafter\let\expandafter\ttl@a\csname ttl@mks@#2\endcsname \if@tempswa - \expandafter\def\expandafter\ttl@moremarks\expandafter{% - \ttl@moremarks + \expandafter\def\expandafter\ttl@a\expandafter{% + \ttl@a \protect\@namedef{#1}{\@nameuse{#1}}}% \else - \expandafter\def\expandafter\ttl@moremarks\expandafter{% - \ttl@moremarks + \expandafter\def\expandafter\ttl@a\expandafter{% + \ttl@a \protect\@nameuse{#1}=\the\@nameuse{#1}\relax}% - \fi} + \fi + \expandafter\let\csname ttl@mks@#2\endcsname\ttl@a} +\let\ttl@mks@\@empty +\def\ttl@moremarks{\ttl@mks@} % backward compat + \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 @@ -145,10 +160,18 @@ \ttl@setifthe{paragraph} \ttl@setifthe{subparagraph} +% Putting marks +% ------------- + \newtitlemark{\ttl@running} \let\ttl@enccode\relax \def\ttl@running{\ttl@enccode} +% \ttl@markboth redefines temporarily \mark to fetch changes made by +% babel or ams, saved in \ttl@running. When this is done, the actual +% \mark es emitted, which has \ttl@running as part of the markset (see +% the \newtitlemark above). + \def\ttl@markboth#1{% \begingroup \let\protect\@unexpandable@protect @@ -164,36 +187,68 @@ \xdef\ttl@marks{\ttl@marks}% \gdef\@themark{{\ttl@marks}{\ttl@prevmarks}}% \ttl@c{\@themark}% + \@nameuse{ttl@tem@#1}% \if@nobreak\ifvmode\nobreak\fi\fi \endgroup} -\newcommand\setmarks[2]{\def\ttl@marksset{{#1}{#2}}} +\newcommand\settitlemarks{\@ifstar\ttl@svmarks@s\ttl@svmarks@x} + +\def\ttl@svmarks@x#1{\def\ttl@marksset{{#1}}} +\def\ttl@svmarks@s#1{\def\ttl@marksset{*{#1}}} -\def\ttl@setmarks#1#2{% +\newcommand\setmarks[2]{\settitlemarks{#1,#2}} % back compat + +\def\ttl@settopmark#1\@@{% \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}% + \expandafter\let\expandafter\ttl@marks\csname ttl@tm@#1\endcsname \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}}}% + \global\@namedef{ttl@tm@#1}{% + \protect\@namedef{#1title}{\@nameuse{#1title}}% + \protect\@namedef{the#1}{\@nameuse{the#1}}% + \protect\@namedef{ifthe#1}{\@nameuse{ifthe#1}}}% + \def\ttl@elt##1{% + \expandafter\ttl@setsubmark\ttl@a\@@{##1}}% + \ttl@c}% + +\def\ttl@setsubmark#1\@@#2{% + \expandafter\g@addto@macro\csname ttl@tm@#2\endcsname{% + \protect\@namedef{#1title}{}% + \protect\@namedef{the#1}{}% + \protect\@namedef{ifthe#1}{\protect\@secondoftwo}} + \expandafter\g@addto@macro\csname ttl@tm@#1\endcsname{% + \protect\@namedef{#2title}{\@nameuse{#2title}}% + \protect\@namedef{the#2}{\@nameuse{the#2}}% + \protect\@namedef{ifthe#2}{\@nameuse{ifthe#2}}}}% + +\def\ttl@setmarks@x#1{% + \let\ttl@c\@empty % sub list + \@for\ttl@a:=#1\do{% + \expandafter\ttl@settopmark\ttl@a\@@ + \let\ttl@elt\relax + \xdef\ttl@c{\ttl@c\ttl@elt{\ttl@a}}}% + \@for\ttl@a:=#1\do{% + \expandafter\g@addto@macro\csname ttl@tm@\ttl@a\endcsname{% + \ttl@moremarks}}} + +\def\ttl@setmarks@s#1{% Solo con extramarks + \PackageError{titlesec}% + {You need `extramarks' for \string\settitlemarks*}% + {\string\settitlemarks* requires the package option `extramarks'}} + +\newcommand\pretitlemark{% + \global\ttl@premarktrue + \@ifstar{\ttl@pretitlemark\z@}% + {\ttl@pretitlemark\@ne}} + +\def\ttl@pretitlemark#1#2#3{% + \addtocounter{#2}#1% + \ttl@premark{#2}{#3}% + \addtocounter{#2}{-#1}} + +% Rules +% ----- \newcommand\headrule{\setheadrule{.4\p@}} \newcommand\footrule{\setfootrule{.4\p@}} @@ -231,36 +286,36 @@ \ttl@defaultps \def\ttl@headfmt{#3}% #4% - \def\setmarks####1####2{\def\ttl@marksset{{####1}{####2}}}}} + \def\settitlemarks{\@ifstar\ttl@svmarks@s\ttl@svmarks@x}}} \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} + \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 + \def\settitlemarks{\@ifstar\ttl@setmarks@s\ttl@setmarks@x}% + \expandafter\settitlemarks\ttl@marksset} \@ifundefined{chapter}% - {\setmarks{section}{subsection}}% - {\setmarks{chapter}{section}} + {\settitlemarks{section,subsection}}% + {\settitlemarks{chapter,section}} -\newcommand\usepage{\protect\thepage} +\newcommand\usepage{\protect\thepage} % back compat -\newcommand\toptitlemarks {\expandafter\@secondoftwo\firstmark{}{}{}} +\newcommand\toptitlemarks{\expandafter\@secondoftwo\firstmark{}{}{}} \def\firsttitlemarks{% \toks@\expandafter\expandafter\expandafter{% \expandafter\@secondoftwo \firstmark{}{}{}}% @@ -273,8 +328,8 @@ \else \expandafter\@firstoftwo \firstmark{}{}{}% \fi} -\newcommand\bottitlemarks {\expandafter\@secondoftwo\botmark{}{}{}} -\newcommand\nexttoptitlemarks{\expandafter\@firstoftwo \botmark{}{}{}} +\newcommand\bottitlemarks{\expandafter\@secondoftwo\botmark{}{}{}} +\newcommand\nexttoptitlemarks{\expandafter\@firstoftwo\botmark{}{}{}} \newcommand\outertitlemarks{% \if@twoside \ifodd\c@page\relax @@ -296,7 +351,6 @@ \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}} @@ -354,8 +408,8 @@ \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@titlemarks % Must precede the format. Defines \ttl@running + \def\ttl@enccode{\ttl@headinline#1{}{}{}}% which contains ttl@enccode \ttl@running \ttl@calcneg\hspace{#4}}% @@ -375,6 +429,141 @@ \def\ttl@hiel{\z@}\def\ttl@hier{\z@} \def\ttl@hiol{\z@}\def\ttl@hior{\z@} +% A tool: + +\def\ifsamemark#1#2{% + {#1\global\let\ttl@c#2}% + \ifx\ttl@c#2% + \expandafter\@firstoftwo + \else + \expandafter\@secondoftwo + \fi} + +% =========== +% EXTRA MARKS +% =========== + +\ifx\ttl@fetchmark\@empty + +\ifx\newmarks\@undefined + \PackageInfo{titleps}{% + You have requested `extramarks' but etex or similar\MessageBreak + has not been loaded. I'll do it for you.} + \RequirePackage{etex} +\fi + +\def\ttl@setmarks@s#1{% + \@for\ttl@a:=#1\do{% + \@ifundefined{ttl@mkc@\ttl@a}{% + \expandafter\newmarks\csname ttl@mkc@\ttl@a\endcsname}{}% + \expandafter\xdef\csname ttl@tem@\ttl@a\endcsname{% + \marks\expandafter\noexpand\csname ttl@mkc@\ttl@a\endcsname + {\noexpand\@themark}}}% + \ttl@setmarks@x{#1}}% + +\newcommand\newmarkset[1]{% + \expandafter\newmarks\csname ttl@mkc@#1\endcsname + \@namedef{ttl@mks@#1}{}% + \@namedef{ttl@premks@#1}{\@nameuse{ttl@mks@#1}}} + +\newcommand\newextramark{% + \@ifstar{\@tempswafalse\ttl@newmk@i}% + {\@tempswatrue\ttl@newmk@i}} + +\def\ttl@extramark#1{% + \begingroup + \let\protect\@unexpandable@protect + \let\@mkboth\@gobbletwo + \let\label\relax + \let\index\relax + \let\glossary\relax\endgroup} + +\newcommand\extramark[1]{% + \begingroup + \let\protect\@unexpandable@protect + \let\@mkboth\@gobbletwo + \let\label\relax + \let\index\relax + \let\glossary\relax + \marks\csname ttl@mkc@#1\endcsname{% + {\@nameuse{ttl@mks@#1}}% + {\@nameuse{ttl@mks@#1}}}% + \expandafter\xdef\csname ttl@premks@#1\endcsname + {\@nameuse{ttl@mks@#1}}% + \endgroup + \if@nobreak\ifvmode\nobreak\fi\fi}% + +\newcommand\preextramark[1]{% + \begingroup + \let\protect\@unexpandable@protect + \let\@mkboth\@gobbletwo + \let\label\relax + \let\index\relax + \let\glossary\relax + \marks\csname ttl@mkc@#1\endcsname{% + {\csname ttl@mks@#1\endcsname}% + {\csname ttl@premks@#1\endcsname}}% + \endgroup + \if@nobreak\ifvmode\nobreak\fi\fi} + +\newcommand\newshortmark[1]{% + \newmarkset{\string#1}% + \newextramark{\string#1}#1} + +\newcommand\shortmark[1]{\extramark{\string#1}} +\newcommand\preshortmark[1]{\preextramark{\string#1}} + +\newcommand\topshortmark[1]{{\topextramarks{\string#1}#1}} +\newcommand\firstshortmark[1]{{\firstextramarks{\string#1}#1}} +\newcommand\botshortmark[1]{{\botextramarks{\string#1}#1}} +\newcommand\nexttopshortmark[1]{{\nexttopextramarks{\string#1}#1}} + +\def\ttl@fetchmark#1#2#3{% + \expandafter#1#2\csname ttl@mkc@#3\endcsname{}{}{}} + +\newcommand\topextramarks[1]{\ttl@fetchmark\@secondoftwo\firstmarks{#1}} +\newcommand\firstextramarks[1]{% + \toks@\expandafter\expandafter\expandafter{% + \ttl@fetchmark\@secondoftwo\firstmarks{#1}}% + \@temptokena\expandafter\expandafter\expandafter{% + \ttl@fetchmark\@secondoftwo\botmarks{#1}}% + \edef\ttl@a{\the\toks@}% + \edef\ttl@b{\the\@temptokena}% + \ifx\ttl@a\ttl@b + \ttl@fetchmark\@secondoftwo\firstmarks{#1}% + \else + \ttl@fetchmark\@firstoftwo\firstmarks{#1}% + \fi} +\newcommand\botextramarks[1]{\ttl@fetchmark\@secondoftwo\botmarks{#1}} +\newcommand\nexttopextramarks[1]{\ttl@fetchmark\@firstoftwo\botmarks{#1}} + +\newcommand\outerextramarks[1]{% + \if@twoside + \ifodd\c@page\relax + \botextramarks{#1}% + \else + \topextramarks{#1}% + \fi + \else + \topextramarks{#1}% + \fi} +\newcommand\innerextramarks[1]{% + \if@twoside + \ifodd\c@page\relax + \firstextramarks{#1}% + \else + \botextramarks{#1}% + \fi + \else + \botextramarks{#1}% + \fi} + +\fi + +% ====== +% FLOATS +% ====== +% % Pagestyles with floats. There macros are defined only with the % psfloats package option. diff --git a/Master/texmf-dist/tex/latex/titlesec/wrap.tss b/Master/texmf-dist/tex/latex/titlesec/wrap.tss index 0dae34ad766..e0351dfd1eb 100644 --- a/Master/texmf-dist/tex/latex/titlesec/wrap.tss +++ b/Master/texmf-dist/tex/latex/titlesec/wrap.tss @@ -5,7 +5,7 @@ % Copyright (c) 1998-2011 by Javier Bezos. % All Rights Reserved. % -% This file is part of the titlesec distribution release 2.9.2 +% This file is part of the titlesec distribution release 2.10.0 % ----------------------------------------------------------- % % It may be distributed and/or modified under the @@ -20,7 +20,7 @@ % % The Current Maintainer of this work is Javier Bezos. -\ProvidesFile{wrap.tss}[2011/11/11] +\ProvidesFile{wrap.tss}[2011/12/15] \gdef\ttlh@wrap#1#2#3#4#5#6#7#8{% \global\@noskipsectrue -- cgit v1.2.3