summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/titlesec/ttlkeys.def
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2006-01-13 00:09:20 +0000
committerKarl Berry <karl@freefriends.org>2006-01-13 00:09:20 +0000
commitdfa401eaa72183dde77ddd8e40d6893483a5260f (patch)
tree0d3b48ac2e8a4bbf29be5cd2c8ca41c1c33633d5 /Master/texmf-dist/tex/latex/titlesec/ttlkeys.def
parent27a4bc056250bdb3a69f7214928dec0001cb4bf6 (diff)
titlesec
git-svn-id: svn://tug.org/texlive/trunk@1393 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/titlesec/ttlkeys.def')
-rw-r--r--Master/texmf-dist/tex/latex/titlesec/ttlkeys.def114
1 files changed, 114 insertions, 0 deletions
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