From 9b219d1b664067729034647a4b37626cf2bf5e26 Mon Sep 17 00:00:00 2001
From: Karl Berry <karl@freefriends.org>
Date: Thu, 26 Dec 2013 23:18:36 +0000
Subject: koma-script (26dec13)

git-svn-id: svn://tug.org/texlive/trunk@32489 c570f23f-e606-0410-a88d-b1316a301751
---
 .../texmf-dist/tex/latex/koma-script/scrbase.sty   | 1490 +++++++++++++++-----
 1 file changed, 1144 insertions(+), 346 deletions(-)

(limited to 'Master/texmf-dist/tex/latex/koma-script/scrbase.sty')

diff --git a/Master/texmf-dist/tex/latex/koma-script/scrbase.sty b/Master/texmf-dist/tex/latex/koma-script/scrbase.sty
index 8bb79e32e5a..9755a4c3bc2 100644
--- a/Master/texmf-dist/tex/latex/koma-script/scrbase.sty
+++ b/Master/texmf-dist/tex/latex/koma-script/scrbase.sty
@@ -1,19 +1,18 @@
 %%
 %% This is file `scrbase.sty',
-%% generated with the docstrip utility.
+%% generated with the docstrip utility, extended by scrdocstrip.
 %%
 %% The original source files were:
 %%
-%% scrkvers.dtx  (with options: `package,scrbase')
-%% scrkbase.dtx  (with options: `package,option,base')
-%% scrklang.dtx  (with options: `package,option,base')
+%% scrkernel-version.dtx  (with options: `package,scrbase')
+%% scrkernel-basics.dtx  (with options: `package,option,base')
+%% scrkernel-language.dtx  (with options: `package,option,base')
 %% scrlfile.dtx  (with options: `load')
-%% scrkbase.dtx  (with options: `package,body,base')
-%% scrklang.dtx  (with options: `package,body,base')
+%% scrkernel-basics.dtx  (with options: `package,body,base')
+%% scrkernel-language.dtx  (with options: `package,body,base')
 %% scrlogo.dtx  (with options: `logo')
 %% 
-%% Copyright (c) 1994-2012
-%% Markus Kohm and any individual authors listed elsewhere in this file.
+%% Copyright (c) 2002-2013 Markus Kohm [komascript at gmx info]
 %% 
 %% This file was generated from file(s) of the KOMA-Script bundle.
 %% ---------------------------------------------------------------
@@ -45,9 +44,9 @@
 %% find a complete unmodified copy of LaTeX2e at
 %% <http://www.ctan.org/pub/tex-archive/macros/latex/base/>.
 %% 
-%%% From File: scrkvers.dtx
+%%% From File: $Id: scrkernel-version.dtx 1560 2013-12-19 07:13:30Z mjk $
 \begingroup
-  \makeatletter
+  \catcode`\@11\relax
   \ifx\KOMAScriptVersion\undefined
     \newcommand*{\@CheckKOMAScriptVersion}[1]{%
       \gdef\KOMAScriptVersion{#1}%
@@ -67,25 +66,28 @@
       \fi
     }
   \fi
-  \@CheckKOMAScriptVersion{2012/07/29 v3.11b KOMA-Script}%
+  \@CheckKOMAScriptVersion{2013/12/19 v3.12 KOMA-Script}%
 \endgroup
-%%% From File: scrkbase.dtx
+%%% From File: $Id: scrkernel-basics.dtx 1502 2013-11-06 11:00:12Z mjk $
+\NeedsTeXFormat{LaTeX2e}[1995/06/01]
 \ProvidesPackage{%
   scrbase%
 }[%
-  \KOMAScriptVersion\space package
-  (KOMA-Script-independent basics and keyval usage)]
+  2013/12/19 v3.12 KOMA-Script
+  package (%
+    KOMA-Script-independent
+ basics and keyval usage)]
 \begingroup
-  \def\@tempb{}%
-  \def\@tempa{%
-    \PackageError{scrbase}{seems you are not running e-TeX\@tempb}{%
+  \def\reserved@b{}%
+  \def\reserved@a#1{%
+    \PackageError{scrbase}{seems you are not running e-TeX#1}{%
       Since 2004 the LaTeX team recommends to use e-TeX.\MessageBreak
       KOMA-Script since version 2.95 uses several e-TeX features.\MessageBreak
       At actual systems `latex' should already use e-TeX.\MessageBreak
       At deprecated systems it may be called `elatex'.\MessageBreak
       Use either unsupported KOMA-Script up to version 2.9u or\MessageBreak
-      ask you administrator for LaTeX using e-TeX\@tempb.\MessageBreak
-      Not using e-TeX\@tempb\space is a fatal error!\MessageBreak
+      ask you administrator for LaTeX using e-TeX#1.\MessageBreak
+      Not using e-TeX#1 is a fatal error!\MessageBreak
       Processing cannot be continued!}%
     \endgroup
     \batchmode \errmessage{}\csname @@end\endcsname\end\relax
@@ -93,12 +95,12 @@
   }%
   \expandafter\ifx\csname eTeXversion\endcsname\relax\else
     \ifnum\eTeXversion <2
-      \def\@tempb{ V 2}%
+      \def\reserved@b{ V 2}%
     \else
-      \let\@tempa\endgroup
+      \let\reserved@a\endgroup
     \fi
   \fi
-\@tempa
+\expandafter\reserved@a\expandafter{\reserved@b}
 \RequirePackage{keyval}
 \newcommand{\scr@ifundefinedorrelax}[1]{%
   \ifcsname #1\endcsname
@@ -111,6 +113,9 @@
     \expandafter\@firstoftwo
   \fi
 }
+\newcommand*\PackageErrorNoLine[2]{%
+  \PackageError{#1}{#2\@gobble}%
+}
 \newcommand*{\DefineFamily}[1]{%
   \scr@ifundefinedorrelax{#1@key@familylist}{%
     \@namedef{#1@key@familylist}{}%
@@ -157,11 +162,59 @@
     \fi
   }%
 }
-\newcommand*{\DefineFamilyKey}[2][.\@currname.\@currext]{%
+\newcommand*{\DefineFamilyKey}[3][.\@currname.\@currext]{%
+  \@ifnextchar[%]
+  {%
+    \edef\reserved@a{#1}%
+    \expandafter\scr@define@family@key
+    \expandafter{\reserved@a}{#2}{#3}%
+  }{%
+    \edef\reserved@a{#1}%
+    \expandafter\scr@define@family@key@nodefault
+    \expandafter{\reserved@a}{#2}{#3}%
+  }%
+}
+\newcommand*{\scr@define@family@key}{}
+\def\scr@define@family@key#1#2#3[#4]#5{%
+  \scr@if@familymember{#1}{#2}{define a key}{%
+    \define@key{#2#1}{#3}[{#4}]{%
+      \def\FamilyOfKey{#2}\def\FamilyMemberOfKey{#1}%
+      \FamilyKeyStateUnknown
+      #5%
+      \def\FamilyOfKey{#2}\def\FamilyMemberOfKey{#1}%
+    }%
+  }%
+}
+\newcommand*{\scr@define@family@key@nodefault}[4]{%
   \scr@if@familymember{#1}{#2}{define a key}{%
-    \define@key{#2#1}%
+    \define@key{#2#1}{#3}{%
+      \def\FamilyOfKey{#2}\def\FamilyMemberOfKey{#1}%
+      \FamilyKeyStateUnknown
+      #4
+      \def\FamilyOfKey{#2}\def\FamilyMemberOfKey{#1}%
+    }%
+    \@namedef{KV@#2#1@#3@default}{%
+      \def\FamilyOfKey{#2}\def\FamilyMemberOfKey{#1}%
+      \FamilyKeyStateNeedValue
+    }%
   }%
 }
+\newcommand*{\FamilyKeyState}{}
+\newcommand*{\FamilyKeyStateUnknown}{%
+  \let\FamilyKeyState\FamilyKeyStateUnknown
+}
+\newcommand*{\FamilyKeyStateUnknownValue}{%
+  \let\FamilyKeyState\FamilyKeyStateUnknownValue
+}
+\newcommand*{\FamilyKeyStateNeedValue}{%
+  \let\FamilyKeyState\FamilyKeyStateNeedValue
+}
+\newcommand*{\FamilyKeyStateProcessed}{%
+  \let\FamilyKeyState\FamilyKeyStateProcessed
+}
+\let\FamilyKeyState\FamilyKeyStateUnknown
+\newcommand*{\FamilyOfKey}{}
+\newcommand*{\FamilyMemberOfKey}{}
 \newcommand*{\@globaloptionslist}{}
 \let\@globaloptionslist\@classoptionslist
 \scr@ifundefinedorrelax{XKV@classoptionslist}{}{%
@@ -169,8 +222,20 @@
     \let\@globaloptionslist\XKV@classoptionslist
   \fi
 }
-\newcommand*{\scr@removeunused}{}
 \newcommand*{\FamilyProcessOptions}[2][.\@currname.\@currext]{%
+  \ifx\AtEndOfFamilyOptions\scr@AtEndOfFamilyOptions
+    \PackageError{scrbase}{nested \string\FamilyProcessOptions\space
+      detected\MessageBreak}{%
+      \string\FamilyProcessOptions\space has been used while processing or
+      setting options.\MessageBreak
+      This is currently not allowed. You should contact the author of the
+      causing\MessageBreak
+      code.\MessageBreak
+      This error is fatal. You should not continue.%
+    }%
+  \fi
+  \let\AtEndOfFamilyOptions\scr@AtEndOfFamilyOptions
+  \@namedef{scr@after@options@#1@hook}{\@namedef{scr@after@options@#1@hook}{}}%
   \let\ds@\@empty
   \edef\@curroptions{\@ptionlist{\@currname.\@currext}}%
   \ifx\@currext\@clsextension\else
@@ -181,68 +246,101 @@
           \@use@ption
           \expandafter\let\csname ds@\CurrentOption\endcsname\@empty
         \else
-          \expandafter\def\expandafter\scr@removeunused\expandafter{%
-            \expandafter\def\expandafter\CurrentOption\expandafter{%
-              \CurrentOption}\@use@ption}%
-          \scr@optiontest{#2}\CurrentOption{}{%
-            \@expandtwoargs\setkeys{#2}%
-            \CurrentOption
-            \scr@removeunused
-          }%
-          \scr@optiontest{#2#1}\CurrentOption{}{%
-            \@expandtwoargs\setkeys{#2#1}%
-            \CurrentOption
-            \scr@removeunused
-          }%
-          \let\scr@removeunused\@empty
+          \scr@ifprocess@curroption{#1}{#2}{%
+            \@expandtwoargs\@removeelement\CurrentOption
+            \@unusedoptionlist\@unusedoptionlist
+          }{}%
         \fi
       \fi
     }%
   \fi
   \@for\CurrentOption:=\@curroptions\do{%
-    \@use@ption
     \scr@ifundefinedorrelax{ds@\CurrentOption}{%
-      \scr@optiontest{#2}\CurrentOption{%
-        \scr@optiontest{#2#1}\CurrentOption{%
-          \default@ds
-        }{%
-          \let\scr@removeunused\relax
-          \edef\reserved@a{%
-            \noexpand\setkeys{#2#1}{\CurrentOption}%
-            \noexpand\def\noexpand\CurrentOption{\CurrentOption}%
-          }\reserved@a
-          \ifx\scr@removeunused\relax\else\default@ds\fi
-        }%
-      }{%
-        \let\scr@removeunused\relax
-        \edef\reserved@a{%
-          \noexpand\setkeys{#2}{\CurrentOption}%
-          \noexpand\def\noexpand\CurrentOption{\CurrentOption}%
-        }\reserved@a
-        \if\scr@removeunused\relax\else\default@ds\fi
-        \scr@optiontest{#2#1}\CurrentOption{}{%
-          \let\scr@removeunused\relax
-          \@expandtwoargs\setkeys{#2#1}%
-          \CurrentOption
-          \ifx\scr@removeunused\relax\else\default@ds\fi
-        }%
-      }%
-    }{%
-    }%
+      \@use@ption
+      \scr@ifprocess@curroption{#1}{#2}{}\default@ds
+    }\@use@ption
   }%
   \@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}%
+  \let\AtEndOfFamilyOptions\@firstofone
+  \@nameuse{scr@after@options@#1@hook}%
 }
 \@onlypreamble\FamilyProcessOptions
-\newcommand*{\scr@optiontest}[2]{%
-  \edef\reserved@a{\noexpand\scr@pti@ntest{#1}#2=\noexpand\@nil}%
-  \reserved@a
+\newcommand*{\scr@AtEndOfFamilyOptions}{%
+  \expandafter
+  \l@addto@macro\csname scr@after@options@\FamilyOfKey @hook\endcsname
+}
+\newcommand*{\AtEndOfFamilyOptions}{}
+\let\AtEndOfFamilyOptions\@firstofone
+\newcommand*\scr@ifprocess@curroption[2]{%
+  \def\reserved@a##1=##2\@nil{\def\reserved@a{##1}}%
+  \expandafter\reserved@a\CurrentOption=\@nil
+  \scr@ifundefinedorrelax{KV@#2@\reserved@a}{%
+    \scr@ifundefinedorrelax{KV@#2#1@\reserved@a}{%
+      \let\FamilyKeyState\OptionNotUsed
+    }{%
+      \protected@edef\reserved@b{\noexpand\setkeys{#2#1}{\CurrentOption}%
+        \noexpand\def\noexpand\CurrentOption{\CurrentOption}}%
+      \reserved@b
+      \ifx\FamilyKeyState\FamilyKeyStateUnknown
+        \PackageInfo{scrbase}{Unknown processing state.\MessageBreak
+          Processing option `\CurrentOption'\MessageBreak
+          of member `#1' of family\MessageBreak
+          `#2' doesn't set\MessageBreak
+          a valid state. This will be interpreted\MessageBreak
+          as \string\FamilyKeyStateProcessed
+        }%
+        \FamilyKeyStateProcessed
+      \fi
+    }{%
+      \let\FamilyKeyState\OptionNotUsed
+    }%
+  }{%
+    \proteced@edef\reserved@b{\noexpand\setkeys{#2}{\CurrentOption}%
+      \noexpand\def\noexpand\CurrentOption{\CurrentOption}}%
+    \reserved@b
+    \ifx\FamilyKeyState\FamilyKeyStateUnknown
+      \PackageInfo{scrbase}{Unknown processing state.\MessageBreak
+        Processing option `\CurrentOption'\MessageBreak
+        of family `#2'\MessageBreak
+        doesn't set a valid state.\MessageBreak
+        This will be interpreted\MessageBreak
+        as \string\FamilyKeyStateProcessed
+      }%
+      \FamilyKeyStateProcessed
+    \fi
+    \def\reserved@a##1=##2\@nil{\def\reserved@a{##1}}%
+    \expandafter\reserved@a\CurrentOption=\@nil
+    \scr@ifundefinedorrelax{KV@#2#1@\reserved@a}{}{%
+      \protected@edef\reserved@b{\noexpand\setkeys{#2#1}{\CurrentOption}%
+        \noexpand\def\noexpand\CurrentOption{\CurrentOption}}%
+      \ifx\FamilyKeyState\FamiliyKeyStateProcessed
+        \reserved@b
+        \FamilyKeyStateProcessed
+      \else
+        \reserved@b
+        \ifx\FamilyKeyState\FamilyKeyStateUnknown
+          \PackageInfo{scrbase}{Unknown processing state.\MessageBreak
+            Processing option `\CurrentOption'\MessageBreak
+            of member `#1' of family\MessageBreak
+            `#2' doesn't set\MessageBreak
+            a valid state. This will be interpreted\MessageBreak
+            as \string\FamilyKeyStateProcessed
+          }%
+          \FamilyKeyStateProcessed
+        \fi
+      \fi
+    }%
+  }%
+  \ifx\FamilyKeyState\FamilyKeyStateProcessed
+    \expandafter\@firstoftwo
+  \else
+    \expandafter\@secondoftwo
+  \fi
 }
-\newcommand*{\scr@pti@ntest}{}
-\def\scr@pti@ntest#1#2=#3\@nil{\scr@ifundefinedorrelax{KV@#1@#2}}
 \newcommand*{\dont@let@as@internal@defined}{/}
 \newif\if@let@as@internalonly@defined\@let@as@internalonly@definedfalse
 \DefineFamily{KOMA}
@@ -259,12 +357,12 @@
   \fi
 }
 \FamilyProcessOptions{KOMA}\relax
-%%% From File: scrklang.dtx
-%%% From File: scrlfile.dtx
-\def\scrlfileversion{2012/06/15 v3.12}
-\edef\@tempa{\noexpand\RequirePackage{scrlfile}[\scrlfileversion]}
-\@tempa
-%%% From File: scrkbase.dtx
+%%% From File: $Id: scrkernel-language.dtx 1503 2013-11-06 11:44:59Z mjk $
+%%% From File: $Id: scrlfile.dtx 1525 2013-11-22 12:57:29Z mjk $
+\RequirePackage{scrlfile}[%
+  2013/12/19 v3.12 KOMA-Script
+]
+%%% From File: $Id: scrkernel-basics.dtx 1502 2013-11-06 11:00:12Z mjk $
 \newcommand*{\XdivY}[2]{%
   \numexpr ( #1 + #2 / 2 ) / #2 - 1\relax
 }
@@ -293,12 +391,12 @@
   \else
     \@ifundefined{#1}{%
       \begingroup
-        \expandafter\def\expandafter\@tempa
+        \expandafter\def\expandafter\reserved@a
           \expandafter{\csname scr@#1\endcsname}
-        \expandafter\def\expandafter\@tempb
+        \expandafter\def\expandafter\reserved@b
           \expandafter{\csname #1\endcsname}
       \expandafter\expandafter\expandafter\endgroup
-      \expandafter\expandafter\expandafter\let\expandafter\@tempb\@tempa
+      \expandafter\expandafter\expandafter\let\expandafter\reserved@b\reserved@a
       \if@atdocument\else
         \g@addto@macro\document{%
           \expandafter\ifx\csname #1\expandafter\endcsname
@@ -341,21 +439,252 @@
   \fi
 }
 \newcommand\ifstr[2]{%
-  \begingroup\protected@edef\@tempa{#1}\protected@edef\@tempb{#2}%
-  \ifx\@tempa\@tempb
+  \begingroup\protected@edef\reserved@a{#1}\protected@edef\reserved@b{#2}%
+  \ifx\reserved@a\reserved@b
     \endgroup\expandafter\@firstoftwo
   \else
     \endgroup\expandafter\@secondoftwo
   \fi
 }
+\newcommand*{\ifstrstart}[2]{%
+  \begingroup
+    \edef\reserved@a{\noexpand\@ifstrstart{#1}{#2}}%
+    \reserved@a{\aftergroup\@firstoftwo}{\aftergroup\@secondoftwo}%
+  \endgroup
+}
+\newcommand*{\@ifstrstart}[2]{%
+  \def\reserved@a ##1#2##2\@nil{%
+    \if\relax\detokenize{##1}\relax
+      \expandafter\@firstoftwo
+    \else
+      \expandafter\@secondoftwo
+    \fi
+  }%
+  \reserved@a#1#2\@nil
+}
+\newcommand*{\ifisdimen}[1]{%
+  \begingroup
+    \edef\reserved@a{#1}%
+    \expandafter\expandafter\expandafter\def
+    \expandafter\expandafter\expandafter\reserved@a
+    \expandafter\expandafter\expandafter{\expandafter\meaning\reserved@a}%
+    \expandafter\def\expandafter\reserved@b\expandafter{\string\dimen}%
+    \ifstrstart{\reserved@a}{\reserved@b}{%
+      \afterassignment\scr@ifrelax@to@nnil
+      \@tempdima=#1\relax\@nnil{%
+        \aftergroup\@firstoftwo
+      }{%
+        \aftergroup\@secondoftwo
+      }%
+    }{\aftergroup\@secondoftwo}%
+  \endgroup
+}
+\newcommand*{\scr@ifrelax@to@nnil}{}
+\def\scr@ifrelax@to@nnil#1\@nnil{%
+  \begingroup
+    \def\reserved@a{#1}\def\reserved@b{\relax}%
+    \ifx\reserved@a\reserved@b
+      \aftergroup\@firstoftwo
+    \else
+      \aftergroup\@secondoftwo
+    \fi
+  \endgroup
+}
+\newcommand*{\ifisdimexpr}[1]{%
+  \begingroup
+    \edef\reserved@a{#1}%
+    \expandafter\expandafter\expandafter\def
+    \expandafter\expandafter\expandafter\reserved@a
+    \expandafter\expandafter\expandafter{\expandafter\meaning\reserved@a}%
+    \expandafter\def\expandafter\reserved@b\expandafter{\string\dimexpr}%
+    \ifstrstart{\reserved@a}{\reserved@b}{%
+      \afterassignment\scr@ifemptyorrelax@to@nnil
+      \@tempdima=#1\relax\@nnil{%
+        \aftergroup\@firstoftwo
+      }{%
+        \aftergroup\@secondoftwo
+      }%
+    }{\aftergroup\@secondoftwo}%
+  \endgroup
+}
+\newcommand*{\scr@ifemptyorrelax@to@nnil}{}
+\def\scr@ifemptyorrelax@to@nnil#1\@nnil{%
+  \begingroup
+    \def\reserved@a{#1}\def\reserved@b{\relax}%
+    \ifx\reserved@a\reserved@b
+      \aftergroup\@firstoftwo
+    \else
+      \ifx\reserved@a\@empty
+        \aftergroup\@firstoftwo
+      \else
+        \aftergroup\@secondoftwo
+      \fi
+    \fi
+  \endgroup
+}
+\newcommand*{\ifisskip}[1]{%
+  \begingroup
+    \edef\reserved@a{#1}%
+    \expandafter\expandafter\expandafter\def
+    \expandafter\expandafter\expandafter\reserved@a
+    \expandafter\expandafter\expandafter{\expandafter\meaning\reserved@a}%
+    \expandafter\def\expandafter\reserved@b\expandafter{\string\skip}%
+    \ifstrstart{\reserved@a}{\reserved@b}{%
+      \afterassignment\scr@ifrelax@to@nnil
+      \@tempskipa=#1\relax\@nnil{%
+        \aftergroup\@firstoftwo
+      }{%
+        \aftergroup\@secondoftwo
+      }%
+    }{\aftergroup\@secondoftwo}%
+  \endgroup
+}
+\newcommand*{\ifisglueexpr}[1]{%
+  \begingroup
+    \edef\reserved@a{#1}%
+    \expandafter\expandafter\expandafter\def
+    \expandafter\expandafter\expandafter\reserved@a
+    \expandafter\expandafter\expandafter{\expandafter\meaning\reserved@a}%
+    \expandafter\def\expandafter\reserved@b\expandafter{\string\glueexpr}%
+    \ifstrstart{\reserved@a}{\reserved@b}{%
+      \afterassignment\scr@ifemptyorrelax@to@nnil
+      \@tempskipa=#1\relax\@nnil{%
+        \aftergroup\@firstoftwo
+      }{%
+        \aftergroup\@secondoftwo
+      }%
+    }{\aftergroup\@secondoftwo}%
+  \endgroup
+}
+\newcommand*{\ifiscount}[1]{%
+  \begingroup
+    \edef\reserved@a{#1}%
+    \expandafter\expandafter\expandafter\def
+    \expandafter\expandafter\expandafter\reserved@a
+    \expandafter\expandafter\expandafter{\expandafter\meaning\reserved@a}%
+    \expandafter\def\expandafter\reserved@b\expandafter{\string\count}%
+    \ifstrstart{\reserved@a}{\reserved@b}{%
+      \afterassignment\scr@ifrelax@to@nnil
+      \@tempcnta=#1\relax\@nnil{%
+        \aftergroup\@firstoftwo
+      }{%
+        \aftergroup\@secondoftwo
+      }%
+    }{\aftergroup\@secondoftwo}%
+  \endgroup
+}
+\newcommand*{\ifisnumexpr}[1]{%
+  \begingroup
+    \edef\reserved@a{#1}%
+    \expandafter\expandafter\expandafter\def
+    \expandafter\expandafter\expandafter\reserved@a
+    \expandafter\expandafter\expandafter{\expandafter\meaning\reserved@a}%
+    \expandafter\def\expandafter\reserved@b\expandafter{\string\numexpr}%
+    \ifstrstart{\reserved@a}{\reserved@b}{%
+      \afterassignment\scr@ifemptyorrelax@to@nnil
+      \@tempcnta=#1\relax\@nnil{%
+        \aftergroup\@firstoftwo
+      }{%
+        \aftergroup\@secondoftwo
+      }%
+    }{\aftergroup\@secondoftwo}%
+  \endgroup
+}
+\newcommand*{\ifiscounter}[1]{%
+  \begingroup
+    \@ifundefined{c@#1}%
+                 {\aftergroup\@secondoftwo}%
+                 {\aftergroup\@firstoftwo}%
+  \endgroup
+}
+\newcommand*{\ifisinteger}[1]{%
+  \begingroup
+    \edef\reserved@a{#1}\expandafter
+    \scr@ifintegerplusminus\reserved@a\@nil{\aftergroup\@firstoftwo}%
+                                             {\aftergroup\@secondoftwo}
+  \endgroup
+}
+\newcommand*{\scr@ifintegerplusminus}{}
+\def\scr@ifintegerplusminus#1#2\@nil{%
+  \def\scr@next{\scr@ifintegerplusminus #2\@nil}%
+  \if #1-\relax
+  \else \if #1+\relax
+    \else
+      \def\scr@next{%
+        \afterassignment\scr@ifrelax@to@nnil
+        \@tempcnta=#1#2\relax\@nnil
+      }%
+      \if #10\else\if #11\else\if #12\else\if #13\else\if #14\else
+      \if #15\else\if #16\else\if #17\else\if #18\else\if #19\else
+        \let\scr@next\@secondoftwo
+      \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
+    \fi
+  \fi
+  \scr@next
+}
+\newcommand*{\ifisdimension}[1]{%
+  \begingroup
+    \edef\reserved@a{#1\relax}\expandafter
+    \scr@ifdimensionplusminus\reserved@a\@nil{\aftergroup\@firstoftwo}%
+                                             {\aftergroup\@secondoftwo}
+  \endgroup
+}
+\newcommand*{\scr@ifdimensionplusminus}{}
+\def\scr@ifdimensionplusminus#1#2\@nil{%
+  \def\scr@next{\scr@ifdimensionplusminus #2\@nil}%
+  \if #1-\relax
+  \else \if #1+\relax
+    \else
+      \def\scr@next{%
+        \afterassignment\scr@ifrelax@to@nnil
+        \@tempdima=#1#2\@nnil
+      }%
+      \if #1,\else\if #1.\else
+        \if #10\else\if #11\else\if #12\else\if #13\else\if #14\else
+        \if #15\else\if #16\else\if #17\else\if #18\else\if #19\else
+          \let\scr@next\@secondoftwo
+        \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
+      \fi\fi
+    \fi
+  \fi
+  \scr@next
+}
+\newcommand*{\ifisglue}[1]{%
+  \begingroup
+    \edef\reserved@a{#1\relax}\expandafter
+    \scr@ifglueplusminus\reserved@a\@nil{\aftergroup\@firstoftwo}%
+                                             {\aftergroup\@secondoftwo}
+  \endgroup
+}
+\newcommand*{\scr@ifglueplusminus}{}
+\def\scr@ifglueplusminus#1#2\@nil{%
+  \def\scr@next{\scr@ifglueplusminus #2\@nil}%
+  \if #1-\relax
+  \else \if #1+\relax
+    \else
+      \def\scr@next{%
+        \afterassignment\scr@ifrelax@to@nnil
+        \@tempskipa=#1#2\@nnil
+      }%
+      \if #1,\else\if #1.\else
+        \if #10\else\if #11\else\if #12\else\if #13\else\if #14\else
+        \if #15\else\if #16\else\if #17\else\if #18\else\if #19\else
+          \let\scr@next\@secondoftwo
+        \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
+      \fi\fi
+    \fi
+  \fi
+  \scr@next
+}
 \newcommand\ifnumber[1]{%
   \begingroup\@tempswafalse\let\scr@next\test@number
-  \expandafter\scr@next#1\scr@next
-  \if@tempswa
-    \endgroup\expandafter\@firstoftwo
-  \else
-    \endgroup\expandafter\@secondoftwo
-  \fi
+    \expandafter\scr@next#1\scr@next
+    \if@tempswa
+      \aftergroup\@firstoftwo
+    \else
+      \aftergroup\@secondoftwo
+    \fi
+  \endgroup
 }
 \newcommand*{\test@number}[1]{%
   \ifx \scr@next#1
@@ -374,6 +703,30 @@
 }
 \newcommand*{\gobble@till@scr@next}{}
 \def\gobble@till@scr@next#1\scr@next{}
+\newcommand\ifintnumber[1]{%
+  \begingroup\@tempswafalse\let\scr@next\scr@test@sign
+    \expandafter\scr@next#1\scr@next
+    \if@tempswa
+      \aftergroup\@firstoftwo
+    \else
+      \aftergroup\@secondoftwo
+    \fi
+  \endgroup
+}
+\newcommand*{\scr@test@sign}[1]{%
+  \ifx \scr@next#1
+    \let\scr@next\relax
+  \else
+    \if #1-%
+    \else
+      \ifx #1+%
+      \else
+        \def\scr@next{\let\scr@next\test@number\scr@next #1}%
+      \fi
+    \fi
+  \fi
+  \scr@next
+}
 \newcommand{\ifdimen}[1]{%
   \begingroup\@tempswatrue\let\scr@next\test@posdimen
   \expandafter\test@dimen#1\scr@next
@@ -409,8 +762,8 @@
 }
 \newcommand*{\test@trueunt}{}
 \def\test@trueunt#1true#2true#3\test@trueunt{%
-  \edef\@tempa{#1}
-  \ifx\@tempa\@empty\test@@ifdimunt{#2}\else\test@@ifdimunt{#1}\fi
+  \edef\reserved@a{#1}%
+  \ifx\reserved@a\@empty\test@@ifdimunt{#2}\else\test@@ifdimunt{#1}\fi
 }
 \newcommand*\test@@ifdimunt[1]{%
   \@tempswafalse
@@ -516,77 +869,198 @@
   \ClassInfo{#1}{#2\@gobble}%
 }
 \newcommand*{\FamilyExecuteOptions}[3][.\@currname.\@currext]{%
-  \def\reserved@a##1\@nil{%
-    \@for\scr@key@atlist:=#3\do{%
-      \expandafter\scr@key@split@name@value\scr@key@atlist==\@nil
-      \scr@ifundefinedorrelax{KV@#2@\scr@key@name}{}{%
-        \protected@edef\reserved@a{\noexpand\setkeys{#2}{\scr@key@atlist}%
-          \noexpand\def\noexpand\scr@key@atlist{\scr@key@atlist}%
-          \noexpand\def\noexpand\scr@key@name{\scr@key@name}%
-        }%
-        \reserved@a
-      }%
-      \scr@ifundefinedorrelax{KV@#2#1@\scr@key@name}{}{%
-        \protected@edef\reserved@a{%
-          \noexpand\setkeys{#2#1}{\scr@key@atlist}%
-          \noexpand\def\noexpand\scr@key@atlist{\scr@key@atlist}%
-          \noexpand\def\noexpand\scr@key@name{\scr@key@name}%
+  \@namedef{scr@after@options@#1@hook}{\@namedef{scr@after@options@#1@hook}{}}%
+  \@for\scr@key@atlist:=#3\do{%
+    \expandafter\scr@key@split@name@value\scr@key@atlist==\@nil
+    \ifx\scr@key@name\@empty\else
+      \ifx\scr@key@name\space\else
+        \scr@ifundefinedorrelax{KV@#2@\scr@key@name}{%
+          \scr@ifundefinedorrelax{KV@#2#1@\scr@key@name}{%
+            \PackageError{scrbase}{%
+              unknown option
+              `\expandafter\detokenize\expandafter{\scr@key@atlist}'%
+            }{%
+              Member `#1' of family `#2'\MessageBreak
+              cannot handle option `\scr@key@name'.\MessageBreak
+              So it cannot be set%
+              \ifx\scr@key@value\@empty\else
+                \space to value
+                `\expandafter\detokenize\expandafter{\scr@key@value}'%
+              \fi.%
+            }%
+          }{%
+            \scr@execute@option{#2#1}%
+          }%
+        }{%
+          \scr@execute@option{#2}%
+          \ifstr{#1}{}{}{%
+            \scr@ifundefinedorrelax{KV@#2#1\scr@key@name}{}{%
+              \ifx\FamilyKeyState\FamilyKeyStateProcessed
+                \scr@execute@option{#2#1}%
+                \FamilyKeyStateProcessed
+              \else
+                \scr@execute@option{#2#1}%
+              \fi
+            }%
+          }%
         }%
-        \reserved@a
-      }%
-      \let\CurrentOption\scr@key@atlist
-      \csname ds@\CurrentOption\endcsname
-    }%
-    \edef\CurrentOption{##1}%
+        \scr@show@key@state@error
+      \fi
+    \fi
   }%
-  \expandafter\reserved@a\CurrentOption\@nil
+  \@nameuse{scr@after@options@#1@hook}%
 }
-\@onlypreamble\FamilyExecuteOptions
-\newcommand*{\FamilyOptions}[2]{%
-  \Family@Options{#1}{#2}{%
+\newcommand*{\scr@show@key@state@error}{%
+  \ifx\FamilyKeyState\FamilyKeyStateProcessed\else
     \PackageError{scrbase}{%
-      option `\scr@key@name' unknown at family `#1'%
+      unknown option
+      `\expandafter\detokenize\expandafter{\scr@key@atlist}'%
     }{%
-      You have used \string\FamilyOptions{#1} to set
-      `\scr@key@atlist',\MessageBreak
-      but family `#1' does not know any option named
-      `\scr@key@name'.\MessageBreak
-      See the manual for the package or class using family `#1' for
-      more\MessageBreak
-      informations about options and their values.%
+      Option
+      `\expandafter\detokenize\expandafter{\scr@key@name}'\MessageBreak
+      \ifx\FamilyMemberOfKey\@empty\else
+        of member `\FamilyMemberOfKey'\MessageBreak
+      \fi
+      \ifx\FamilyOfKey\@empty\else
+        of family `\FamilyOfKey'\MessageBreak
+      \fi
+      \ifx\FamilyKeyState\FamilyKeyStateNeedValue
+        expects a value, but has been used without any value.%
+      \else
+        cannot handle value\MessageBreak
+        `\expandafter\detokenize\expandafter{\scr@key@value}',%
+        \MessageBreak
+        \ifx\FamilyKeyState\FamilyKeyStateUnknownValue
+          because this is an unsupported value.%
+        \else
+          because \FamilyKeyState.
+        \fi
+      \fi
     }%
-  }%
+  \fi
 }
-\newcommand*{\Family@Options}[3]{%
+\newcommand*{\FamilyOptions}[2]{%
+  \@namedef{scr@after@options@#1@hook}{\@namedef{scr@after@options@#1@hook}{}}%
   \@for\scr@key@atlist:=#2\do{%
     \ifx\scr@key@atlist\@empty\else
       \ifx\scr@key@atlist\space\else
         \expandafter\scr@key@split@name@value\scr@key@atlist==\@nil
+        \let\scr@key@run@errors\@empty
         \scr@key@found@false
-        \edef\@tempa{\csname #1@key@familylist\endcsname}%
-        \@for\@tempa:=\@tempa\do{%
-          \scr@ifundefinedorrelax{KV@\@tempa @\scr@key@name}{}{%
+        \edef\reserved@a{\csname #1@key@familylist\endcsname}%
+        \@for\reserved@a:=\reserved@a\do{%
+          \scr@ifundefinedorrelax{KV@\reserved@a @\scr@key@name}{}{%
+            \expandafter\scr@execute@option\expandafter{\reserved@a}%
             \scr@key@found@true
-            \protected@edef\reserved@a{%
-              \noexpand\setkeys{\@tempa}{%
-                \unexpanded\expandafter{\scr@key@atlist}}%
-              \noexpand\def\noexpand\@tempa{%
-                \unexpanded\expandafter{\@tempa}}%
-              \noexpand\def\noexpand\scr@key@atlist{%
-                \unexpanded\expandafter{\scr@key@atlist}}%
-              \noexpand\def\noexpand\scr@key@name{%
-                \unexpanded\expandafter{\scr@key@name}}%
-              \noexpand\def\noexpand\scr@key@value{%
-                \unexpanded\expandafter{\scr@key@value}}%
-            }%
-            \reserved@a
+            \ifx\scr@key@run@errors\relax\else
+              \ifx\FamilyKeyState\FamilyKeyStateProcessed
+                \let\scr@key@run@errors\relax
+              \else
+                \ifx\FamilyKeyState\FamilyKeyStateUnknownValue
+                  \edef\scr@key@run@errors{%
+                    \unexpanded\expandafter{\scr@key@run@errors}%
+                    \noexpand\MessageBreak
+                    \FamilyMemberOfKey: unkown value
+                    `\expandafter\detokenize\expandafter{\scr@key@value}'.%
+                  }%
+                \else
+                  \ifx\FamilyKeyState\FamilyKeyStateNeedValue
+                    \edef\scr@key@run@errors{%
+                      \unexpanded\expandafter{\scr@key@run@errors}%
+                      \noexpand\MessageBreak
+                      \FamilyMemberOfKey: value expected.
+                    }%
+                  \else
+                    \edef\scr@key@run@errors{%
+                      \unexpanded\expandafter{\scr@key@run@errors}%
+                      \noexpand\MessageBreak
+                      \FamilyMemberOfKey: \FamilyKeyState.
+                    }%
+                  \fi
+                \fi
+              \fi
+            \fi
           }%
         }%
-        \ifscr@key@found@\else#3\fi
+        \ifscr@key@found@
+          \ifx\scr@key@run@errors\relax\else
+            \ifx\scr@key@run@errors\@empty\else
+              \PackageError{scrbase}{%
+                unknown option
+                `\expandafter\detokenize\expandafter{\scr@key@atlist}'%
+              }{%
+                The members of family `#1' cannot set option
+                `\scr@key@name'
+                \ifx\scr@key@value\@empty\else
+                  \MessageBreak
+                  to value
+                  `\expandafter\detokenize\expandafter{\scr@key@value}'%
+                \fi.\MessageBreak
+                Here's what each member says:
+                \scr@key@run@errors
+              }%
+            \fi
+          \fi
+        \else
+          \PackageError{scrbase}{%
+            unknown option
+            `\expandafter\detokenize\expandafter{\scr@key@atlist}'%
+          }{%
+            No one of the members of family `#1'\MessageBreak
+            can handle option `\scr@key@name'.\MessageBreak
+            So it cannot be set%
+            \ifx\scr@key@value\@empty\else
+              \space to value
+              `\expandafter\detokenize\expandafter{\scr@key@value}'%
+            \fi.%
+          }%
+        \fi
       \fi
     \fi
   }%
+  \@nameuse{scr@after@options@#1@hook}%
+}
+\newcommand*{\scr@execute@option}[1]{%
+  \protected@edef\reserved@a{%
+    \noexpand\let\noexpand\KV@err\noexpand\scr@KV@err
+    \noexpand\setkeys{#1}{%
+      \unexpanded\expandafter{\scr@key@atlist}}%
+     \noexpand\def\noexpand\scr@key@atlist{%
+      \unexpanded\expandafter{\scr@key@atlist}}%
+    \noexpand\def\noexpand\scr@key@name{%
+      \unexpanded\expandafter{\scr@key@name}}%
+    \noexpand\def\noexpand\scr@key@value{%
+      \unexpanded\expandafter{\scr@key@value}}
+    \ifx\scr@key@run@errors\relax
+      \noexpand\let\noexpand\scr@key@run@errors\relax
+    \else
+      \noexpand\def\noexpand\scr@key@run@errors{%
+        \unexpanded\expandafter{\scr@key@run@errors}}%
+    \fi
+    \noexpand\def\expandafter\noexpand
+    \csname scr@after@options@#1@hook\endcsname{%
+      \expandafter\unexpanded\expandafter\expandafter\expandafter{%
+        \csname scr@after@options@#1@hook\endcsname
+      }}%
+  }%
+  \let\AtEndOfFamilyOptions\scr@AtEndOfFamilyOptions
+  \reserved@a
+  \let\AtEndOfFamilyOptions\@firstofone
+  \ifx\FamilyKeyState\FamilyKeyStateUnknown
+    \PackageInfo{scrbase}{Unknown processing state.\MessageBreak
+      Processing option `\scr@key@atlist'\MessageBreak
+      \ifx\FamilyMemberOfKey\@empty\else
+        of member `\FamilyMemberOfKey'\MessageBreak
+      \fi
+      of family `\FamilyOfKey'\MessageBreak
+      doesn't set a valid state.\MessageBreak
+      This will be interpreted\MessageBreak
+      as \string\FamilyKeyStateProcessed
+    }%
+    \FamilyKeyStateProcessed
+  \fi
 }
+\newcommand*{\scr@key@run@errors}{}
 \newif\ifscr@key@found@
 \newcommand*{\scr@key@atlist}{}
 \newcommand*{\scr@key@name}{}
@@ -597,88 +1071,56 @@
   \KV@@sp@def\scr@key@value{#2}%
 }
 \newcommand*{\FamilyOption}[3]{%
-  \Family@Option{#1}{#2}{#3}{%
-    \PackageError{scrbase}{%
-      unknown option `\scr@key@name' for familie `#1'%
-    }{%
-      You have used \string\FamilyOption{#1} to set
-      `\scr@key@name',\MessageBreak
-      but family '#1' does not know any option named
-      `\scr@key@name'.\MessageBreak
-      See the the manual of the class or package, that provides
-      family\MessageBreak
-      `#1' for more informations about options and their values.%
-    }%
-  }%
-}
-\newcommand*{\Family@Option}[4]{%
   \expandafter\KV@@sp@def\expandafter\scr@key@name\expandafter{#2}%
-  \scr@key@found@false
-  \edef\@tempa{\csname #1@key@familylist\endcsname}%
-  \@for\@tempa:=\@tempa\do{%
-    \scr@ifundefinedorrelax{KV@\@tempa @\scr@key@name}{}{%
-      \scr@key@found@true
-      \let\@tempb\@tempa
-    }%
-  }%
-  \ifscr@key@found@
-    \let\reserved@a\@empty
-    \@for\@tempa:=#3\do{%
-      \expandafter\KV@@sp@def\expandafter\@tempa\expandafter{\@tempa}%
-      \ifx\@tempa\@empty\else
-        \protected@edef\reserved@a{\reserved@a,\scr@key@name=\@tempa}%
+  \let\reserved@a\@empty
+  \@for\reserved@b:=#3\do{%
+    \ifx\reserved@b\@empty\else
+      \ifx\reserved@b\space\else
+        \edef\reserved@a{\unexpanded\expandafter{\reserved@a},%
+          \scr@key@name=\unexpanded\expandafter{\reserved@b}}%
       \fi
-    }%
-    \ifx\reserved@a\@empty
-      \protected@edef\reserved@a{\noexpand\setkeys{\@tempb}{\scr@key@name}}%
-    \else
-      \protected@edef\reserved@a{%
-        \noexpand\setkeys{\@tempb}{\expandafter\@gobble\reserved@a}}%
     \fi
-    \reserved@a
-  \else
-    #4
-  \fi
-}
-\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
-  }%
-}{%
-  \newcommand{\l@addto@macro}[2]{%
-    \edef#1{\unexpanded\expandafter{#1#2}}%
   }%
+  \def\reserved@b{\FamilyOptions{#1}}%
+  \expandafter\reserved@b\expandafter{\reserved@a}%
 }
-\newcommand*{\FamilyUnknownKeyValue}[4]{%
-  \ifx\scr@removeunused\@empty
-    \PackageError{%
-      scrbase%
-    }{%
-      option `#2' of family `#1' has no value `#3'%
-    }{%
-      You've tried to set option `#2' of family '#1' to value `#3'.\MessageBreak
-      But allowed values are only:\MessageBreak
-      #4\FamilyElseValues.\MessageBreak
-      See the manual of the class or package, that provides family
-      `#1'\MessageBreak
-      for more information about options and their values.%
+\@ifundefined{l@addto@macro}{}{%
+  \begingroup
+    \long\def\reserved@a#1#2{%
+      \edef#1{\unexpanded\expandafter{#1#2}}%
     }%
-  \else
-    \global\let\scr@removeunused\@empty
-    \PackageInfo{%
-      scrbase%
-    }{%
-      option `#2' of family `#1' has no value `#3'.\MessageBreak
-      Allowed values for option `#2' of family `#1'\MessageBreak
-      would be:\MessageBreak
-      #4\FamilyElseValues.\MessageBreak
-      Maybe another class or package provides this option.\MessageBreak
-      Global option ignored
+    \ifx\reserved@a\l@addto@macro\else
+      \PackageWarning{scrbase}{%
+        Someone also uses macro name \string\l@addto@macro.\MessageBreak
+        When KOMA-Script author decided to use macro name\MessageBreak
+        \string\l@addto@macro\space first, there was no other
+        free\MessageBreak
+        LaTeX package using this macro name.\MessageBreak
+        In the meantime other package authers decided to use\MessageBreak
+        same macro name, but unfortunatly not all of those\MessageBreak
+        are compatible with KOMA-Script's definition, e.g.,\MessageBreak
+        while adding definitions with arguments to macros.\MessageBreak
+        Because of such potentially incompatible definitions,\MessageBreak
+        KOMA-Script will redefine the command now.\MessageBreak
+        Please ask the author of the other package to\MessageBreak
+        rename his macro, if a problem results in the\MessageBreak
+        redefinition%
+      }%
+    \fi
+  \endgroup
+}
+\long\def\l@addto@macro#1#2{%
+  \edef#1{\unexpanded\expandafter{#1#2}}%
+}%
+\newcommand*{\FamilyUnknownKeyValue}[4]{%
+  \FamilyKeyStateUnknownValue
+  \ifx\FamilyElseValues\@empty\else
+    \PackageWarning{scrbase}{non empty \string\FamilyElseValue
+      ignored.\MessageBreak
+      Setting this command to a non empty\MessageBreak
+      value for option `#2' of\MessageBreak
+      family `#1' is deprecated,\MessageBreak
+      but has been found
     }%
   \fi
 }
@@ -690,12 +1132,12 @@
   \DefineFamilyKey[{#1}]{#2}{#3}[true]{\FamilySetBool{#2}{#3}{#4}{##1}}%
 }
 \newcommand*{\FamilySetBool}[4]{%
-  \ifstr{#4}{true}{\@nameuse{#3true}}{%
-    \ifstr{#4}{on}{\@nameuse{#3true}}{%
-      \ifstr{#4}{yes}{\@nameuse{#3true}}{%
-        \ifstr{#4}{false}{\@nameuse{#3false}}{%
-          \ifstr{#4}{off}{\@nameuse{#3false}}{%
-            \ifstr{#4}{no}{\@nameuse{#3false}}{%
+  \ifstr{#4}{true}{\@nameuse{#3true}\FamilyKeyStateProcessed}{%
+    \ifstr{#4}{on}{\@nameuse{#3true}\FamilyKeyStateProcessed}{%
+      \ifstr{#4}{yes}{\@nameuse{#3true}\FamilyKeyStateProcessed}{%
+        \ifstr{#4}{false}{\@nameuse{#3false}\FamilyKeyStateProcessed}{%
+          \ifstr{#4}{off}{\@nameuse{#3false}\FamilyKeyStateProcessed}{%
+            \ifstr{#4}{no}{\@nameuse{#3false}\FamilyKeyStateProcessed}{%
               \FamilyUnknownKeyValue{#1}{#2}{#4}{%
                 `true', `on', `yes', `false', `off', `no'%
               }%
@@ -707,6 +1149,101 @@
   }%
   \let\FamilyElseValues\@empty
 }
+\newcommand*{\FamilyCounterKey}[4][.\@currname.\@currext]{%
+  \@ifundefined{c@#4}{\newcounter{#4}}{}%
+  \DefineFamilyKey[{#1}]{#2}{#3}{\FamilySetCounter{#2}{#3}{#4}{##1}}%
+}
+\newcommand*{\FamilySetCounter}[4]{%
+  \ifiscount{#4}{\value{#3}=#4\FamilyKeyStateProcessed}{%
+    \ifisdimen{#4}{\value{#3}=#4\FamilyKeyStateProcessed}{%
+      \ifisskip{#4}{\value{#3}=#4\FamilyKeyState\Processed}{%
+        \ifisnumexpr{#4}{\value{#3}=#4\FamilyKeyStateProcessed}{%
+          \ifisdimexpr{#4}{\value{#3}=#4\FamilyKeyStateProcessed}{%
+            \ifisinteger{#4}{\value{#3}=#4\FamilyKeyStateProcessed}{%
+              \ifiscounter{#4}{\value{#3}=\value{#4}\FamilyKeyStateProcessed}{%
+                \FamilyUnknownKeyValue{#1}{#2}{#4}{%
+                  integer numbers, counters, lengths, skips, dimens
+                }%
+              }%
+            }%
+          }%
+        }%
+      }%
+    }%
+  }%
+}
+\newcommand*{\FamilyCounterMacroKey}[4][.\@currname.\@currext]{%
+  \ifdefined#4\else\let#4\z@\fi
+  \DefineFamilyKey[{#1}]{#2}{#3}{\FamilySetCounterMacro{#2}{#3}{#4}{##1}}%
+}
+\newcommand*{\FamilySetCounterMacro}[4]{%
+  \begingroup
+    \ifiscount{#4}{\@tempcnta=#4\FamilyKeyStateProcessed}{%
+      \ifisdimen{#4}{\@tempcnta=#4\FamilyKeyStateProcessed}{%
+        \ifisskip{#4}{\@tempcnta=#4\FamilyKeyState\Processed}{%
+          \ifisnumexpr{#4}{\@tempcnta=#4\FamilyKeyStateProcessed}{%
+            \ifisdimexpr{#4}{\@tempcnta=#4\FamilyKeyStateProcessed}{%
+              \ifisinteger{#4}{\@tempcnta=#4\FamilyKeyStateProcessed}{%
+                \ifiscounter{#4}{%
+                  \@tempcnta=\value{#4}\FamilyKeyStateProcessed}{%
+                  \FamilyUnknownKeyValue{#1}{#2}{#4}{%
+                    integer numbers, counters, lengths, skips, dimens
+                  }%
+                }%
+              }%
+            }%
+          }%
+        }%
+      }%
+    }%
+  \expandafter\expandafter\expandafter\endgroup
+  \expandafter\def\expandafter#3\expandafter{\the\@tempcnta}%
+}
+\newcommand*{\FamilyLengthKey}[4][.\@currname.\@currext]{%
+  \ifdefined#4\else\newlength{#4}\fi
+  \DefineFamilyKey[{#1}]{#2}{#3}{\FamilySetLength{#2}{#3}{#4}{##1}}%
+}
+\newcommand*{\FamilySetLength}[4]{%
+  \ifiscount{#4}{#3=#4\FamilyKeyStateProcessed}{%
+    \ifisdimen{#4}{#3=#4\FamilyKeyStateProcessed}{%
+      \ifisskip{#4}{#3=#4\FamilyKeyState\Processed}{%
+        \ifisnumexpr{#4}{#3=#4\FamilyKeyStateProcessed}{%
+          \ifisdimexpr{#4}{#3=#4\FamilyKeyStateProcessed}{%
+            \ifisglue{#4}{#3=#4\FamilyKeyStateProcessed}{%
+              \FamilyUnknownKeyValue{#1}{#2}{#4}{%
+                length values, counters, lengths, skips, dimens
+              }%
+            }%
+          }%
+        }%
+      }%
+    }%
+  }%
+}
+\newcommand*{\FamilyLengthMacroKey}[4][.\@currname.\@currext]{%
+  \ifdefined#4\else\let#4\z@\fi
+  \DefineFamilyKey[{#1}]{#2}{#3}{\FamilySetLengthMacro{#2}{#3}{#4}{##1}}%
+}
+\newcommand*{\FamilySetLengthMacro}[4]{%
+  \begingroup
+    \ifiscount{#4}{\@tempskipa=#4\FamilyKeyStateProcessed}{%
+      \ifisdimen{#4}{\@temskipa=#4\FamilyKeyStateProcessed}{%
+        \ifisskip{#4}{\@tempkipa=#4\FamilyKeyState\Processed}{%
+          \ifisnumexpr{#4}{\@tempskipa=#4\FamilyKeyStateProcessed}{%
+            \ifisdimexpr{#4}{\@tempskipa=#4\FamilyKeyStateProcessed}{%
+              \ifisglue{#4}{\@tempskipa=#4\FamilyKeyStateProcessed}{%
+                \FamilyUnknownKeyValue{#1}{#2}{#4}{%
+                  length values, counters, lengths, skips, dimens
+                }%
+              }%
+            }%
+          }%
+        }%
+      }%
+    }%
+  \expandafter\expandafter\expandafter\endgroup
+  \expandafter\def\expandafter#3\expandafter{\the\@tempskipa}%
+}
 \newcommand*{\FamilyNumericalKey}[3][.\@currname.\@currext]{%
   \@ifnextchar [%]
     {\Family@Numerical@Key{#1}{#2}{#3}}{\Family@Numerical@Key{#1}{#2}{#3}[]}%
@@ -724,30 +1261,31 @@
 \newcommand*{\FamilySetNumerical}[5]{%
   \begingroup
     \edef\@searched{#5}%
-    \let\@tempa=\@empty
-    \let\@tempb=\@empty
+    \let\reserved@a=\@empty
+    \let\reserved@b=\@empty
     \@tempswafalse
     \@for\@valuelist:=#4\do{%
       \if@tempswa\else
-        \edef\@tempc{\expandafter\@firstoftwo\@valuelist}%
-        \edef\@tempa{\@tempa\@tempb`\@tempc'}%
-        \edef\@tempb{, }%
-        \ifx\@tempc\@searched
+        \edef\reserved@c{\expandafter\@firstoftwo\@valuelist}%
+        \edef\reserved@a{\reserved@a\reserved@b`\reserved@c'}%
+        \edef\reserved@b{, }%
+        \ifx\reserved@c\@searched
           \@tempswatrue
-          \edef\@tempa{\expandafter\@secondoftwo\@valuelist}%
+          \edef\reserved@a{\expandafter\@secondoftwo\@valuelist}%
         \fi
       \fi
     }%
     \if@tempswa
-      \edef\@tempa{\endgroup
-        \noexpand\@namedef{#3}{\@tempa}%
+      \edef\reserved@a{\endgroup
+        \noexpand\@namedef{#3}{\reserved@a}%
+        \noexpand\FamilyKeyStateProcessed
       }%
     \else
-      \edef\@tempa{\endgroup
-        \noexpand\FamilyUnknownKeyValue{#1}{#2}{#5}{\@tempa}%
+      \edef\reserved@a{\endgroup
+        \noexpand\FamilyUnknownKeyValue{#1}{#2}{#5}{\reserved@a}%
       }%
     \fi
-  \@tempa
+  \reserved@a
   \let\FamilyElseValues\@empty
 }
 \newcommand*{\FamilyStringKey}[3][.\@currname.\@currext]{%
@@ -759,129 +1297,389 @@
   \DefineFamilyKey[{#1}]{#2}{#3}[{#4}]{\def#5{##1}}%
 }
 \newcommand{\Family@String@Key}[4]{%
-  \DefineFamilyKey[{#1}]{#2}{#3}{\def#4{##1}}%
-}
-%%% From File: scrklang.dtx
-\newcommand*{\providecaptionname}[3]{%
-  \@ifundefined{captions#1}{%
-    \@ifundefined{cap@info@#1@done}{%
-      \PackageInfo{scrbase}{%
-        No captions found for `#1'\MessageBreak
-        --> skipped%
+  \DefineFamilyKey[{#1}]{#2}{#3}{\def#4{##1}\FamilyKeyStateProcessed}%
+}
+%%% From File: $Id: scrkernel-language.dtx 1503 2013-11-06 11:44:59Z mjk $
+\newcommand*{\defcaptionname}{%
+  \@ifstar\scr@def@scaptionname\scr@def@captionname
+}
+\newcommand*{\scr@def@scaptionname}[3]{%
+  \if@atdocument \expandafter\@firstofone
+  \else \expandafter\AtBeginDocument
+  \fi
+  {%
+    \begingroup
+      \let\reserved@b\endgroup
+      \edef\scr@reserved@a{#1}%
+      \@onelevel@sanitize\scr@reserved@a
+      \expandafter\@for \expandafter\scr@reserved@a \expandafter:\expandafter=%
+      \scr@reserved@a \do{%
+        \scr@trim@spaces\scr@reserved@a
+        \ifx\scr@reserved@a\@empty
+          \PackageWarning{scrbase}{empty language at \string\defcaptionname}%
+        \else
+          \expandafter\ifx\csname extras\scr@reserved@a\endcsname\relax
+            \expandafter\expandafter\expandafter\gdef
+          \else
+            \expandafter\expandafter\expandafter\g@addto@macro
+          \fi
+          \csname extras\scr@reserved@a\endcsname{%
+            \def#2{#3}%
+          }%
+          \scr@def@activateactivelanguageaftergroup{#2}{#3}%
+        \fi
       }%
-      \expandafter\let\csname cap@info@#1@done\endcsname\@empty
-    }{}%
-  }{%
+    \reserved@b
+  }%
+}
+\newcommand*{\scr@def@activateactivelanguageaftergroup}[2]{%
+  \@onelevel@sanitize\languagename
+  \@tempswafalse
+  \ifx\languagename\scr@reserved@a
+    \@tempswatrue
+  \else
+    \ifcsname l@\scr@reserved@a\endcsname
+      \expandafter\ifnum\csname l@\scr@reserved@a\endcsname=\language
+        \@tempswatrue
+      \fi
+    \fi
+  \fi
+  \if@tempswa
+    \def\reserved@b{\endgroup
+      \PackageInfo{scrbase}{activating \languagename\space \string#1}%
+      \def#1{#2}%
+    }%
+  \fi
+}
+\newcommand\scr@trim@spaces[1]{%
+  \expandafter\KV@@sp@def\expandafter#1\expandafter{#1}%
+}
+\newcommand*{\scr@def@captionname}[3]{%
+  \if@atdocument \expandafter\@firstofone
+  \else \expandafter\AtBeginDocument
+  \fi
+  {%
     \begingroup
-      \let\@tempa\endgroup
-      \def\@tempb{\relax\undefined\relax}%
-      \let #2\@tempb\relax
-      \csname captions#1\endcsname
-      \ifx #2\@tempb\relax
-        \edef\@tempb{#1}%
-        \@onelevel@sanitize\@tempb
-        \@onelevel@sanitize\languagename
-        \ifx\@tempb\languagename
-          \def\@tempa{\endgroup%
-            \expandafter\g@addto@macro\csname captions#1\endcsname{%
-              \def#2{#3}}%
-            \csname captions#1\endcsname
+      \let\reserved@b\endgroup
+      \edef\scr@reserved@a{#1}%
+      \@onelevel@sanitize\scr@reserved@a
+      \expandafter\@for \expandafter\scr@reserved@a \expandafter:\expandafter=%
+      \scr@reserved@a \do{%
+        \scr@trim@spaces\scr@reserved@a
+        \ifx\scr@reserved@a\@empty
+          \PackageWarning{scrbase}{empty language at \string\defcaptionname}%
+        \else
+          \@tempswafalse
+          \begingroup
+            \@tempswafalse
+            \ifcsname extras\scr@reserved@a\endcsname
+              \let#2\relax
+              \csname extras\scr@reserved@a\endcsname
+              \ifx #2\relax \else \aftergroup\@tempswatrue \fi
+            \fi
+          \endgroup
+          \if@tempswa
+            \expandafter\g@addto@macro\csname extras\scr@reserved@a\endcsname{%
+              \def#2{#3}%
+            }%
+          \else
+           \expandafter\ifx\csname captions\scr@reserved@a\endcsname\relax
+              \expandafter\expandafter\expandafter\gdef
+            \else
+              \expandafter\expandafter\expandafter\g@addto@macro
+            \fi
+            \csname captions\scr@reserved@a\endcsname{%
+              \def#2{#3}%
+            }%
+          \fi
+          \scr@def@activateactivelanguageaftergroup{#2}{#3}%
+        \fi
+      }%
+    \reserved@b
+  }%
+}
+\newcommand*{\providecaptionname}{%
+  \@ifstar\scr@provide@scaptionname\scr@provide@captionname
+}
+\newcommand*{\scr@provide@scaptionname}[3]{%
+  \if@atdocument \expandafter\@firstofone
+  \else \expandafter\AtBeginDocument
+  \fi
+  {%
+    \begingroup
+      \let\reserved@b\endgroup
+      \edef\scr@reserved@a{#1}%
+      \@onelevel@sanitize\scr@reserved@a
+      \expandafter\@for \expandafter\scr@reserved@a \expandafter:\expandafter=%
+      \scr@reserved@a \do{%
+        \scr@trim@spaces\scr@reserved@a
+        \ifx\scr@reserved@a\@empty
+          \PackageWarning{scrbase}{empty language at
+            \string\providecaptionname}%
+        \else
+          \begingroup
+            \let#2\relax
+            \csname extras\scr@reserved@a\endcsname
+            \csname captions\scr@reserved@a\endcsname
+            \ifx #2\relax \aftergroup\@firstofone
+            \else
+              \aftergroup\@gobble
+            \fi
+          \endgroup
+          {%
+            \expandafter\ifx\csname extras\scr@reserved@a\endcsname\relax
+              \expandafter\expandafter\expandafter\@gobbletwo
+            \else
+              \expandafter\expandafter\expandafter\g@addto@macro
+            \fi
+            \csname extras\scr@reserved@a\endcsname{%
+              \def#2{#3}%
+            }%
+            \scr@def@activateactivelanguageaftergroup{#2}{#3}%
           }%
+        \fi
+      }%
+    \reserved@b
+  }%
+}
+\newcommand*{\scr@provide@captionname}[3]{%
+  \if@atdocument \expandafter\@firstofone
+  \else \expandafter\AtBeginDocument
+  \fi
+  {%
+    \begingroup
+      \let\reserved@b\endgroup
+      \edef\scr@reserved@a{#1}%
+      \@onelevel@sanitize\scr@reserved@a
+      \expandafter\@for \expandafter\scr@reserved@a \expandafter:\expandafter=%
+      \scr@reserved@a \do{%
+        \scr@trim@spaces\scr@reserved@a
+        \ifx\scr@reserved@a\@empty
+          \PackageWarning{scrbase}{empty language at
+            \string\providecaptionname}%
         \else
-          \def\@tempa{\endgroup%
-            \expandafter\g@addto@macro\csname captions#1\endcsname{%
-              \def#2{#3}}%
+          \begingroup
+            \let#2\relax
+            \csname captions\scr@reserved@a\endcsname
+            \csname extras\scr@reserved@a\endcsname
+            \ifx #2\relax \aftergroup\@firstofone
+            \else
+              \aftergroup\@gobble
+            \fi
+          \endgroup
+          {%
+            \expandafter\ifx\csname captions\scr@reserved@a\endcsname\relax
+              \expandafter\expandafter\expandafter\@gobbletwo
+            \else
+              \expandafter\expandafter\expandafter\g@addto@macro
+            \fi
+            \csname captions\scr@reserved@a\endcsname{%
+              \def#2{#3}%
+            }%
+            \scr@def@activateactivelanguageaftergroup{#2}{#3}%
           }%
         \fi
-      \else
-        \PackageInfo{scrbase}{%
-          `\string#2' at language `#1' already
-          defined\MessageBreak
-          --> skipped%
-        }%
-      \fi
-    \@tempa
+      }%
+    \reserved@b
   }%
 }
-\newcommand*{\newcaptionname}[3]{%
-  \@ifundefined{captions#1}{%
-    \PackageInfo{scrbase}{%
-      No captions found for `#1' --> defining%
-    }%
-    \@namedef{captions#1}{}%
-  }{}%
-  \begingroup
-    \def\@tempb{\relax\undefined\relax}%
-    \let #2\@tempb\relax
-    \csname captions#1\endcsname
-    \ifx #2\@tempb\relax\else
-      \PackageError{scrbase}{%
-        `\string#2' at language `#1' already defined%
-      }{%
-        You've told me to define `\string#2' at language
-        `#1',\MessageBreak
-        but it is already defined.\MessageBreak
-        It will be redefined, if you'll continue.%
+\newcommand*{\newcaptionname}{%
+  \@ifstar\scr@new@scaptionname\scr@new@captionname
+}
+\newcommand*{\scr@new@scaptionname}[3]{%
+  \if@atdocument \expandafter\@firstofone
+  \else \expandafter\AtBeginDocument
+  \fi
+  {%
+    \begingroup
+      \let\reserved@b\endgroup
+      \edef\scr@reserved@a{#1}%
+      \@onelevel@sanitize\scr@reserved@a
+      \expandafter\@for \expandafter\scr@reserved@a \expandafter:\expandafter=%
+      \scr@reserved@a \do{%
+        \scr@trim@spaces\scr@reserved@a
+        \ifx\scr@reserved@a\@empty
+          \PackageWarning{scrbase}{empty language at \string\newcaptionname}%
+        \else
+          \begingroup
+            \let#2\relax
+            \csname captions\scr@reserved@a\endcsname
+            \csname extras\scr@reserved@a\endcsname
+            \ifx #2\relax
+            \else
+              \PackageError{scrbase}{%
+                `\string#2' already defined\MessageBreak
+                for language `\scr@reserved@a'%
+              }{%
+                You've told me to define `\string#2' for language
+                `\scr@reserved@a',\MessageBreak
+                but is has already been defined.\MessageBreak
+                Nevertheless, if you'll continue it will be redefined.%
+              }%
+            \fi
+          \endgroup
+          \expandafter\ifx\csname extras\scr@reserved@a\endcsname\relax
+            \expandafter\expandafter\expandafter\gdef
+          \else
+            \expandafter\expandafter\expandafter\g@addto@macro
+          \fi
+          \csname extras\scr@reserved@a\endcsname{%
+            \def#2{#3}%
+          }%
+          \scr@def@activateactivelanguageaftergroup{#2}{#3}%
+        \fi
       }%
-    \fi
-  \endgroup
-  \expandafter\g@addto@macro\csname captions#1\endcsname{%
-    \def#2{#3}%
+    \reserved@b
   }%
-  \begingroup
-    \edef\@tempb{#1}%
-    \@onelevel@sanitize\@tempb
-    \@onelevel@sanitize\languagename
-    \ifx\@tempb\languagename
-      \def\@tempa{\endgroup\csname captions#1\endcsname}%
-    \else
-      \let\@tempa\endgroup
-    \fi
-  \@tempa
 }
-\newcommand*{\renewcaptionname}[3]{%
-  \@ifundefined{captions#1}{%
-    \PackageError{scrbase}{%
-      No captions found for `#1'%
-    }{%
-      You've told me to redefine the caption `\string#2' at language
-      `#1',\MessageBreak
-      but `\expandafter\string\csname captions#1\endcsname' is not
-      defined.\MessageBreak
-      If you'll continue it will be defined.%
-    }
-    \@namedef{captions#1}{}%
-  }{}%
-  \begingroup
-    \def\@tempb{\relax\undefined\relax}%
-    \let #2\@tempb\relax
-    \csname captions#1\endcsname
-    \ifx #2\@tempb\relax
-      \PackageError{scrbase}{%
-        `\string#2' not defined at language `#1'%
-      }{%
-        You've told me to redefine `\string#2' at language
-        `#1',\MessageBreak
-        but it is not defined.\MessageBreak
-        If you'll continue it will be defined.%
+\newcommand*{\scr@new@captionname}[3]{%
+  \if@atdocument \expandafter\@firstofone
+  \else \expandafter\AtBeginDocument
+  \fi
+  {%
+    \begingroup
+      \let\reserved@b\endgroup
+      \edef\scr@reserved@a{#1}%
+      \@onelevel@sanitize\scr@reserved@a
+      \expandafter\@for \expandafter\scr@reserved@a \expandafter:\expandafter=%
+      \scr@reserved@a \do{%
+        \scr@trim@spaces\scr@reserved@a
+        \ifx\scr@reserved@a\@empty
+          \PackageWarning{scrbase}{empty language at \string\newcaptionname}%
+        \else
+          \begingroup
+            \let#2\relax
+            \csname captions\scr@reserved@a\endcsname
+            \csname extras\scr@reserved@a\endcsname
+            \ifx #2\relax
+            \else
+              \PackageError{scrbase}{%
+                `\string#2' already defined\MessageBreak
+                for language `\scr@reserved@a'%
+              }{%
+                You've told me to define `\string#2' for language
+                `\scr@reserved@a',\MessageBreak
+                but is has already been defined.\MessageBreak
+                Nevertheless, if you'll continue it will be redefined.%
+              }%
+            \fi
+          \endgroup
+          \expandafter\ifx\csname captions\scr@reserved@a\endcsname\relax
+            \expandafter\expandafter\expandafter\gdef
+          \else
+            \expandafter\expandafter\expandafter\g@addto@macro
+          \fi
+          \csname captions\scr@reserved@a\endcsname{%
+            \def#2{#3}%
+          }%
+          \scr@def@activateactivelanguageaftergroup{#2}{#3}%
+        \fi
       }%
-    \fi
-  \endgroup
-  \expandafter\g@addto@macro\csname captions#1\endcsname{%
-    \def#2{#3}%
+    \reserved@b
+  }%
+}
+\newcommand*{\renewcaptionname}{%
+  \@ifstar\scr@renew@scaptionname\scr@renew@captionname
+}
+\newcommand*{\scr@renew@scaptionname}[3]{%
+  \if@atdocument \expandafter\@firstofone
+  \else \expandafter\AtBeginDocument
+  \fi
+  {%
+    \begingroup
+      \let\reserved@b\endgroup
+      \edef\scr@reserved@a{#1}%
+      \@onelevel@sanitize\scr@reserved@a
+      \expandafter\@for \expandafter\scr@reserved@a \expandafter:\expandafter=%
+      \scr@reserved@a \do{%
+        \scr@trim@spaces\scr@reserved@a
+        \ifx\scr@reserved@a\@empty
+          \PackageWarning{scrbase}{empty language at \string\renewcaptionname}%
+        \else
+          \begingroup
+            \let#2\relax
+            \csname captions\scr@reserved@a\endcsname
+            \csname extras\scr@reserved@a\endcsname
+            \ifx #2\relax
+              \PackageError{scrbase}{%
+                `\string#2' not defined at language `\scr@reserved@a'%
+              }{%
+                You've told me to redefine `\string#2' at language
+                `\scr@reserved@a',\MessageBreak
+                but is hasn't been defined before.\MessageBreak
+                Nevertheless, if you'll continue I'll define it at
+                `\expandafter\string\csname extras\scr@reserved@a\endcsname'%
+              }%
+            \fi
+          \endgroup
+          \expandafter\ifx\csname extras\scr@reserved@a\endcsname\relax
+            \expandafter\expandafter\expandafter\gdef
+          \else
+            \expandafter\expandafter\expandafter\g@addto@macro
+          \fi
+          \csname extras\scr@reserved@a\endcsname{%
+            \def#2{#3}%
+          }%
+          \scr@def@activateactivelanguageaftergroup{#2}{#3}%
+        \fi
+      }%
+    \reserved@b
+  }%
+}
+\newcommand*{\scr@renew@captionname}[3]{%
+  \if@atdocument \expandafter\@firstofone
+  \else \expandafter\AtBeginDocument
+  \fi
+  {%
+    \begingroup
+      \let\reserved@b\endgroup
+      \edef\scr@reserved@a{#1}%
+      \@onelevel@sanitize\scr@reserved@a
+      \expandafter\@for \expandafter\scr@reserved@a \expandafter:\expandafter=%
+      \scr@reserved@a \do{%
+        \scr@trim@spaces\scr@reserved@a
+        \ifx\scr@reserved@a\@empty
+          \PackageWarning{scrbase}{empty language at \string\renewcaptionname}%
+        \else
+          \begingroup
+            \let#2\relax
+            \csname extras\scr@reserved@a\endcsname
+            \ifx #2\relax
+              \csname captions\scr@reserved@a\endcsname
+              \ifx #2\relax
+                \PackageError{scrbase}{%
+                  `\string#2' not defined at language `\scr@reserved@a'%
+                }{%
+                  You've told me to redefine `\string#2' at language
+                  `\scr@reserved@a',\MessageBreak
+                  but it hasn't been defined before.\MessageBreak
+                  Nevertheless, if you'll continue I'll define it at
+                  `\expandafter\string
+                  \csname captions\scr@reserved@a\endcsname'%
+                }%
+              \fi
+              \expandafter\ifx\csname captions\scr@reserved@a\endcsname\relax
+                \expandafter\expandafter\expandafter\gdef
+              \else
+                \expandafter\expandafter\expandafter\g@addto@macro
+              \fi
+              \csname captions\scr@reserved@a\endcsname{\def#2{#3}}%
+            \else
+              \expandafter\ifx\csname extras\scr@reserved@a\endcsname\relax
+                \expandafter\expandafter\expandafter\gdef
+              \else
+                \expandafter\expandafter\expandafter\g@addto@macro
+              \fi
+              \csname extras\scr@reserved@a\endcsname{\def#2{#3}}%
+            \fi
+          \endgroup
+          \scr@def@activateactivelanguageaftergroup{#2}{#3}%
+        \fi
+      }%
+    \reserved@b
   }%
-  \begingroup
-    \edef\@tempb{#1}%
-    \@onelevel@sanitize\@tempb
-    \@onelevel@sanitize\languagename
-    \ifx\@tempb\languagename
-      \def\@tempa{\endgroup\csname captions#1\endcsname}%
-    \else
-      \let\@tempa\endgroup
-    \fi
-  \@tempa
 }
-%%% From File: scrlogo.dtx
+%%% From File: $Id: scrlogo.dtx 1380 2013-10-01 15:31:55Z mjk $
 \@ifundefined{KOMAScript}{%
   \DeclareRobustCommand{\KOMAScript}{\textsf{K\kern.05em O\kern.05em%
       M\kern.05em A\kern.1em-\kern.1em Script}}}{}
-- 
cgit v1.2.3

