summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/titlesec/titleps.sty
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/latex/titlesec/titleps.sty')
-rw-r--r--Master/texmf-dist/tex/latex/titlesec/titleps.sty81
1 files changed, 63 insertions, 18 deletions
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