diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex/tudscr/tudscrbase.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/tudscr/tudscrbase.sty | 395 |
1 files changed, 290 insertions, 105 deletions
diff --git a/Master/texmf-dist/tex/latex/tudscr/tudscrbase.sty b/Master/texmf-dist/tex/latex/tudscr/tudscrbase.sty index bcc3cf21e2b..a14fad5a2bd 100644 --- a/Master/texmf-dist/tex/latex/tudscr/tudscrbase.sty +++ b/Master/texmf-dist/tex/latex/tudscr/tudscrbase.sty @@ -4,8 +4,8 @@ %% %% The original source files were: %% -%% tudscr-version.dtx (with options: `package') -%% tudscr-base.dtx (with options: `package') +%% tudscr-version.dtx (with options: `package,base') +%% tudscr-base.dtx (with options: `package,base') %% %% ============================================================================ %% @@ -35,44 +35,82 @@ %% ============================================================================ %% %%% From File: tudscr-version.dtx -\begingroup% - \catcode`\@11\relax% - \ifx\TUDVersion\undefined% - \newcommand*\@TUDVersion[1]{\gdef\TUDVersion{#1}}% - \else% - \newcommand*\@TUDVersion[1]{% +\begingroup + \catcode`\@11\relax + \ifx\TUD@Version\undefined + \newcommand*\TUD@Version@Check[1]{% + \gdef\TUD@Version{#1}% + \gdef\TUDScriptVersion{#1}% + \def\@tempb##1 v##2 ##3\relax##4\relax{\gdef\TUDScriptVersionNumber{##2}}% + \edef\@tempa{\TUD@Version}% + \expandafter\@tempb\@tempa\relax? ? \relax\relax% + \gdef\TUD@Version@KOMA{3.17}% + } + \else + \newcommand*\TUD@Version@Check[1]{% \def\@tempa{#1}% - \ifx\TUDVersion\@tempa\else% + \ifx\TUD@Version\@tempa\else% \@latex@warning@no@line{% - \noexpand\TUDVersion\space is `\TUDVersion',\MessageBreak% + \noexpand\TUD@Version\space is `\TUD@Version',\MessageBreak% but `#1' was expected!\MessageBreak% You should not use classes, packages or files from\MessageBreak% different TUD-KOMA-Script-Bundle versions% }% \fi% - }% - \fi% - \@TUDVersion{2016/06/17 v2.04e TUD-KOMA-Script}% -\endgroup% + } + \fi + \TUD@Version@Check{2016/07/26 v2.05 TUD-KOMA-Script} +\endgroup +\NeedsTeXFormat{LaTeX2e} \providecommand*\tudscrmail{tudscr@gmail.com} \@ifundefined{TUDScript}{% - \DeclareRobustCommand{\TUDScript}{% + \DeclareRobustCommand\TUDScript{% \ifdin{TUD-KOMA-SCRIPT}{% \textsf{T\kern.05em U\kern.05em D\kern.1em-\kern.1em}\KOMAScript% }\csname xspace\endcsname% }% }{} %%% From File: tudscr-base.dtx -\NeedsTeXFormat{LaTeX2e} \ProvidesPackage{tudscrbase}[% - 2016/06/17 v2.04e TUD-KOMA-Script + 2016/07/26 v2.05 TUD-KOMA-Script package (basics for the bundle)% ] \RequirePackage{scrbase}[2013/12/19] -\RequirePackage{kvsetkeys}[2012/04/25] +\@ifpackagelater{scrbase}{2016/05/11}{}{% + \renewcommand*\test@@ifdimunt[1]{% + \@tempswafalse + \ifstr{#1}{pt}{\@tempswatrue}{% + \ifstr{#1}{pc}{\@tempswatrue}{% + \ifstr{#1}{in}{\@tempswatrue}{% + \ifstr{#1}{bp}{\@tempswatrue}{% + \ifstr{#1}{cm}{\@tempswatrue}{% + \ifstr{#1}{mm}{\@tempswatrue}{% + \ifstr{#1}{dd}{\@tempswatrue}{% + \ifstr{#1}{cc}{\@tempswatrue}{% + \ifstr{#1}{sp}{\@tempswatrue}{% + \ifstr{#1}{ex}{\@tempswatrue}{% + \ifstr{#1}{em}{\@tempswatrue}{% + \scr@ifpdfoutput{% + \ifstr{#1}{px}{\@tempswatrue}{}% + }{}% + }% + }% + }% + }% + }% + }% + }% + }% + }% + }% + }% + }% +} \RequirePackage{etoolbox}[2011/01/03] -\newcommand*\ifxblank{\expandafter\ifblank\expandafter} +\RequirePackage{etexcmds}[2011/02/16] +\RequirePackage{kvsetkeys}[2012/04/25] +\newcommand*\ifxblank{\ifstr{}} \newcommand*\ifxnumber[1]{% \if\relax\detokenize\expandafter{\romannumeral-0#1}\relax% \expandafter\@firstoftwo% @@ -95,6 +133,40 @@ }% }% } +\newcommand*\ifxlen[1]{% + \begingroup% + \protected@edef\@tempa{#1}% + \@tempswafalse% + \expandafter\ifisdimen\expandafter{\@tempa}{\@tempswatrue}{}% + \expandafter\ifisskip\expandafter{\@tempa}{\@tempswatrue}{}% + \expandafter\ifisdimexpr\expandafter{\@tempa}{\@tempswatrue}{}% + \if@tempswa\edef\@tempa{\the\@tempa}\fi% + \expandafter\ifdimen\expandafter{\@tempa}{% + \aftergroup\@firstoftwo% + }{% + \aftergroup\@secondoftwo% + }% + \endgroup +} +\newcommand*\iflanguageloaded[1]{% + \PackageWarning{tudscrbase}{% + Whether package `babel' nor package `polyglossia' has been loaded% + }% + \expandafter\@secondoftwo% +} +\AfterPackage*{babel}{% + \renewcommand*\iflanguageloaded[1]{% + \@expandtwoargs\in@{,#1,}{,\bbl@loaded,}% + \ifin@% + \expandafter\@firstoftwo% + \else% + \expandafter\@secondoftwo% + \fi% + }% +} +\AfterPackage*{polyglossia}{% + \renewcommand*\iflanguageloaded[1]{\ifcsdef{#1@loaded}}% +} \providecommand*\protected@expandtwoargs[3]{% \protected@edef\reserved@a{\noexpand#1{#2}{#3}}\reserved@a% } @@ -132,25 +204,47 @@ \expandafter\def\expandafter #1\expandafter{#1}% }% } +\newcommand*\tud@reserved{} +\newtoks\tud@toks@ +\newcommand*\eaddto@hook[2]{% + \expandafter\addto@hook\expandafter#1\expandafter{#2}% +} +\newcommand*\tud@replace[3]{% + \begingroup% + \toks@{\def\@tempa##1}% + \eaddto@hook\toks@{\detokenize{#2}}% + \addto@hook\toks@{##2\@nil{\@tempb{##1}{##2}}}% + \the\toks@% + \def\@tempb##1##2{% + \IfArgIsEmpty{##2}{% + \appto#1{##1}% + \let\@tempc\relax% + }{% + \appto#1{##1#3}% + \def\@tempc{\@tempa##2\@nil}% + }% + \@tempc% + }% + \toks@{\@tempa}% + \edef\@tempc{\expandafter\detokenize\expandafter{#1}}% + \eaddto@hook\toks@{\@tempc}% + \eaddto@hook\toks@{\detokenize{#2}\@nil}% + \def#1{}% + \the\toks@% + \edef\tud@reserved{% + \noexpand\endgroup% + \def\noexpand#1{#1}% + }% + \tud@reserved% +} \DefineFamily{TUD} \newcommand*\TUDProcessOptions{\FamilyProcessOptions{TUD}} \newcommand*\TUDExecuteOptions{\FamilyExecuteOptions{TUD}} \newcommand*\TUDoptions{\FamilyOptions{TUD}} \newcommand*\TUDoption{\FamilyOption{TUD}} -\newcommand*\TUD@noworlater{\AtEndOfClass} -\AtEndOfClass{\let\TUD@noworlater\@firstofone} -\newcommand*\TUD@key[2][.\@currname.\@currext]{% +\newcommand*\TUD@key[1][.\@currname.\@currext]{% \DefineFamilyMember{TUD}% - \kernel@ifnextchar[%] - {\TUD@@key[#1]{#2}}{\TUD@@@key[#1]{#2}}% -} -\newcommand*\TUD@@key{} -\def\TUD@@key[#1]#2[#3]#4{% - \DefineFamilyKey[#1]{TUD}{#2}[{#3}]{\TUD@noworlater{#4}}% -} -\newcommand*\TUD@@@key{} -\def\TUD@@@key[#1]#2#3{% - \DefineFamilyKey[#1]{TUD}{#2}{\TUD@noworlater{#3}}% + \DefineFamilyKey[#1]{TUD}% } \newcommand*\TUD@ifkey[1][.\@currname.\@currext]{% \DefineFamilyMember{TUD}% @@ -170,14 +264,22 @@ \FamilyLengthKey[#1]{TUD}% } \newcommand*\TUD@set@lengthkey{\FamilySetLength{TUD}} +\newcommand*\TUD@set@dimenkey[3]{% + \ifxlen{#3}{% + \def#2{#3}% + \FamilyKeyStateProcessed% + }{% + \TUD@unknown@keyval{#1}{#3}{dimens}% + }% +} \newcommand*\TUD@unknown@keyval{\FamilyUnknownKeyValue{TUD}} \newcommand*\TUD@key@lock[2][.\@currname.\@currext]{% \newbool{@tud@#2@locked}% \TUD@key[{#1}]{#2}% } -\newcommand*\TUD@std@ifkey@lock[2]{% +\newcommand*\TUD@std@ifkey@lock[3]{% \ifbool{@tud@#1@locked}{}{% - \TUDoption{#1}{#2}% + \TUD@set@ifkey{#1}{#2}{#3}% \boolfalse{@tud@#1@locked}% }% } @@ -204,19 +306,30 @@ \csdef{#1}{#2}% \booltrue{#1@locked}% } +\newcommand*\tud@setbool[2]{% + \ifstrbool{#2}{\booltrue{#1}}{\boolfalse{#1}}{% + \PackageError{tudscrbase}{% + `#2' is not a valid boolean expression% + }{% + You tried to set the boolean switch `\@backslashchar if#1'\MessageBreak% + to value `#2' but only `true' `on' and `yes' as well as \MessageBreak% + `false' `no' and `off' are valid values.% + }% + }% +} \newcommand*\bool@lock[2][false]{% \newbool{#2}% \newbool{#2@locked}% - \setbool{#2}{#1}% + \tud@setbool{#2}{#1}% } \newcommand*\bool@std@lock[2]{% \ifbool{#1@locked}{}{% - \setbool{#1}{#2}% + \tud@setbool{#1}{#2}% \boolfalse{#1@locked}% }% } \newcommand*\bool@set@lock[2]{% - \setbool{#1}{#2}% + \tud@setbool{#1}{#2}% \booltrue{#1@locked}% } \newcommand*\tud@cmd@store[1]{% @@ -241,119 +354,179 @@ \newcommand*\tud@cmd@use[1]{% \tud@cmd@check{#1}% \ifcsdef{@@tud@#1}{% - \@nameuse{@@tud@#1}% + \csuse{@@tud@#1}% }{% - \@nameuse{#1}% + \csuse{#1}% }% } \newcommand*\tud@cmd@check[1]{% \ifcsdef{#1}{}{% - \PackageError{tudscrbase}{% - `\@backslashchar#1' is not defined% - }{% - The command `\@backslashchar#1' was never defined.\MessageBreak% + \PackageError{% + tudscrbase% + }{`\@backslashchar#1' is not defined}{% + The command `\@backslashchar#1' was never defined\MessageBreak% Please contact the TUD-KOMA-Script maintainer\MessageBreak% via \tudscrmail. A bugfix is urgently required.% }% }% } \newcommand*\tud@skip@store[1]{% - \ifcsdef{@@tud@skip@#1}{}{% - \@tempswafalse% - \ifisskip{\csname #1\endcsname}{\@tempswatrue}{}% - \ifisdimen{\csname #1\endcsname}{\@tempswatrue}{}% - \if@tempswa% + \tud@skip@check{#1}{% + \ifcsdef{@@tud@skip@#1}{}{% \csedef{@@tud@skip@#1}{\expandafter\the\csname #1\endcsname}% - \fi% + }% }% } \newcommand*\tud@skip@restore[1]{% - \ifcsdef{@@tud@skip@#1}{% - \csname #1\endcsname=\csname @@tud@skip@#1\endcsname% - \csundef{@@tud@skip@#1}% - }{}% + \tud@skip@check{#1}{% + \ifcsdef{@@tud@skip@#1}{% + \csname #1\endcsname=\csname @@tud@skip@#1\endcsname% + \csundef{@@tud@skip@#1}% + }{}% + }% +} +\newcommand*\tud@skip@reset[1]{% + \tud@skip@check{#1}{% + \ifcsdef{@@tud@skip@#1}{% + \csname#1\endcsname=\csname @@tud@skip@#1\endcsname% + }{}% + }% } \newcommand*\tud@skip@set[2]{% - \ifdef{#1}{% + \tud@skip@check{#1}{% + \expandafter\setlength\csname #1\endcsname{#2}% + }% +} +\newcommand*\tud@skip@check[1]{% + \begingroup% \@tempswafalse% - \ifisskip{#1}{\@tempswatrue}{}% - \ifisdimen{#1}{\@tempswatrue}{}% + \expandafter\ifisskip\expandafter{\csname#1\endcsname}{\@tempswatrue}{}% + \expandafter\ifisdimen\expandafter{\csname#1\endcsname}{\@tempswatrue}{}% \if@tempswa% - \setlength#1{#2}% + \aftergroup\@firstofone% + \else% + \aftergroup\@gobble% \fi% - }{}% + \endgroup% } \newcommand*\tud@patch@wrn[1]{% \PackageWarning{tudscrbase}{% - It wasn't possible to patch `\@backslashchar#1'.\MessageBreak% + It wasn't possible to patch `\@backslashchar#1'\MessageBreak% Please contact the TUD-KOMA-Script maintainer\MessageBreak% via \tudscrmail. Without a bugfix an\MessageBreak% erroneous output may occur% }% } -\newcommand*\TUD@parameter@family{}% -\newcommand*\TUD@parameter[2]{% - \ifxblank{#1}{}{\xdef\TUD@parameter@family{#1}}% +\newcommand*\TUD@parameter@@family{} +\newcommand*\TUD@parameter@family[2]{% + \xdef\TUD@parameter@@family{#1}% #2% - \global\let\TUD@parameter@family\relax% + \gdef\TUD@parameter@@family{}% } -\let\TUD@parameter@family\relax% -\newcommand*\TUD@parameter@checkfamily[1]{% - \ifx\TUD@parameter@family\relax% +\newcommand*\TUD@parameter@checkfamily[2]{% + \ifxblank{#1}{% \PackageError{tudscrbase}{% - No family for keys given% + No family for \@backslashchar#2 defined% }{% - You have to use \string#1\space within the\MessageBreak% - second argument of \string\TUD@parameter. The first \MessageBreak% - argument of \string\TUD@parameter\space has to be a unique family name.% + You have to use \@backslashchar#2\space within the\MessageBreak% + second argument of \string\TUD@parameter@family. The first\MessageBreak% + argument of \string\TUD@parameter@family\space has to be\MessageBreak% + a unique family name. Alternatively, you can specify\MessageBreak% + the family name within the optional argument of\MessageBreak% + \@backslashchar#2. }% - \fi% + }{}% } -\newcommand*\TUD@parameter@define[1][]{% - \ifxblank{#1}{% - \TUD@parameter@checkfamily{\TUD@parameter@define}% - \expandafter\define@key\expandafter{\TUD@parameter@family}% - }{% - \expandafter\define@key\expandafter{#1}% +\newcommand*\TUD@parameter@def[1][\TUD@parameter@@family]{% + \TUD@parameter@checkfamily{#1}{TUD@parameter@def}% + \expandafter\define@key\expandafter{#1}% +} +\newcommand*\TUD@parameter@let[3][\TUD@parameter@@family]{% + \TUD@parameter@checkfamily{#1}{TUD@parameter@let}% + \@expandtwoargs{\csletcs}{KV@#1@#2}{KV@#1@#3}% + \@expandtwoargs{\csletcs}{KV@#1@#2@default}{KV@#1@#3@default}% +} +\newcommand*\TUD@parameter@nokey{@nokey@} +\newcommand*\TUD@parameter@set[2]{% + \def\@tempb{}% + \def\@tempa##1{% + \@expandtwoargs\in@{=}{##1}% + \ifin@% + \appto\@tempb{##1,}% + \else% + \begingroup + \let\IeC\@firstofone% + \def\"####1{####1e}% + \def\ss{ss}% + \protected@edef\tud@reserved{% + \endgroup% + \noexpand\protected@edef\noexpand\@tempc{KV@#1@##1}% + }% + \tud@reserved% + \ifcsdef{\@tempc}{% + \appto\@tempb{##1,}% + }{% + \protected@eappto\@tempb{\TUD@parameter@nokey=##1,}% + }% + \fi% }% + \forcsvlist\@tempa{#2}% + \@expandtwoargs\kvsetkeys{#1}{\@tempb}% } -\newcommand*\TUD@parameter@let[3][]{% - \ifxblank{#1}{% - \TUD@parameter@checkfamily{\TUD@parameter@let}% - \@expandtwoargs{\csletcs}{% - KV@\TUD@parameter@family @#2% - }{% - KV@\TUD@parameter@family @#3% - }% - \@expandtwoargs{\csletcs}{% - KV@\TUD@parameter@family @#2@default% - }{% - KV@\TUD@parameter@family @#3@default% - }% - }{% - \@expandtwoargs{\csletcs}{KV@#1@#2}{KV@#1@#3}% - \@expandtwoargs{\csletcs}{KV@#1@#2@default}{KV@#1@#3@default}% +\newcommand*\TUD@parameter@handler@macro[3][\TUD@parameter@@family]{% + \TUD@parameter@checkfamily{#1}{TUD@parameter@handler@macro}% + \expandafter\kv@set@family@handler\expandafter{#1}{% + \ifstr{\kv@key}{\TUD@parameter@nokey}{#3}{#2}% }% } -\newcommand*\TUD@parameter@sethandler[1][]{% - \ifxblank{#1}{% - \TUD@parameter@checkfamily{\TUD@parameter@sethandler}% - \expandafter\kv@set@family@handler\expandafter{\TUD@parameter@family}% +\newcommand*\TUD@parameter@handler@value[2][\TUD@parameter@@family]{% + \TUD@parameter@checkfamily{#1}{TUD@parameter@handler@value}% + \protected@edef\@tempa{% + \noexpand\TUD@parameter@set{#1}{#2=\noexpand\kv@value}% + }% + \def\@tempb{\TUD@parameter@handler@macro[#1]{\kv@handled@false}}% + \expandafter\@tempb\expandafter{\@tempa}% +} +\newcommand*\TUD@parameter@handler@default[2][\TUD@parameter@@family]{% + \TUD@parameter@checkfamily{#1}{TUD@parameter@handler@default}% + \ifxblank{#2}{% + \def\@tempa{\let\tud@reserved\relax}% }{% - \expandafter\kv@set@family@handler\expandafter{#1}% + \def\@tempa{\def\tud@reserved{#2=\kv@value}}% + }% + \appto\@tempa{% + \ifstr{\kv@value}{twocolumn}{\def\kv@value{2}}{}% + \ifxnumber{\kv@value}{\def\tud@reserved{columns=\kv@value}}{}% + \iflanguageloaded{\kv@value}{\def\tud@reserved{language=\kv@value}}{}% + \ifx\tud@reserved\relax% + \PackageError{tudscrbase}{% + Unknown default value `\kv@value'% + }{% + If `\kv@value' is a language, you haven't loaded it.\MessageBreak% + Otherwise, there's no handler for the given value.\MessageBreak% + You should specify a certian key (<key>=\kv@value). + }% + \fi% + }% + \protected@eappto\@tempa{% + \noexpand\ifx\noexpand\tud@reserved\noexpand\relax\noexpand\else% + \noexpand\TUD@parameter@set{#1}{\noexpand\tud@reserved}% + \noexpand\fi% }% + \def\@tempb{\TUD@parameter@handler@macro[#1]{\kv@handled@false}}% + \expandafter\@tempb\expandafter{\@tempa}% } -\newcommand*\TUD@parameter@set[2]{\@expandtwoargs\kvsetkeys{#1}{#2}} \newcommand*\TUD@parameter@error[2]{% \PackageError{tudscrbase}{Unsupported value for parameter `#1'}{% `#1' can only be used with values:\MessageBreak#2% }% } -\newcommand*\TUD@AfterPackage@Set[1]{% +\newcommand*\TUD@UnwindPackage[2]{\AtEndPreamble{\@ifpackageloaded{#1}{}{#2}}} +\newcommand*\TUD@AfterPackage@set[1]{% \newbool{@tud@#1@loaded}% - \AfterPackage!{#1}{\booltrue{@tud@#1@loaded}} + \AfterPackage!{#1}{\booltrue{@tud@#1@loaded}}% } -\newcommand*\TUD@AfterPackage[2]{% +\newcommand*\TUD@AfterPackage@do[2]{% \ifcsdef{if@tud@#1@loaded}{% \if@atdocument% \ifbool{@tud@#1@loaded}{#2}{}% @@ -361,13 +534,25 @@ \AfterPackage!{#1}{#2}% \fi% }{% - \PackageError{tudscrbase}{\string\TUD@AfterPackage@Set{#1} missing}{% - You have to set \string\TUD@AfterPackage@Set{#1} before\MessageBreak% - the usage of \string\TUD@AfterPackage{#1}{<code>} is\MessageBreak% + \PackageError{tudscrbase}{\string\TUD@AfterPackage@set{#1} missing}{% + You have to set \string\TUD@AfterPackage@set{#1} before\MessageBreak% + the usage of \string\TUD@AfterPackage@do{#1}{<code>} is\MessageBreak% possible.% }% }% } +\newcommand*\TUD@KOMAoptions[1]{} +\ifdef{\KOMAClassName}{% + \let\TUD@KOMAoptions\KOMAoptions +}{% + \renewcommand*\TUD@KOMAoptions[1]{% + \PackageWarning{tudscrbase}{% + You should load package `scrextend' right after the\MessageBreak% + documentclass. Option \string\TUD@KOMAoptions{`#1'} is gobbled% + }% + }% + \AfterPackage*{scrextend}{\let\TUD@KOMAoptions\KOMAoptions} +} \endinput %% %% End of file `tudscrbase.sty'. |