summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/koma-script/scrkbase.sty
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2007-10-11 23:46:49 +0000
committerKarl Berry <karl@freefriends.org>2007-10-11 23:46:49 +0000
commit82dc50c595ce8268fd46c4af7ce77bf20af120d0 (patch)
tree6c051b86aedada971bc69a4cd18495683df13e8b /Master/texmf-dist/tex/latex/koma-script/scrkbase.sty
parentbc91a8ed9ae14ad4f0805df6c244b55063d69414 (diff)
koma-script 2.97c (10oct07)
git-svn-id: svn://tug.org/texlive/trunk@5160 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/koma-script/scrkbase.sty')
-rw-r--r--Master/texmf-dist/tex/latex/koma-script/scrkbase.sty313
1 files changed, 215 insertions, 98 deletions
diff --git a/Master/texmf-dist/tex/latex/koma-script/scrkbase.sty b/Master/texmf-dist/tex/latex/koma-script/scrkbase.sty
index 5ee1baa8120..84b9cb5280e 100644
--- a/Master/texmf-dist/tex/latex/koma-script/scrkbase.sty
+++ b/Master/texmf-dist/tex/latex/koma-script/scrkbase.sty
@@ -62,23 +62,15 @@
\fi
}
\fi
- \@CheckKOMAScriptVersion{2007/03/07 v2.97a KOMA-Script}%
+ \@CheckKOMAScriptVersion{2007/09/28 v2.97c KOMA-Script}%
\endgroup
%%% From File: scrkbase.dtx
\ProvidesPackage{scrkbase}[%
\KOMAScriptVersion\space package (basics and keyval use)]
\RequirePackage{keyval}
\begingroup\expandafter\expandafter\expandafter\endgroup
-\expandafter\ifx\csname ifcsname\endcsname
- \newcommand{\scr@ifundefined}[1]{%
- \ifcsname #1\endcsname
- \expandafter\@secondoftwo
- \else
- \expandafter\@firstoftwo
- \fi
- }
-\else
- \newcommand{\scr@ifundefined}[1]{%
+\expandafter\ifx\csname ifcsname\endcsname\relax
+ \newcommand{\scr@ifundefinedorrelax}[1]{%
\begingroup\expandafter\expandafter\expandafter\endgroup
\expandafter\ifx\csname #1\endcsname\relax
\expandafter\@firstoftwo
@@ -86,51 +78,109 @@
\expandafter\@secondoftwo
\fi
}
+\else
+ \newcommand{\scr@ifundefinedorrelax}[1]{%
+ \ifcsname #1\endcsname
+ \expandafter\ifx\csname #1\endcsname\relax
+ \expandafter\expandafter\expandafter\@firstoftwo
+ \else
+ \expandafter\expandafter\expandafter\@secondoftwo
+ \fi
+ \else
+ \expandafter\@firstoftwo
+ \fi
+ }
\fi
-\newcommand*{\DeclareKeyValOption}[2][%
- \ifx\@currext\@clsextension\OptionNotUsed\else\@unkownoptionerror\fi
-]{%
- \DeclareOption*{%
- \def\@tempa##1=##2=##3\@nil{%
- \scr@ifundefined{KV@#2@##1}{#1}{%
- \@expandtwoargs\setkeys{#2}\CurrentOption
+\newcommand*{\KOMA@key}[1][.\@currname.\@currext]{%
+ \edef\reserved@a{\noexpand\in@{KOMA#1,}{\KOMA@key@familylist}}\reserved@a
+ \ifin@\else\xdef\KOMA@key@familylist{\KOMA@key@familylist KOMA#1,}\fi
+ \define@key{KOMA#1}%
+}
+\newcommand*{\KOMA@key@familylist}{}
+\newcommand*{\@globaloptionslist}{}
+\let\@globaloptionslist\@classoptionslist
+\scr@ifundefinedorrelax{XKV@classoptionslist}{}{%
+ \ifx\XKV@classoptionslist\@empty\else
+ \let\@globaloptionslist\XKV@classoptionslist
+ \fi
+}
+\newcommand*{\KOMAProcessOptions}[1][KOMA]{%
+ \let\ds@\@empty
+ \edef\@curroptions{\@ptionlist{\@currname.\@currext}}%
+ \ifx\@currext\@clsextension\else
+ \@for\CurrentOption:=\@globaloptionslist\do{%
+ \ifx\CurrentOption\@empty\else
+ \@expandtwoargs\in@{,\CurrentOption,}{,\@declaredoptions,}%
+ \ifin@
+ \@use@ption
+ \expandafter\let\csname ds@\CurrentOption\endcsname\@empty
+ \else
+ \KOMA@optiontest{#1}\CurrentOption{}{%
+ \@use@ption
+ \@expandtwoargs\setkeys{#1}%
+ \CurrentOption
+ }%
+ \KOMA@optiontest{#1.\@currname.\@currext}\CurrentOption{}{%
+ \@use@ption
+ \@expandtwoargs\setkeys{#1.\@currname.\@currext}%
+ \CurrentOption
+ }%
+ \fi
+ \fi
+ }%
+ \fi
+ \@for\CurrentOption:=\@curroptions\do{%
+ \@use@ption
+ \scr@ifundefinedorrelax{ds@\CurrentOption}{%
+ \KOMA@optiontest{#1}\CurrentOption{%
+ \KOMA@optiontest{#1.\@currname.\@currext}\CurrentOption{%
+ \default@ds
+ }{%
+ \let\scr@sr@co\CurrentOption
+ \@expandtwoargs\setkeys{#1.\@currname.\@currext}%
+ \CurrentOption
+ \let\CurrentOption\scr@sr@co
+ }%
+ }{%
+ \@expandtwoargs\setkeys{#1}%
+ \CurrentOption
+ \KOMA@optiontest{#1.\@currname.\@currext}\CurrentOption{}{%
+ \@expandtwoargs\setkeys{#1.\@currname.\@currext}%
+ \CurrentOption
+ }%
}%
+ }{%
}%
- \expandafter\@tempa\CurrentOption==\@nil
}%
+ \@for\CurrentOption:=\@declaredoptions\do{%
+ \expandafter\let\csname ds@\CurrentOption\endcsname\relax}%
+ \let\CurrentOption\@empty
+ \let\@fileswith@pti@ns\@@fileswith@pti@ns
+ \AtEndOfPackage{\let\@unprocessedoptions\relax}%
}
-\newcommand*{\KOMA@key}{\define@key{KOMA}}
-\newcommand*{\dont@let@as@internal@defined}{/}
-\KOMA@key{internalonly}{%
- \begingroup
- \@expandtwoargs\in@{#1}\dont@let@as@internal@defined
- \expandafter\endgroup
- \ifin@\else\g@addto@macro\dont@let@as@internal@defined{#1/}\fi
+\@onlypreamble\KOMA@process@options
+\@onlypreamble\KOMAProcessOptions
+\newcommand*{\KOMA@optiontest}[2]{%
+ \edef\reserved@a{\noexpand\KOMA@pti@ntest{#1}#2=\noexpand\@nil}%
+ \reserved@a
}
-\DeclareKeyValOption{KOMA}
-\ProcessOptions\relax
-\newcommand*{\@globaloptionslist}{}
-\scr@ifundefined{XKV@classooptionslist}{%
- \let\@globaloptionslist\@classoptionslist
-}{%
- \let\@globaloptionslist\XKV@classoptionslist
+\newcommand*{\KOMA@pti@ntest}{}
+\def\KOMA@pti@ntest#1#2=#3\@nil{\scr@ifundefinedorrelax{KV@#1@#2}}
+\newcommand*{\scr@sr@co}{}
+\newcommand*{\dont@let@as@internal@defined}{/}
+\newif\if@let@as@internalonly@defined\@let@as@internalonly@definedfalse
+\KOMA@key{internalonly}[\relax]{%
+ \ifx\relax#1\relax
+ \@let@as@internalonly@definedtrue
+ \else
+ \@let@as@internalonly@definedfalse
+ \begingroup
+ \@expandtwoargs\in@{#1}\dont@let@as@internal@defined
+ \expandafter\endgroup
+ \ifin@\else\g@addto@macro\dont@let@as@internal@defined{#1/}\fi
+ \fi
}
-\@expandtwoargs\in@{,internalonly=}{,\@globaloptionslist}
-\ifin@
- \begingroup
- \catcode`\=12\catcode`\:=12
- \def\@do@internalonly #1internalonly=#2\@nil{%
- \ifx\relax#1\relax\setkeys{KOMA}{internalonly=#2}\fi
- \@expandtwoargs\@removeelement{internalonly=#2}\@unusedoptionlist
- \@unusedoptionlist
- }%
- \expandafter\@for\expandafter\@tempa\expandafter:\expandafter=%
- \@globaloptionslist\do{%
- \expandafter\@do@internalonly\@tempa\@nil
- }%
- \global\let\@unusedoptionlist\@unusedoptionlist
- \endgroup
-\fi
+\KOMAProcessOptions\relax
%%% From File: scrlfile.dtx
\def\scrlfileversion{2007/03/07 v2.97a}
\edef\@tempa{\noexpand\RequirePackage{scrlfile}[\scrlfileversion]}
@@ -142,7 +192,11 @@
\@onlypreamble\@atdocumentfalse
\newcommand*{\let@as@internal@defined}[1]{%
\begingroup
- \@expandtwoargs\in@{/#1/}\dont@let@as@internal@defined
+ \if@let@as@internalonly@defined
+ \in@true
+ \else
+ \@expandtwoargs\in@{/#1/}\dont@let@as@internal@defined
+ \fi
\expandafter\endgroup
\ifin@
\PackageInfo{%
@@ -192,8 +246,8 @@
}%
\fi
}
-\let@as@internal@defined{ifundefined}
-\scr@ifundefined{ifcsname}{%
+\let@as@internal@defined{ifundefinedorrelax}
+\scr@ifundefinedorrelax{ifcsname}{%
\newcommand{\ifnotundefined}[1]{%
\begingroup\expandafter\expandafter\expandafter\endgroup
\expandafter\ifx\csname #1\endcsname\relax
@@ -307,11 +361,11 @@
\let@as@internal@defined{ifpdftex}
\BeforePackage{pdfcprot}{\let\ifpdftex\relax}
\AfterPackage{pdfcprot}{\let@as@internal@defined{ifpdftex}}
-\newcommand{\scr@ifvtex}{\ifnotundefined{VTeXversion}}
-\let@as@internal@defined{ifvtex}
+\newcommand{\scr@ifVTeX}{\ifnotundefined{VTeXversion}}
+\let@as@internal@defined{ifVTeX}
\newcommand{\scr@ifpdfoutput}{%
- \scr@ifundefined{pdfoutput}{%
- \scr@ifundefined{OpMode}{%
+ \scr@ifundefinedorrelax{pdfoutput}{%
+ \scr@ifundefinedorrelax{OpMode}{%
\expandafter\@secondoftwo%
}{%
\ifnum\OpMode=1
@@ -350,8 +404,8 @@
}
\let@as@internal@defined{ifpsoutput}
\newcommand*{\scr@ifdvioutput}{%
- \scr@ifundefined{pdfoutput}{%
- \scr@ifundefined{OpMode}{%
+ \scr@ifundefinedorrelax{pdfoutput}{%
+ \scr@ifundefinedorrelax{OpMode}{%
\expandafter\@firstoftwo
}{%
\ifnum\OpMode=0
@@ -369,11 +423,80 @@
}%
}
\let@as@internal@defined{ifdvioutput}
+\newcommand*{\scr@smashdp}[1]{%
+ \begingroup
+ \def\finsm@sh{\dp\z@\z@\box\z@}%
+ \smash{#1}%
+ \endgroup
+}
+\newcommand*{\KOMAExecuteOptions}[2][KOMA]{%
+ \def\reserved@a##1\@nil{%
+ \@for\KOMA@key@atlist:=#2\do{%
+ \expandafter\KOMA@key@split@name@value\KOMA@key@atlist==\@nil
+ \scr@ifundefinedorrelax{KV@#1@\KOMA@key@name}{}{%
+ \edef\reserved@a{\noexpand\setkeys{#1}{\KOMA@key@atlist}%
+ }%
+ \reserved@a
+ }%
+ \scr@ifundefinedorrelax{KV@#1.\@currname.\@currext @\KOMA@key@name}{}{%
+ \edef\reserved@a{%
+ \noexpand\setkeys{#1.\@currname.\@currext}{\KOMA@key@atlist}%
+ }%
+ \reserved@a
+ }%
+ \let\CurrentOption\KOMA@key@atlist
+ \csname ds@\CurrentOption\endcsname
+ }%
+ \edef\CurrentOption{##1}%
+ }%
+ \expandafter\reserved@a\CurrentOption\@nil
+}
+\@onlypreamble\KOMAExecuteOptions
\newcommand*{\KOMAoptions}[1]{%
\let\post@kopt@hook\@empty
- \setkeys{KOMA}{#1}%
+ \KOMA@options{#1}{%
+ \PackageError{scrkbase}{%
+ unknown KOMA option `\KOMA@key@name'%
+ }{%
+ You have used \string\KOMAoptions\space to set
+ `\KOMA@key@atlist',\MessageBreak
+ but KOMA-Script does not know any option named
+ `\KOMA@key@name'.\MessageBreak
+ See the KOMA-Script manual for more informations about options
+ and\MessageBreak
+ their values.%
+ }%
+ }%
\post@kopt@hook\let\post@kopt@hook\relax
}
+\newcommand*{\KOMA@options}[2]{%
+ \@for\KOMA@key@atlist:=#1\do{%
+ \expandafter\KOMA@key@split@name@value\KOMA@key@atlist==\@nil
+ \KOMA@key@found@false
+ \@for\@tempa:=\KOMA@key@familylist\do{%
+ \scr@ifundefinedorrelax{KV@\@tempa @\KOMA@key@name}{}{%
+ \KOMA@key@found@true
+ \edef\reserved@a{\noexpand\setkeys{\@tempa}{\KOMA@key@atlist}%
+ \noexpand\edef\noexpand\@tempa{\@tempa}%
+ \noexpand\edef\noexpand\KOMA@key@atlist{\KOMA@key@atlist}%
+ \noexpand\edef\noexpand\KOMA@key@name{\KOMA@key@name}%
+ \noexpand\edef\noexpand\KOMA@key@value{\KOMA@key@value}%
+ }%
+ \reserved@a
+ }%
+ }%
+ \ifKOMA@key@found@\else#2\fi
+ }%
+}
+\newif\ifKOMA@key@found@
+\newcommand*{\KOMA@key@atlist}{}
+\newcommand*{\KOMA@key@name}{}
+\newcommand*{\KOMA@key@value}{}
+\newcommand*{\KOMA@key@split@name@value}{}
+\def\KOMA@key@split@name@value#1=#2=#3\@nil{%
+ \def\KOMA@key@name{#1}%
+ \def\KOMA@key@value{#2}%
+}
\newcommand*{\post@kopt@hook}{}
\let\post@kopt@hook\relax
\newcommand*{\AfterKOMAoptions}{%
@@ -389,33 +512,20 @@
\fi
\post@kopt@hook
}
-\KOMA@key{nokey}{%
- \PackageError{%
- scrkeyval%
- }{%
- unknown KOMA option `#1'%
- }{%
- You've tried to use the KOMA option `#1'.\MessageBreak
- But there is no KOMA option with that name.\MessageBreak
- See the manual of KOMA-Script for information about known KOMA
- options.%
+\scr@ifundefinedorrelax{unexpanded}{%
+ \newcommand*{\g@addto@macro@temp}{}%
+ \newcommand{\l@addto@macro}[2]{%
+ \begingroup%
+ \toks@\expandafter{#1#2}%
+ \xdef\g@addto@macro@temp{\the\toks@}%
+ \endgroup
+ \let#1\g@addto@macro@temp
}%
-}%
-\KOMA@key{noval}{%
- \PackageError{%
- scrkbase%
- }{%
- KOMA option `#1' needs a value%
- }{%
- You've tried to use the KOMA option `#1' without a
- value.\MessageBreak
- But this option has no default value, so you have to set a
- value.\MessageBreak
- See the manual of KOMA-Script for information about the option and
- all known\MessageBreak
- values.%
+}{%
+ \newcommand{\l@addto@macro}[2]{%
+ \edef#1{\unexpanded\expandafter{#1#2}}%
}%
-}%
+}
\newcommand*{\KOMA@unknown@keyval}[3]{%
\PackageError{%
scrkbase%
@@ -492,26 +602,33 @@
\fi
\@tempa
}
-\newcommand*{\scr@sr@co}{}
\newcommand*{\KOMA@DeclareObsoleteOption}[3][\@gobbletwo]{%
- \DeclareOption{#2}{%
- \let\scr@sr@co\CurrentOption
- \KOMA@UseObsolete{option}{#1}{#2}{#3}%
- \let\CurrentOption\scr@sr@co
+ \DeclareOption{#2}{\KOMA@UseObsoleteOption{#1}{#2}{#3}}%
+}
+\newcommand*{\KOMA@UseObsoleteOption}[3]{%
+ \let\scr@sr@co\CurrentOption
+ #1{scrkbase}{%
+ You've used obsolete option `#2'.\MessageBreak
+ \protect\KOMAExecuteOptions{#3} will be\MessageBreak
+ used instead.\MessageBreak
+ You may simply replace `#2'\MessageBreak
+ by `#3'%
}%
+ \KOMAExecuteOptions{#3}%
+ \let\CurrentOption\scr@sr@co
+}
+\newcommand*{\KOMA@newobsoletecommand}[3][\@gobbletwo]{%
+ \newcommand*{#2}{\KOMA@UseObsoleteCommand{#1}{\string#2}{#3}}%
}
-\newcommand*{\KOMA@UseObsolete}[4]{%
- #2{%
+\newcommand*{\KOMA@UseObsoleteCommand}[3]{%
+ #1{%
scrkbase%
}{%
- You've used the obsolete #1 `#3'.\MessageBreak
- \protect\KOMAoptions{#4} will be used instead.\MessageBreak
- You should do this change too%
+ You've used the obsolete command `#2'.\MessageBreak
+ \protect\KOMAoptions{#3} will be used instead.\MessageBreak
+ You should also replace `#2' by `\protect\KOMAoptions{#3}'%
}%
- \KOMAoptions{#4}%
-}
-\newcommand*{\KOMA@newobsoletecommand}[3][\@gobbletwo]{%
- \newcommand*{#2}{\KOMA@UseObsolete{command}{#1}{\string#2}{#3}}%
+ \KOMAoptions{#3}%
}
%%% From File: scrlogo.dtx
\@ifundefined{KOMAScript}{%