%%
%% This is file `tudscrbase.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% tudscr-version.dtx  (with options: `package,base')
%% tudscr-base.dtx  (with options: `package,base')
%% 
%% TUD-Script -- Corporate Design of Technische Universitaet Dresden
%% 
%%   2017/05/30 v2.05m TUD-Script
%% 
%% Copyright (C) Falk Hanisch <hanisch.latex@outlook.com>, 2012-2017
%% 
%% This file was generated from file(s) of the TUD-Script bundle.
%% ----------------------------------------------------------------------------
%% 
%% This work may be distributed and/or modified under the conditions
%% of the LaTeX Project Public License, version 1.3c of the license.
%% The latest version of this license is in
%%     http://www.latex-project.org/lppl.txt
%% and version 1.3c or later is part of all distributions of
%% LaTeX 2005/12/01 or later and of this work.
%% 
%% This work has the LPPL maintenance status "author-maintained".
%% 
%% The current maintainer and author of this work is Falk Hanisch.
%% 
%%% From File: tudscr-version.dtx
\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\TUD@Version\@tempa\else%
        \@latex@warning@no@line{%
          \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-Script-Bundle versions%
        }%
      \fi%
    }
  \fi
  \TUD@Version@Check{2017/05/30 v2.05m TUD-Script}
\endgroup
\NeedsTeXFormat{LaTeX2e}
\providecommand*\tudscrmail{hanisch.latex@outlook.com}
\@ifundefined{TUDScript}{%
  \DeclareRobustCommand\TUDScript{%
    \ifdin{TUD-SCRIPT}{%
      \textsf{T\kern.05em U\kern.05em D\kern.1em-\kern.1em Script}%
    }\csname xspace\endcsname%
  }%
}{}
%%% From File: tudscr-base.dtx
\ProvidesPackage{tudscrbase}[%
  2017/05/30 v2.05m TUD-Script
  package
  (basics for the bundle)%
]
\RequirePackage{scrbase}[2013/12/19]
\@ifpackagelater{scrbase}{2015/10/04}{}{%
  \providecommand*\kernel@ifstar[1]{\kernel@ifnextchar*{\@firstoftwo{#1}}}%
}
\@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]
\RequirePackage{etexcmds}[2011/02/16]
\RequirePackage{kvsetkeys}[2012/04/25]
\newcommand*\tud@reserved{}
\newtoks\tud@toks@
\newcommand*\eaddto@hook[2]{%
  \expandafter\addto@hook\expandafter#1\expandafter{#2}%
}
\newcommand*\ifxblank{\ifstr{}}
\newcommand*\ifxnumber[1]{%
  \if\relax\detokenize\expandafter{\romannumeral-0#1}\relax%
    \expandafter\@firstoftwo%
  \else%
    \expandafter\@secondoftwo%
  \fi%
}
\newcommand*\ifstrbool[4]{%
  \ifstr{#1}{true}{#2}{%
    \ifstr{#1}{on}{#2}{%
      \ifstr{#1}{yes}{#2}{%
        \ifstr{#1}{false}{#3}{%
          \ifstr{#1}{no}{#3}{%
            \ifstr{#1}{off}{#3}{%
              #4%
            }%
          }%
        }%
      }%
    }%
  }%
}
\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%
}
\newcommand*\tud@divide[3]{%
  \begingroup%
    \@defaultunits\@tempdima #2pt\relax\@nnil%
    \@defaultunits\@tempdimb #3pt\relax\@nnil%
    \ifdim\@tempdima>\@tempdimb\relax%
      \@whiledim\@tempdimb>1pt\relax\do{%
        \setlength\@tempdima{.1\@tempdima}%
        \setlength\@tempdimb{.1\@tempdimb}%
      }%
      \setlength\@tempdimc{\@tempdima}%
    \else%
      \@whiledim\@tempdima>1pt\relax\do{%
        \setlength\@tempdima{.1\@tempdima}%
        \setlength\@tempdimb{.1\@tempdimb}%
      }%
      \setlength\@tempdimc{\@tempdimb}%
    \fi%
    \@tempcnta=1\relax%
    \@whiledim\dimexpr\@tempcnta\@tempdimc\relax<.01\maxdimen\do{%
      \multiply\@tempcnta by 10\relax%
    }%
    \setlength{\@tempdimc}{%
      \dimexpr(\@tempcnta\@tempdima / \@tempdimb * \p@)\relax%
    }%
    \setlength{\@tempdimc}{\dimexpr \@tempdimc/\@tempcnta\relax}%
    \edef\@tempa{\endgroup\def\noexpand#1{\strip@pt\@tempdimc}}%
  \@tempa%
}
\newcommand*\tud@lowerstring[2]{%
  \protected@edef#1{#2}%
  \lowercase\expandafter{%
    \expandafter\def\expandafter #1\expandafter{#1}%
  }%
}
\newcommand*\tud@font@koma@set[2]{%
  \ifcsdef{tud@font@koma@#1}{}{\addtokomafont{#1}{\csuse{tud@font@koma@#1}}}%
  \csdef{tud@font@koma@#1}{#2\nobreak}%
}
\newcommand*\tud@font@koma@unset[1]{%
  \ifcsdef{tud@font@koma@#1}{}{\addtokomafont{#1}{\csuse{tud@font@koma@#1}}}%
  \csdef{tud@font@koma@#1}{\relax}%
}
\newcommand*\tud@font@koma@reset[1]{%
  \ifcsdef{tud@font@koma@#1}{\addtokomafont{#1}{\csuse{tud@font@koma@#1}}}{}%
}
\DefineFamily{TUD}
\newcommand*\TUDProcessOptions{\FamilyProcessOptions{TUD}}
\newcommand*\TUDExecuteOptions{\FamilyExecuteOptions{TUD}}
\newcommand*\TUDoptions{\FamilyOptions{TUD}}
\newcommand*\TUDoption{\FamilyOption{TUD}}
\newcommand*\TUD@key[1][.\@currname.\@currext]{%
  \DefineFamilyMember[{#1}]{TUD}%
  \DefineFamilyKey[{#1}]{TUD}%
}
\newcommand*\TUD@ifkey[1][.\@currname.\@currext]{%
  \DefineFamilyMember{TUD}%
  \FamilyBoolKey[#1]{TUD}%
}
\newcommand*\TUD@set@ifkey{\FamilySetBool{TUD}}
\newcommand*\TUD@numkey[1][.\@currname.\@currext]{%
  \DefineFamilyMember{TUD}%
  \FamilyNumericalKey[#1]{TUD}%
}
\newcommand*\TUD@bool@numkey{%
  {false}{0},{off}{0},{no}{0},{true}{1},{on}{1},{yes}{1}%
}
\newcommand*\TUD@set@numkey{\FamilySetNumerical{TUD}}
\newcommand*\TUD@lengthkey[1][.\@currname.\@currext]{%
  \DefineFamilyMember{TUD}%
  \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[3]{%
  \ifbool{@tud@#1@locked}{}{%
    \TUD@set@ifkey{#1}{#2}{#3}%
    \boolfalse{@tud@#1@locked}%
  }%
}
\newcommand*\TUD@set@ifkey@lock[1]{%
  \booltrue{@tud@#1@locked}%
  \TUD@set@ifkey{#1}%
}
\let\TUD@std@numkey@lock\TUD@std@ifkey@lock
\newcommand*\TUD@set@numkey@lock[1]{%
  \booltrue{@tud@#1@locked}%
  \TUD@set@numkey{#1}%
}
\newcommand*\cs@lock[2]{%
  \expandafter\newcommand\expandafter*\csname#1\endcsname{#2}%
  \newbool{#1@locked}%
}
\newcommand*\cs@std@lock[2]{%
  \ifbool{#1@locked}{}{%
    \csdef{#1}{#2}%
    \boolfalse{#1@locked}%
  }%
}
\newcommand*\cs@set@lock[2]{%
  \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}%
  \tud@setbool{#2}{#1}%
}
\newcommand*\bool@std@lock[2]{%
  \ifbool{#1@locked}{}{%
    \tud@setbool{#1}{#2}%
    \boolfalse{#1@locked}%
  }%
}
\newcommand*\bool@set@lock[2]{%
  \tud@setbool{#1}{#2}%
  \booltrue{#1@locked}%
}
\newcommand*\tud@cmd@store[1]{%
  \tud@cmd@check{#1}%
  \ifcsdef{@@tud@#1}{}{\csletcs{@@tud@#1}{#1}}%
}
\newcommand*\tud@cmd@restore[1]{%
  \tud@cmd@check{#1}%
  \ifcsdef{@@tud@#1}{%
    \csletcs{#1}{@@tud@#1}%
    \csundef{@@tud@#1}%
  }{}%
}
\newcommand*\tud@cmd@reset[1]{%
  \tud@cmd@check{#1}%
  \ifcsdef{@@tud@#1}{\csletcs{#1}{@@tud@#1}}{}%
}
\newcommand*\tud@cmd@update[1]{%
  \tud@cmd@check{#1}%
  \ifcsdef{@@tud@#1}{\csletcs{@@tud@#1}{#1}}{}%
}
\newcommand*\tud@cmd@use[1]{%
  \tud@cmd@check{#1}%
  \ifcsdef{@@tud@#1}{%
    \csuse{@@tud@#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%
      Please contact the TUD-Script maintainer\MessageBreak%
      via \tudscrmail. A bugfix is urgently required.%
    }%
  }%
}
\newcommand*\tud@skip@store[1]{%
  \tud@skip@check{#1}{%
    \ifcsdef{@@tud@skip@#1}{}{%
      \csedef{@@tud@skip@#1}{\expandafter\the\csname #1\endcsname}%
    }%
  }%
}
\newcommand*\tud@skip@restore[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]{%
  \tud@skip@check{#1}{%
    \expandafter\setlength\csname #1\endcsname{#2}%
  }%
}
\newcommand*\tud@skip@check[1]{%
  \begingroup%
    \@tempswafalse%
    \expandafter\ifisskip\expandafter{\csname#1\endcsname}{\@tempswatrue}{}%
    \expandafter\ifisdimen\expandafter{\csname#1\endcsname}{\@tempswatrue}{}%
    \if@tempswa%
      \aftergroup\@firstofone%
    \else%
      \aftergroup\@gobble%
    \fi%
  \endgroup%
}
\newcommand*\tud@patch@wrn[1]{%
  \PackageWarning{tudscrbase}{%
    It wasn't possible to patch `\@backslashchar#1'\MessageBreak%
    Please contact the TUD-Script maintainer\MessageBreak%
    via \tudscrmail. Without a bugfix an\MessageBreak%
    erroneous output may occur%
  }%
}
\newcommand*\TUD@parameter@@family{}
\newcommand*\TUD@parameter@family[2]{%
  \xdef\TUD@parameter@@family{#1}%
  #2%
  \gdef\TUD@parameter@@family{}%
}
\newcommand*\TUD@parameter@checkfamily[2]{%
  \ifxblank{#1}{%
    \PackageError{tudscrbase}{%
      No family for \@backslashchar#2 defined%
    }{%
      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.
    }%
  }{}%
}
\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]{%
  \IfArgIsEmpty{#2}{}{%
    \def\@tempb{}%
    \def\@tempa##1{%
      \@expandtwoargs\in@{=}{##1}%
      \ifin@%
        \appto\@tempb{##1,}%
      \else%
        \begingroup
          \let\IeC\@firstofone%
          \def\"####1{####1e}%
          \def\ss{ss}%
          \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@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@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}%
  }{%
    \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@error[2]{%
  \PackageError{tudscrbase}{Unsupported value for parameter `#1'}{%
    `#1' can only be used with values:\MessageBreak#2%
  }%
}
\newcommand*\TUD@UnwindPackage[2]{\AtEndPreamble{\@ifpackageloaded{#1}{}{#2}}}
\newcommand*\TUD@AfterPackage@set[1]{%
  \newbool{@tud@#1@loaded}%
  \AfterPackage!{#1}{\booltrue{@tud@#1@loaded}}%
}
\newcommand*\TUD@AfterPackage@do[2]{%
  \ifcsdef{if@tud@#1@loaded}{%
    \if@atdocument%
      \ifbool{@tud@#1@loaded}{#2}{}%
    \else%
      \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@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'.
