diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex/titlesec/ttlps.def')
-rw-r--r-- | Master/texmf-dist/tex/latex/titlesec/ttlps.def | 319 |
1 files changed, 254 insertions, 65 deletions
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. |