%%
%% This is file `typearea.sty',
%% generated with the docstrip utility, extended by scrdocstrip.
%%
%% The original source files were:
%%
%% scrkernel-version.dtx  (with options: `package,typearea')
%% scrkernel-typearea.dtx  (with options: `package,typearea,identify')
%% scrkernel-basics.dtx  (with options: `load')
%% scrkernel-compatibility.dtx  (with options: `package,typearea,init')
%% scrkernel-typearea.dtx  (with options: `package,typearea,init')
%% scrkernel-compatibility.dtx  (with options: `package,typearea,option')
%% scrkernel-typearea.dtx  (with options: `package,typearea,options')
%% scrkernel-compatibility.dtx  (with options: `package,typearea,body')
%% scrkernel-typearea.dtx  (with options: `package,typearea,body')
%% scrkernel-typearea.dtx  (with options: `package,typearea,final')
%% scrlogo.dtx  (with options: `logo')
%% 
%% Copyright (c) 1994-2017 Markus Kohm [komascript at gmx info]
%% 
%% This file was generated from file(s) of the KOMA-Script bundle.
%% ---------------------------------------------------------------
%% 
%% It may be distributed under the conditions of the
%% LaTeX Project Public License in the version distributed together
%% with KOMA-Script, see file `lppl.txt' or `lppl-de.txt'.
%% 
%% This file may only be distributed together with a copy of the
%% KOMA-Script bundle.  You may however distribute the
%% KOMA-Script bundle without all such generated files.  See also
%% `lppl.txt' or `lppl-de.txt' for additional information.
%% 
%% The list of files belonging to KOMA-Script distribution is given in
%% the file `manifest.txt'.  See also `lppl.txt' or `lppl-de.txt' for
%% additional information.
%% 
%% If this file is a beta version, you may not be allowed to distribute
%% it.  Look at the comments below to see if this is the case.
%% 
%% English and German manuals are part of KOMA-Script bundle.
%% ----------------------------------------------------------
%% 
%% See `README'.
%% 
%% The KOMA-Script bundle (but maybe not this file) was based upon the
%% LaTeX 2.09 Script family created by Frank Neukam 1993 and the LaTeX2e
%% standard classes created by The LaTeX3 Project 1994-1996.  You may
%% find a complete unmodified copy of LaTeX2e at
%% <http://mirror.ctan.org/tex-archive/macros/latex/base/>.
%% 
%%% From File: $Id: scrkernel-version.dtx 2674 2017-09-07 09:35:17Z kohm $
\begingroup
  \catcode`\@11\relax
  \ifx\KOMAScriptVersion\undefined
    \newcommand*{\@CheckKOMAScriptVersion}[1]{%
      \gdef\KOMAScriptVersion{#1}%
    }%
  \else
    \newcommand*{\@CheckKOMAScriptVersion}[1]{%
      \def\@tempa{#1}%
      \ifx\KOMAScriptVersion\@tempa\else
        \@latex@warning@no@line{%
          \noexpand\KOMAScriptVersion\space is
          `\KOMAScriptVersion',\MessageBreak
          but `#1' was expected!\MessageBreak
          You should not use classes, packages or files
          from\MessageBreak
          different KOMA-Script versions%
        }%
      \fi
    }
  \fi
  \@CheckKOMAScriptVersion{2018/03/30 v3.25 KOMA-Script}%
\endgroup
\providecommand*{\scr@pkgextension}{\@pkgextension}
\AtBeginDocument{%
  \let\scr@pkgextension\@pkgextension
}
%%% From File: $Id: scrkernel-typearea.dtx 2959 2018-03-15 13:32:29Z kohm $
%%%            (run: identify)
\NeedsTeXFormat{LaTeX2e}[1995/06/01]
\ProvidesPackage{typearea}[%
  2018/03/30 v3.25 KOMA-Script
  package
  (type area)]
%%% From File: $Id: scrkernel-basics.dtx 2818 2017-12-08 08:31:53Z kohm $
%%%            (run: load)
\RequirePackage{scrkbase}[\KOMAScriptVersion]
%%% From File: $Id: scrkernel-compatibility.dtx 2950 2018-03-05 07:54:19Z kohm $
%%%            (run: init)
\providecommand*
  {\scr@compatibility}{\scr@v@last}
\newcommand*{\scr@ta@compatibility}{\scr@compatibility}
\@namedef{scr@v@first}{0}
\@namedef{scr@v@2.9}{0}
\@namedef{scr@v@2.9t}{0}
\@namedef{scr@v@2.9u}{1}
\@namedef{scr@v@2.95}{2}
\@namedef{scr@v@2.95a}{2}
\@namedef{scr@v@2.95b}{2}
\@namedef{scr@v@2.96}{2}
\@namedef{scr@v@2.96a}{3}
\@namedef{scr@v@2.97}{3}
\@namedef{scr@v@2.97a}{3}
\@namedef{scr@v@2.97b}{3}
\@namedef{scr@v@2.97c}{4}
\@namedef{scr@v@2.97d}{5}
\@namedef{scr@v@2.97e}{6}
\@namedef{scr@v@2.98}{6}
\@namedef{scr@v@2.98a}{6}
\@namedef{scr@v@2.98b}{6}
\@namedef{scr@v@2.98c}{7}
\@namedef{scr@v@3.00}{8}
\@namedef{scr@v@3.01}{8}
\@namedef{scr@v@3.01a}{8}
\@namedef{scr@v@3.01b}{9}
\@namedef{scr@v@3.01c}{9}
\@namedef{scr@v@3.02}{9}
\@namedef{scr@v@3.02b}{9}
\@namedef{scr@v@3.02c}{10}
\@namedef{scr@v@3.03}{10}
\@namedef{scr@v@3.03a}{10}
\@namedef{scr@v@3.03b}{10}
\@namedef{scr@v@3.04}{10}
\@namedef{scr@v@3.04a}{10}
\@namedef{scr@v@3.05}{10}
\@namedef{scr@v@3.05a}{10}
\@namedef{scr@v@3.06}{10}
\@namedef{scr@v@3.07}{10}
\@namedef{scr@v@3.08}{10}
\@namedef{scr@v@3.08a}{10}
\@namedef{scr@v@3.08b}{10}
\@namedef{scr@v@3.09}{10}
\@namedef{scr@v@3.09a}{10}
\@namedef{scr@v@3.10}{10}
\@namedef{scr@v@3.10a}{10}
\@namedef{scr@v@3.10b}{10}
\@namedef{scr@v@3.11}{10}
\@namedef{scr@v@3.11a}{10}
\@namedef{scr@v@3.11b}{10}
\@namedef{scr@v@3.12}{11}
\@namedef{scr@v@3.13}{12}
\@namedef{scr@v@3.13a}{13}
\@namedef{scr@v@3.14}{13}
\@namedef{scr@v@3.15}{14}
\@namedef{scr@v@3.16}{14}
\@namedef{scr@v@3.17}{15}
\@namedef{scr@v@3.17a}{15}
\@namedef{scr@v@3.17c}{15}
\@namedef{scr@v@3.18}{15}
\@namedef{scr@v@3.18a}{15}
\@namedef{scr@v@3.19}{15}
\@namedef{scr@v@3.19a}{15}
\@namedef{scr@v@3.20}{15}
\@namedef{scr@v@3.21}{15}
\@namedef{scr@v@3.22}{16}
\@namedef{scr@v@3.23}{16}
\@namedef{scr@v@3.24}{16}
\@namedef{scr@v@3.25}{17}
\@namedef{scr@v@last}{17}
%%% From File: $Id: scrkernel-typearea.dtx 2959 2018-03-15 13:32:29Z kohm $
%%%            (run: init)
\providecommand\ta@divlist{{}{}{}{}{}{}{}{}{}{8}{10}{12}}
\providecommand\ta@divlistelse{1}
%%% From File: $Id: scrkernel-compatibility.dtx 2950 2018-03-05 07:54:19Z kohm $
%%%            (run: option)
\KOMA@key{version}[last]{%
  \scr@ifundefinedorrelax{scr@v@#1}{%
    \def\scr@compatibility{0}%
    \PackageWarningNoLine{%
      typearea%
    }{%
      You have set option `version' to value `#1', but\MessageBreak
      this value of version is not supported.\MessageBreak
      Because of this, version was set to `first'%
    }%
    \FamilyKeyStateProcessed
    \KOMA@kav@replacevalue{.%
      typearea.\scr@pkgextension
    }{version}{first}%
  }{%
    \PackageInfoNoLine{%
      typearea%
    }{%
      Switching compatibility level to `#1'%
    }%
    \edef\scr@ta@compatibility{\@nameuse{scr@v@#1}}%
    \FamilyKeyStateProcessed
    \KOMA@kav@xreplacevalue{.%
      typearea.\scr@pkgextension
    }{version}{#1}%
  }%
}
\AtEndOfPackage{%
  \KOMA@key{version}[]{%
    \PackageError{%
      typearea%
    }{%
      Option `version' too late%
    }{%
      Option `version' may be set only while loading the
      package.\MessageBreak
      But you've tried to set it up later.%
    }%
    \FamilyKeyStateProcessed
  }%
}
\newcommand*{\scr@ta@v@is@lt}[1]{%
  \scr@ta@compatibility<\@nameuse{scr@v@#1}
}
\newcommand*{\scr@ta@v@is@gt}[1]{%
  \scr@ta@compatibility>\@nameuse{scr@v@#1}
}
\newcommand*{\scr@ta@v@is@le}[1]{%
  \numexpr\scr@ta@compatibility-\@ne <\@nameuse{scr@v@#1}
}
\newcommand*{\scr@ta@v@is@ge}[1]{%
  \numexpr\scr@ta@compatibility+\@ne >\@nameuse{scr@v@#1}
}
%%% From File: $Id: scrkernel-typearea.dtx 2959 2018-03-15 13:32:29Z kohm $
%%%            (run: options)
\providecommand*{\PaperNameToSize}[2][warning]{%
  \ifstr{#2}{letter}{%
    \setlength\paperheight{11in}%
    \setlength\paperwidth {8.5in}%
  }{%
    \ifstr{#2}{legal}{%
      \setlength\paperheight{14in}%
      \setlength\paperwidth {8.5in}%
    }{%
      \ifstr{#2}{executive}{%
        \setlength\paperheight{10.5in}%
        \setlength\paperwidth {7.25in}%
      }{%
        \ifstr{#2}{}{%
          \ISO@PaperNameToSize[#1]{}{}\@nil
        }{%
          \edef\reserved@a{\noexpand\ISO@PaperNameToSize[#1]#2 \noexpand\@nil}%
          \reserved@a
        }%
      }%
    }%
  }%
}
\scr@ifundefinedorrelax{ISO@PaperNameToSize}{%
  \def\ISO@PaperNameToSize[#1]#2#3\@nil{%
    \lowercase{\edef\reserved@a{#2}}%
    \@tempswafalse
    \if \reserved@a a%
      \ifnumber{#3}{%
        \setlength{\paperwidth}{841sp}%
        \setlength{\paperheight}{1189sp}%
        \@tempswatrue
      }{}%
    \else
      \if \reserved@a b%
        \ifnumber{#3}{%
          \setlength{\paperwidth}{1000sp}%
          \setlength{\paperheight}{1414sp}%
          \@tempswatrue
        }{}%
      \else
        \if \reserved@a c%
          \ifnumber{#3}{%
            \setlength{\paperwidth}{917sp}%
            \setlength{\paperheight}{1297sp}%
            \@tempswatrue
          }{}%
        \else
          \if \reserved@a d%
            \ifnumber{#3}{%
              \setlength{\paperwidth}{771sp}%
              \setlength{\paperheight}{1090sp}%
              \@tempswatrue
            }{}%
          \fi
        \fi
      \fi
    \fi
    \if@tempswa
      \@tempcnta=#3\relax
      \@whilenum\@tempcnta>\z@
      \do{\setlength{\@tempdima}{\paperwidth}%
        \setlength{\paperwidth}{.5\paperheight}%
        \setlength{\paperheight}{\@tempdima}%
        \advance\@tempcnta by\m@ne
      }%
      \multiply\paperwidth by186468
      \multiply\paperheight by186468
    \else
      \scr@ifundefinedorrelax{scr@UnknownPaperSize@#1}{%
        \scr@UnknownPaperSize@error{#2#3}%
      }{%
        \@nameuse{scr@UnknownPaperSize@#1}{#2#3}%
      }%
    \fi
  }%
}{}
\providecommand*{\ProvideUnknownPaperSizeError}[1]{%
  \expandafter\providecommand\expandafter*%
  \csname scr@UnknownPaperSize@#1\endcsname[1]%
}
\ProvideUnknownPaperSizeError{error}{%
  \PackageError{%
    typearea%
  }{Unknown paper size #1}{%
    \string\paperwidth\space and \string\paperheight\space stay unchanged,
    because of unknown paper size.%
  }%
}
\ProvideUnknownPaperSizeError{warning}{%
  \PackageWarning{%
    typearea%
  }{%
    \string\paperwidth\space and \string\paperheight\space stay
    unchanged, because\MessageBreak
    of unknown paper size #1%
  }%
}
\ProvideUnknownPaperSizeError{info}{%
  \PackageInfo{%
    typearea
  }{%
    \string\paperwidth\space and \string\paperheight\space stay
    unchanged, because\MessageBreak
    of unknown paper size #1%
  }%
}
\ProvideUnknownPaperSizeError{ignore}{}
\KOMA@DeclareStandardOption[typearea]{a4paper}{paper=a4}
\KOMA@DeclareStandardOption[typearea]{a5paper}{paper=a5}
\KOMA@DeclareStandardOption[typearea]{b5paper}{paper=b5}
\KOMA@DeclareStandardOption[typearea]{letterpaper}{paper=letter}
\KOMA@DeclareStandardOption[typearea]{legalpaper}{paper=legal}
\KOMA@DeclareStandardOption[typearea]{executivepaper}{paper=executive}
\KOMA@DeclareStandardOption[typearea]{landscape}{paper=landscape}
\KOMA@DeclareStandardOption[typearea]{portrait}{paper=portrait}
\KOMA@key{paper}{%
  \ifstr{#1}{seascape}{%
    \@seascapetrue
    \expandafter\ifnum\scr@ta@v@is@ge{3.22}\relax
      \@landscapetrue
      \scr@setpaperorientation
    \else
      \if@landscape\else\scr@switchpapersizes\@landscapetrue\fi
    \fi
    \FamilyKeyStateProcessed
    \KOMA@kav@remove{.typearea.\scr@pkgextension}{paper}{landscape}%
    \KOMA@kav@remove{.typearea.\scr@pkgextension}{paper}{portrait}%
    \KOMA@kav@remove{.typearea.\scr@pkgextension}{paper}{seascape}%
    \KOMA@kav@add{.typearea.\scr@pkgextension}{paper}{seascape}%
  }{%
    \ifstr{#1}{landscape}{%
      \@seascapefalse
      \expandafter\ifnum\scr@ta@v@is@ge{3.22}\relax
        \@landscapetrue
        \scr@setpaperorientation
      \else
        \if@landscape\else\scr@switchpapersizes\@landscapetrue\fi
      \fi
      \FamilyKeyStateProcessed
      \KOMA@kav@remove{.typearea.\scr@pkgextension}{paper}{landscape}%
      \KOMA@kav@remove{.typearea.\scr@pkgextension}{paper}{portrait}%
      \KOMA@kav@remove{.typearea.\scr@pkgextension}{paper}{seascape}%
      \KOMA@kav@add{.typearea.\scr@pkgextension}{paper}{landscape}%
    }{%
      \ifstr{#1}{portrait}{%
        \expandafter\ifnum\scr@ta@v@is@ge{3.22}\relax
          \@landscapefalse
          \scr@setpaperorientation
        \else
          \if@landscape\scr@switchpapersizes\@landscapefalse\fi
        \fi
        \FamilyKeyStateProcessed
        \KOMA@kav@remove{.typearea.\scr@pkgextension}{paper}{landscape}%
        \KOMA@kav@remove{.typearea.\scr@pkgextension}{paper}{portrait}%
        \KOMA@kav@remove{.typearea.\scr@pkgextension}{paper}{seascape}%
        \KOMA@kav@add{.typearea.\scr@pkgextension}{paper}{portrait}%
      }{%
        \ifstr{#1}{letter}{%
          \if@landscape
            \setlength\paperheight{8.5in}%
            \setlength\paperwidth {11in}%
          \else
            \setlength\paperheight{11in}%
            \setlength\paperwidth {8.5in}%
          \fi
          \FamilyKeyStateProcessed
          \KOMA@kav@removekey{.typearea.\scr@pkgextension}{paper}%
          \KOMA@kav@add{.typearea.\scr@pkgextension}{paper}{letter}%
          \KOMA@kav@xadd{.typearea.\scr@pkgextension}{paper}{%
            \if@seascape seascape\else
            \if@landscape landscape\else portrait\fi\fi
          }%
        }{%
          \ifstr{#1}{legal}{%
            \if@landscape
              \setlength\paperheight{8.5in}%
              \setlength\paperwidth {14in}%
            \else
              \setlength\paperheight{14in}%
              \setlength\paperwidth {8.5in}%
            \fi
            \FamilyKeyStateProcessed
            \KOMA@kav@removekey{.typearea.\scr@pkgextension}{paper}%
            \KOMA@kav@add{.typearea.\scr@pkgextension}{paper}{legal}%
            \KOMA@kav@xadd{.typearea.\scr@pkgextension}{paper}{%
              \if@seascape seascape\else
              \if@landscape landscape\else portrait\fi\fi
            }%
          }{%
            \ifstr{#1}{executive}{%
              \if@landscape
                \setlength\paperheight{7.25in}%
                \setlength\paperwidth {10.5in}%
              \else
                \setlength\paperheight{10.5in}%
                \setlength\paperwidth {7.25in}%
              \fi
              \FamilyKeyStateProcessed
              \KOMA@kav@removekey{.typearea.\scr@pkgextension}{paper}%
              \KOMA@kav@add{.typearea.\scr@pkgextension}{paper}{executive}%
              \KOMA@kav@xadd{.typearea.\scr@pkgextension}{paper}{%
                \if@seascape seascape\else
                \if@landscape landscape\else portrait\fi\fi
              }%
            }{%
              \iso@paper{#1}%
              \if@tempswa
                \FamilyKeyStateProcessed
                \KOMA@kav@removekey{.typearea.\scr@pkgextension}{paper}%
                \KOMA@kav@xadd{.typearea.\scr@pkgextension}{paper}{#1}%
                \KOMA@kav@xadd{.typearea.\scr@pkgextension}{paper}{%
                  \if@seascape seascape\else
                  \if@landscape landscape\else portrait\fi\fi
                }%
              \else
                \expandafter\maybe@pair#1::\@nil
                \if@tempswa
                  \FamilyKeyStateProcessed
                  \KOMA@kav@removekey{.typearea.\scr@pkgextension}{paper}%
                  \expandafter\ifnum \scr@ta@v@is@lt{3.01b}\relax
                    \PackageWarningNoLine{typearea}{%
                      You may have to exchange height and width!\MessageBreak
                      Until KOMA-Script version 3.01b the semantic\MessageBreak
                      of option `paper' was `paper=height:width'\MessageBreak
                      instead of `paper=width:height'.\MessageBreak
                      I've switched back to that old interpretation\MessageBreak
                      because of the given compatiblity settings}%
                    \setlength\paperwidth{\@tempb}%
                    \setlength\paperheight{\@tempa}%
                  \else
                    \setlength\paperwidth{\@tempa}%
                    \setlength\paperheight{\@tempb}%
                  \fi
                  \expandafter\ifnum \scr@ta@v@is@lt{3.22}\relax
                    \if@landscape
                      \KOMA@kav@xadd{.typearea.\scr@pkgextension}{paper}{\@tempa:\@tempb}%
                    \else
                      \KOMA@kav@xadd{.typearea.\scr@pkgextension}{paper}{\@tempb:\@tempa}%
                    \fi
                  \else
                    \scr@setpaperorientation
                    \KOMA@kav@xadd{.typearea.\scr@pkgextension}{paper}{%
                      \the\paperwidth:\the\paperheight}%
                  \fi
                  \KOMA@kav@xadd{.typearea.\scr@pkgextension}{paper}{%
                    \if@seascape seascape\else
                    \if@landscape landscape\else portrait\fi\fi
                  }%
                \else
                  \KOMA@unknown@keyval{paper}{#1}{%
                    `letter', `legal', `executive', `a'<nr>, `b'<nr>,
                    `c'<nr>, `d'<nr>,\MessageBreak
                    <width>`:'<height>, `landscape' and `portrait'%
                  }%
                \fi
              \fi
            }%
          }%
        }%
      }%
    }%
  }%
}
\newif\if@seascape
\newif\if@landscape
\newcommand*{\maybe@pair}{}
\def\maybe@pair#1:#2:#3\@nil{%
  \edef\@tempa{#1}\edef\@tempb{#2}%
  \ifx\@tempa\@empty\@tempswafalse\else
    \ifx\@tempb\@empty\@tempswafalse\else\@tempswatrue\fi
  \fi
}
\KOMA@ifkey{usegeometry}{@ta@usegeometry}
\KOMA@key{pagesize}[auto]{%
  \KOMA@set@ncmdkey{pagesize}{@pagesizelast}{%
    {off}{-1},{no}{-1},{false}{-1},%
    {auto}{0},{automedia}{1},{dvips}{2},{pdftex}{3},{luatex}{3},{dvipdfmx}{4}%
  }{#1}%
  \ifx\FamilyKeyState\FamilyKeyStateProcessed
    \ifcase\number\@pagesizelast\relax
      \edef\@pagesizelast{auto}%
      \if@atdocument
        \set@pdftexpagesize
        \set@dvipspagesize
      \fi
    \or
      \edef\@pagesizelast{automedia}%
      \if@atdocument
        \set@pdftexpagesize
        \set@vtexpagesize
        \set@dvipspagesize
      \fi
    \or
      \edef\@pagesizelast{dvips}%
      \if@atdocument
        \set@dvipspagesize
      \fi
    \or
      \edef\@pagesizelast{pdftex}%
      \if@atdocument
        \set@pdftexpagesize
      \fi
    \or
      \edef\@pagesizelast{dvipdfmx}%
      \if@atdocument
        \set@dvipdfmxpagesize
      \fi
    \else
      \edef\@pagesizelast{false}%
    \fi
    \KOMA@kav@xreplacevalue{.typearea.\scr@pkgextension}%
                           {pagesize}{\@pagesizelast}%
  \fi
}
\newcommand\@pagesizelast{auto}
\AtBeginDocument{%
  \KOMAExecuteOptions[.typearea.\scr@pkgextension]{pagesize=\@pagesizelast}%
  \expandafter\ifnum\scr@ta@v@is@gt{3.02b}\relax
    \renewcommand*{\set@dvipspagesize}{%
      \begingroup
        \@tempswafalse
        \scr@ifdvioutput{\@tempswatrue}{%
          \ifnotundefined{if@dvips}{%
            \expandafter\let\csname if@tempswa\expandafter\endcsname
            \csname if@dvips\endcsname
          }{}%
        }%
        \if@tempswa
          \endgroup
          \scr@ifundefinedorrelax{AtNextShipout}{%
            \scr@ifundefinedorrelax{AtBeginShipoutNext}{%
              \begingroup
                \protected@edef\reserved@a{\endgroup
                  \scr@updatedvipspagesize}%
              \reserved@a
            }{%
              \begingroup
                \protected@edef\reserved@a{\endgroup
                  \protect\AtBeginShipoutNext{%
                    \protect\bgroup
                    \protect\global\protect\setbox\AtBeginShipoutBox
                    \protect\vbox{%
                      \scr@updatedvipspagesize
                      \protect\box\AtBeginShipoutBox
                    }%
                    \protect\egroup
                  }}%
              \reserved@a
            }%
          }{%
            \begingroup
              \protected@edef\reserved@a{\endgroup
                \protect\AtNextShipout{%
                  \protect\bgroup
                  \protect\global\protect\setbox\protect\@cclv\protect\vbox{%
                    \scr@updatedvipspagesize
                    \protect\box\protect\@cclv
                  }%
                  \protect\egroup
                }}%
            \reserved@a
          }%
        \else
          \endgroup
        \fi
    }%
  \else
    \let\set@dvipspagesize=\setnot@dvipspagesize
  \fi
  \renewcommand*{\set@dvipdfmxpagesize}{%
    \scr@ifdvioutput{%
      \special{papersize=\the\paperwidth,\the\paperheight}%
    }{}%
  }%
}
\newcommand*{\set@pdftexpagesize}{%
  \scr@ifundefinedorrelax{pdfpagewidth}{%
    \scr@ifundefinedorrelax{pagewidth}{}{\pagewidth=\paperwidth}%
  }{\pdfpagewidth=\paperwidth}%
  \scr@ifundefinedorrelax{pdfpageheight}{%
    \scr@ifundefinedorrelax{pageheight}{}{\pageheight=\paperheight}%
  }{\pdfpageheight=\paperheight}%
}
\newcommand*{\set@dvipspagesize}{%
  \begingroup
    \@tempswafalse
    \scr@ifdvioutput{\@tempswatrue}{%
      \ifnotundefined{if@dvips}{%
        \expandafter\let\csname if@tempswa\expandafter\endcsname
        \csname if@dvips\endcsname
      }{}%
    }{}%
    \scr@ifundefinedorrelax{pr@nextbb}{}{%
      \expandafter\ifx\csname ifPreview\expandafter\endcsname
                      \csname iftrue\endcsname
        \PackageInfo{typearea}{%
          package `preview' with option `tightpage' detected.\MessageBreak
          initial page size special deactivated%
        }%
        \@tempswafalse
      \fi
    }%
    \if@tempswa
      \endgroup
      \AtBeginDvi{%
        \special{papersize=\the\paperwidth,\the\paperheight}%
        \if@seascape\special{! TeXDict begin /landplus90{true}store end }\fi
      }%
      \expandafter\ifnum\scr@ta@v@is@gt{3.02b}\relax
        \let\set@dvipspagesize=\@empty
      \else
        \let\set@dvipspagesize=\setnot@dvipspagesize
      \fi
    \else
    \endgroup
  \fi
}
\newcommand*{\setnot@dvipspagesize}{%
  \scr@ifdvioutput{%
    \PackageWarning{%
      typearea%
    }{%
      With dvi output option `pagesize=auto',\MessageBreak
      `pagesize=automedia' or `pagesize=dvips'\MessageBreak
      may be used only once at preamble.\MessageBreak
      Option ignored%
    }%
  }{}%
}
\newcommand*{\set@dvipdfmxpagesize}{%
  \scr@ifdvioutput{%
    \AtBeginDvi{%
      \special{papersize=\the\paperwidth,\the\paperheight}%
    }%
  }{}%
}
\newcommand*{\set@vtexpagesize}{%
  \ifnotundefined{mediawith}{\mediawidth=\paperwidth}{}%
  \ifnotundefined{mediaheight}{\mediaheight=\paperheight}{}%
}
\newcommand*{\scr@updatedvipspagesize}{%
  \scr@ifundefinedorrelax{XeTeXversion}{%
    \special{ps::\@percentchar\@percentchar
      PageBoundingBox: 0 0 \the\numexpr\paperwidth/\dimexpr 1bp\relax\relax
      \space \the\numexpr\paperheight/\dimexpr 1bp\relax\relax^^J%
      \@percentchar\@percentchar BeginPageSetup^^J%
      << /PageSize [\the\numexpr\paperwidth/\dimexpr 1bp\relax\relax\space
      \the\numexpr\paperheight/\dimexpr 1bp\relax\relax]
      >> setpagedevice^^J%<<
      0 0 bop^^J%
      \@percentchar\@percentchar EndPageSetup}%
  }{}%
}
\KOMA@DeclareStandardOption[typearea]{dvips}{%
  pagesize=automedia%
}
\KOMA@DeclareStandardOption[typearea]{pdftex}{%
  pagesize=pdftex%
}
\newif\if@semitwoside
\g@addto@macro\@twosidetrue\@semitwosidefalse
\g@addto@macro\@twosidefalse\@semitwosidefalse
\KOMA@key{twoside}[true]{%
  \if@atdocument\if@twoside
      \scr@ifundefinedorrelax{cleardoubleoddpage}{%
        \cleardoublepage
      }{%
        \cleardoubleoddpage
      }%
  \else\clearpage\fi\fi
  \ifstr{#1}{semi}{%
    \@twosidetrue
    \@semitwosidetrue
    \FamilyKeyStateProcessed
  }{%
    \def\FamilyElseValue{, `semi'}%
    \KOMA@set@ifkey{twoside}{%
      @twoside%
    }{#1}%
  }%
  \ifx\FamilyKeyState\FamilyKeyStateProcessed
    \KOMA@kav@xreplacevalue{.%
      typearea.\scr@pkgextension
    }{twoside}{#1}%
    \if@twoside
      \if@semitwoside
        \@mparswitchfalse
      \else
        \@mparswitchtrue
      \fi
    \else
      \@mparswitchfalse
    \fi%
    \csname recalctypearea\endcsname
  \fi
}
\KOMA@kav@xadd{.typearea.\scr@pkgextension}{twoside}{%
  \if@twoside true\else false\fi
}
\KOMA@DeclareStandardOption%
  [typearea]%
  {oneside}{twoside=false}
\KOMA@key{twocolumn}[true]{%
  \if@atdocument\clearpage\fi
  \KOMA@set@ifkey{twocolumn}{@twocolumn}{#1}%
  \ifx\FamilyKeyState\FamilyKeyStateProcessed
    \KOMA@kav@replacebool{.%
      typearea.\scr@pkgextension
    }{twocolumn}{@twocolumn}%
    \csname recalctypearea\endcsname
  \fi
}
\KOMA@kav@xadd{.typearea.\scr@pkgextension}{twocolumn}{%
  \if@twocolumn true\else false\fi
}
\KOMA@DeclareStandardOption%
  [typearea]%
  {onecolumn}{twocolumn=false}
\KOMA@key{headlines}{%
  \begingroup
    \setlength{\@tempdima}{#1\baselineskip}%
  \endgroup
  \def\ta@hh{#1\baselineskip}%
  \FamilyKeyStateProcessed
  \KOMA@kav@replacevalue{.typearea.\scr@pkgextension}{headlines}{#1}%
  \KOMA@kav@replacevalue{.typearea.\scr@pkgextension}{headheight}{#1\baselineskip}%
}
\KOMA@key{footlines}{%
  \begingroup
    \setlength{\@tempdima}{#1\baselineskip}%
  \endgroup
  \def\ta@fh{#1\baselineskip}%
  \FamilyKeyStateProcessed
  \KOMA@kav@replacevalue{.typearea.\scr@pkgextension}{footlines}{#1}%
  \KOMA@kav@replacevalue{.typearea.\scr@pkgextension}{footheight}{#1\baselineskip}%
}
\KOMA@key{headheight}{%
  \begingroup
    \setlength{\@tempdima}{#1}%
  \endgroup
  \def\ta@hh{#1}%
  \FamilyKeyStateProcessed
  \KOMA@kav@replacevalue{.typearea.\scr@pkgextension}{headheight}{#1}%
  \KOMA@kav@removekey{.typearea.\scr@pkgextension}{headlines}%
}
\KOMA@key{footheight}{%
  \begingroup
    \setlength{\@tempdima}{#1}%
  \endgroup
  \def\ta@fh{#1}%
  \FamilyKeyStateProcessed
  \KOMA@kav@replacevalue{.typearea.\scr@pkgextension}{footheight}{#1}%
  \KOMA@kav@removekey{.typearea.\scr@pkgextension}{footlines}%
}
\newif\if@hincl\@ifundefined{if@hsl}{}{\let\if@hincl\if@hsl}
\KOMA@ifkey{headinclude}{@hincl}
\KOMA@DeclareDeprecatedOption[typearea]{headexclude}{headinclude=false}
\KOMA@key{headsepline}[true]{%
  \KOMA@set@ifkey{headinclude}{@hincl}{#1}%
  \ifx\FamilyKeyState\FamilyKeyStateProcessed
    \KOMA@kav@replacebool{.typearea.\scr@pkgextension}{headinclude}{@hincl}%
  \fi
}
\newif\if@fincl\@ifundefined{if@fsl}{}{\let\if@fincl\if@fsl}
\KOMA@ifkey{footinclude}{@fincl}
\KOMA@DeclareDeprecatedOption[typearea]{footexclude}{footinclude=false}
\KOMA@key{footsepline}[true]{%
  \KOMA@set@ifkey{footinclude}{@fincl}{#1}%
  \ifx\FamilyKeyState\FamilyKeyStateProcessed
    \KOMA@kav@replacebool{.typearea.\scr@pkgextension}{footinclude}{@fincl}%
  \fi
}
\KOMA@ifkey{mpinclude}{@mincl}
\KOMA@DeclareDeprecatedOption[typearea]{mpexclude}{mpinclude=false}
\newlength{\ta@bcor}
\newcount\ta@div
\KOMA@key{BCOR}{%
  \ifstr{#1}{current}{}{%
    \setlength{\ta@bcor}{#1}%
  }%
  \FamilyKeyStateProcessed
  \KOMA@kav@xreplacevalue{.typearea.\scr@pkgextension}{BCOR}{#1}%
}
\AtEndOfPackage{%
  \KOMA@key{BCOR}{%
    \typearea[{#1}]{last}
    \FamilyKeyStateProcessed
    \KOMA@kav@xreplacevalue{.typearea.\scr@pkgextension}{BCOR}{#1}%
  }%
}
\KOMA@key{DIV}[calc]{%
  \edef\@tempa{#1}%
  \def\@tempb{last}\ifx\@tempa\@tempb\let\@tempa=\@lastdiv\fi
  \def\@tempb{current}\ifx\@tempa\@tempb\else
    \def\@tempb{default}\ifx\@tempa\@tempb\ta@div=\z@ \else
      \def\@tempb{calc}\ifx\@tempa\@tempb\ta@div=\tw@ \else
        \def\@tempb{classic}\ifx\@tempa\@tempb\ta@div=\thr@@ \else
          \ta@div=\@tempa
        \fi
      \fi
    \fi
  \fi
  \FamilyKeyStateProcessed
  \KOMA@kav@xreplacevalue{.typearea.\scr@pkgextension}{DIV}{#1}%
}
\AtEndOfPackage{%
  \KOMA@key{DIV}{%
    \typearea[current]{#1}%
    \FamilyKeyStateProcessed
    \KOMA@kav@xreplacevalue{.typearea.\scr@pkgextension}{DIV}{#1}%
  }%
}
\KOMA@ifkey{areasetadvanced}{@areasetadvanced}
\KOMA@DeclareDeprecatedOption[typearea]{DIVcalc}{DIV=calc}
\KOMA@DeclareDeprecatedOption[typearea]{DIVclassic}{DIV=classic}
\newcommand\isopaper[2][a]{%
  \ISO@PaperNameToSize[typearea]#1#2\@nil
  \expandafter\ifnum\scr@ta@v@is@ge{3.22}\relax
    \scr@setpaperorientation
  \else
    \if@landscape\scr@switchpapersizes\fi
  \fi
}
\ProvideUnknownPaperSizeError{typearea}{%
  \PackageError{typearea}{%
    Unknown ISO/DIN-papersize-letter #1%
  }{%
    There are only four defined paper scalings:\MessageBreak
    a = ISO/DIN-A, b = ISO/DIN-B, c = ISO/DIN-C,
    d = ISO/DIN-D\MessageBreak
    Read KOMA-Script-documentation for further information.%
  }%
  \setlength{\paperwidth}{841sp}%
  \setlength{\paperheight}{1189sp}%
}
\newcommand*\scr@setpaperorientation{%
  \ifdim\paperheight>\paperwidth
    \if@landscape\scr@switchpapersizes\fi
  \else
    \if@landscape\else\scr@switchpapersizes\fi
  \fi
}
\newcommand*\scr@switchpapersizes{%
  \@tempdima\paperwidth\paperwidth\paperheight\paperheight\@tempdima
}
\newcommand*{\iso@paper}[1]{\expandafter\iso@@paper#1\@nil}
\newcommand*{\iso@@paper}{}
\def\iso@@paper#1#2\@nil{%
  \@tempswafalse
  \if #1a\@tempswatrue
  \else\if #1A\@tempswatrue
    \else\if #1b\@tempswatrue
      \else\if #1B\@tempswatrue
        \else\if #1c\@tempswatrue
          \else\if #1C\@tempswatrue
            \else\if #1d\@tempswatrue
              \else\if #1D\@tempswatrue
  \fi\fi\fi\fi\fi\fi\fi\fi
  \if@tempswa
    \ifnumber{#2}{\isopaper[#1]{#2}}{\@tempswafalse}%
  \fi
}
\newcommand*{\@BCOR}{\expandafter\@@BCOR\CurrentOption BCORBCOR\@@BCOR}
\newcommand*{\@@BCOR}{}
\def\@@BCOR #1BCOR#2BCOR#3\@@BCOR{%
  \ifstr{#1}{}{%
    \ifstr{#3}{BCOR}{%
      \ifdimen{#2}{%
        \KOMA@UseDeprecatedOption{%
          \PackageWarningNoLine{typearea}}{BCOR#2}{BCOR=#2}%
      }{\scr@pti@nerr@r}%
    }{\scr@pti@nerr@r}%
  }{\scr@pti@nerr@r}%
}
\newcommand*{\@DIV}{\expandafter\@@DIV\CurrentOption DIVDIV\@@DIV}
\newcommand*{\@@DIV}{}
\def\@@DIV #1DIV#2DIV#3\@@DIV{%
  \edef\@tempa{#1}\ifx\@tempa\@empty
    \edef\@tempa{#3}\def\@tempb{DIV}\ifx\@tempa\@tempb
      \ifnumber{#2}{%
        \KOMA@UseDeprecatedOption{%
          \PackageWarningNoLine{typearea}}{DIV#2}{DIV=#2}%
      }{\scr@pti@nerr@r}%
    \else\scr@pti@nerr@r\fi
  \else\@BCOR\fi
}
\newcommand{\@headlines}{%
  \expandafter\@@headlines\CurrentOption headlines\@@headlines%
}
\newcommand*{\@@headlines}{}
\def\@@headlines #1headlines#2\@@headlines{
  \edef\@tempa{#2}\edef\@tempb{headlines}\ifx\@tempa\@tempb
    \setlength{\@tempdima}{#1\baselineskip}%
    \def\ta@hh{#1\baselineskip}%
  \else\@DIV\fi
}
\newcommand*{\x@paper}{%
  \expandafter\x@@paper\CurrentOption paper\x@@paper%
}
\newcommand*{\x@@paper}{}
\def\x@@paper #1#2paper#3\x@@paper{%
  \ifstr{#3}{paper}{%
    \ifnumber{#2}{%
      \ifstr{#1}{a}{%
        \isopaper[a]{#2}%
      }{%
        \ifstr{#1}{b}{%
          \isopaper[b]{#2}%
        }{%
          \ifstr{#1}{c}{%
            \isopaper[c]{#2}%
          }{%
            \ifstr{#1}{d}{%
              \isopaper[d]{#2}%
            }{\scr@pti@nerr@r}%
          }%
        }%
      }%
    }{\scr@pti@nerr@r}%
  }{%
    \@headlines
  }%
}
\newcommand*{\scr@pti@nerr@r}{
  \@unknownoptionerror
}
\DeclareOption*{%
  \x@paper}
\InputIfFileExists{typearea.cfg}{%
  \typeout{%
    ***************************************^^J%
    * Local config file typearea.cfg used^^J%
    ***************************************%
  }
}{}
\providecommand*{\defaultpapersize}{A4}
\KOMAExecuteOptions{paper=\defaultpapersize,pagesize}
\if@twoside
  \if@semitwoside
    \KOMAExecuteOptions{twoside=semi}
  \else
    \KOMAExecuteOptions{twoside}
  \fi
\else
  \KOMAExecuteOptions{twoside=false}
\fi
\KOMAProcessOptions\relax
%%% From File: $Id: scrkernel-compatibility.dtx 2950 2018-03-05 07:54:19Z kohm $
%%%            (run: body)
%%% From File: $Id: scrkernel-typearea.dtx 2959 2018-03-15 13:32:29Z kohm $
%%%            (run: body)
\newcommand*{\ta@divfor}[1]{%
  \ta@div=\z@
  \expandafter\ifnum\scr@ta@v@is@ge{3.25}\relax
    \ifnum \z@=\ifdim \paperwidth<207mm \z@\else\ifdim \paperwidth>213mm \z@
               \else\ifdim \paperheight<294mm \z@\else
               \ifdim \paperheight>300mm \z@\else \@ne\fi\fi\fi\fi
      \PackageInfoNoLine{typearea}{%
        With paper sizes other than (almost) `A4' predefined\MessageBreak
        DIV values do not exist. Using DIV calculation for good\MessageBreak
        line width (unless using `version=3.24` or prior)%
      }%
      \ta@div=\tw@
    \fi
  \fi
  \if@mincl
    \PackageInfo{typearea}{%
      With option `mpinclude' there are no predefined\MessageBreak
      DIV values. Using DIV calculation for good line\MessageBreak
      width%
    }%
    \ta@div=\tw@
  \fi
  \ifnum \ta@div=\z@
    \xdef\@tempa{\ta@divlist{}}%
    \@tempdima=#1pt
    \addtolength{\@tempdima}{.5\p@}%
    \divide\@tempdima by\p@
    \setlength{\@tempdimb}{\@tempdima}%
    \multiply\@tempdimb by\p@
    \ifdim \@tempdimb=#1pt
      \ta@div=#1\relax
      \@whilenum \ta@div >-9 \do {%
        \ifx\@tempa\empty
        \else \xdef\@tempa{\expandafter\@cdr\@tempa\@nil}\fi
        \advance\ta@div by-1
      }%
    \else
      \let\@tempa\empty
    \fi
    \ifx\@tempa\empty
      \setlength{\@tempdima}{#1\p@}%
      \addtolength{\@tempdima}{10\p@}%
      \PackageWarningNoLine{typearea}{%
        DIV for \the\@tempdima\space and used papersize\MessageBreak
        not defined!\MessageBreak
        Using DIV=\ifnum\number\ta@divlistelse>\m@ne
          \ifcase \ta@divlistelse default%
          \or calc%
          \or calc%
          \or classic%
          \else\ta@divlistelse\fi\else\ta@divlistelse\fi
      }%
      \ta@div=\ta@divlistelse\relax
    \else
      \xdef\@tempa{\expandafter\@car\@tempa\@nil}%
      \ifx\@tempa\empty
        \ta@div=\ta@divlistelse\relax
      \else
        \ta@div=\@tempa\relax
      \fi
    \fi
  \fi
}
\newcommand*\SetDIVList[1]{%
  \PackageWarning{typearea}{\string\SetDIVList\space is
    deprecated!\MessageBreak
    This command supports only integer font sizes\MessageBreak
    in pt equal or greater than 10pt.\MessageBreak
    Since version 2.6 the command is implemented\MessageBreak
    for compatibility only. You should not use it\MessageBreak
    any longer}%
  \def\ta@divlist{{}{}{}{}{}{}{}{}{}#1}}
\newcommand*\SetXDIVList[1]{%
  \PackageWarning{typearea}{\string\SetXDIVList\space is
    deprecated!\MessageBreak
    This command supports only integer font sizes\MessageBreak
    in pt equal or greater than 10pt.\MessageBreak
    Since version 3.0 the command is implemented\MessageBreak
    for compatibility only. You should not use it\MessageBreak
    any longer}%
  \def\ta@divlist{#1}}
\newlength{\ta@hblk}
\newlength{\ta@vblk}
\newlength{\ta@temp}
\newcommand*\@typearea{%
  \selectfont
  \ta@hblk=\paperwidth
  \advance \ta@hblk by-\ta@bcor
  \divide\ta@hblk by\ta@div
  \if@mincl
    \marginparwidth=\ta@hblk
    \advance\marginparwidth by-\marginparsep
  \else
    \if@twoside
      \if@semitwoside
        \marginparwidth=\ta@hblk
      \else
        \marginparwidth=1.5\ta@hblk
      \fi
    \else
      \marginparwidth=\ta@hblk
    \fi
  \fi
  \oddsidemargin=-1in
  \evensidemargin=-1in
  \if@twoside
    \if@semitwoside
      \advance\oddsidemargin by1.5\ta@hblk
      \advance\oddsidemargin by\ta@bcor
      \expandafter\ifnum\scr@ta@v@is@lt{3.12}\relax
        \evensidemargin=\oddsidemargin
      \else
        \advance\evensidemargin by1.5\ta@hblk
      \fi
    \else
      \advance\oddsidemargin by\ta@hblk
      \advance\oddsidemargin by\ta@bcor
      \advance\evensidemargin by2\ta@hblk
      \if@mincl
        \advance\evensidemargin by\marginparwidth
        \advance\evensidemargin by\marginparsep
      \fi
    \fi
  \else
    \advance\oddsidemargin by1.5\ta@hblk
    \advance\oddsidemargin by\ta@bcor
    \evensidemargin=\oddsidemargin
  \fi
  \textwidth=\paperwidth
  \advance\textwidth by-\ta@bcor
  \advance\textwidth by-3\ta@hblk
  \if@mincl
    \advance\textwidth by-\marginparwidth
    \advance\textwidth by-\marginparsep
    \ifdim\textwidth <\marginparwidth
      \PackageWarningNoLine{typearea}{%
        Width of text (\the\textwidth) less than width of\MessageBreak
        marginpar (\the\marginparwidth) while using option\MessageBreak
        `mpinclude'.\MessageBreak
        Because of this, I'm exchanging the values.\MessageBreak
        You should increase DIV to avoid such problems.\MessageBreak
      }%
      \@tempskipa=\marginparwidth
      \marginparwidth=\textwidth
      \textwidth=\@tempskipa
    \fi
  \fi
  \ta@vblk=\paperheight
  \divide\ta@vblk by\ta@div
  \topmargin=-1in
  \advance\topmargin by\ta@vblk
  \if@hincl \else
    \advance\topmargin by-\headheight
    \advance\topmargin by-\headsep
  \fi
  \ta@temp=\paperheight
  \advance\ta@temp by-3\ta@vblk
  \if@hincl
    \advance\ta@temp by-\headheight
    \advance\ta@temp by-\headsep
  \fi
  \if@fincl
    \advance\ta@temp by-\footskip
  \fi
  \scr@ifundefinedorrelax{@ptsize}{%
    \topskip=\f@size\p@
  }{%
    \topskip=\@ptsize\p@
    \advance\topskip by 10\p@
  }%
  \maxdepth=.5\topskip
  \textheight=\topskip
  \@whiledim\textheight <\ta@temp
  \do{\advance\textheight by\baselineskip}%
}
\newcommand*\ta@modiv[2]{
  \setlength{\@tempdima}{#1}
  \divide\@tempdima by#2
  \ta@div\@tempdima
  \ifnum \ta@div<4
    \ta@div=4
  \else
    \setlength{\@tempdimb}{#1}%
    \divide\@tempdimb by\ta@div
    \addtolength{\@tempdima}{\@tempdima}%
    \addtolength{\@tempdima}{-\@tempdimb}%
    \advance\ta@div by\@ne
    \setlength{\@tempdimb}{#1}%
    \divide\@tempdimb by\ta@div
    \ifdim \@tempdima<\@tempdimb
      \advance\ta@div by\m@ne
    \fi
  \fi
}
\newcommand*\ta@temp@goodwidth{%
  \settowidth{\ta@temp}{\normalfont\normalsize
    abcdefghijklmnopqrstuvwxyz}%
  \ifdim\ta@temp >200\p@
    \setlength{\ta@temp}{2.53846\ta@temp}%
    \settowidth{\@tempdima}{\normalfont\normalsize
      ABCDEFGHIJKLMNOPQRSTUVWXYZ}%
    \setlength{\@tempdima}{.11538\@tempdima}%
    \addtolength{\ta@temp}{\@tempdima}%
  \else
    \multiply\ta@temp by66
    \settowidth{\@tempdima}{\normalfont\normalsize
      ABCDEFGHIJKLMNOPQRSTUVWXYZ}%
    \multiply\@tempdima by3
    \addtolength{\ta@temp}{\@tempdima}%
    \divide\ta@temp by26
  \fi
}
\newcommand*{\AfterCalculatingTypearea}{%
  \kernel@ifstar \l@addto@macro \g@addto@macro \@typearea@end
}
\newcommand*{\@typearea@end}{}
\newcommand*{\activateareas}{%
  \if@atdocument
    \PackageInfo{typearea}{%
      Using dirty hack to recalculate internal output\MessageBreak
      dimensions of LaTeX%
    }%
    \@colht=\textheight
    \@colroom=\textheight
    \vsize=\textheight
    \columnwidth=\textwidth
    \if@twocolumn
      \advance\columnwidth by-\columnsep
      \divide\columnwidth by\tw@
      \hsize=\columnwidth
      \@firstcolumntrue
    \fi
    \hsize=\columnwidth
    \linewidth\hsize
    \scr@ifundefinedorrelax{@pagesizelast}{}{%
      \KOMAoptions{pagesize=\@pagesizelast}%
    }%
    \expandafter\ifnum\scr@ta@v@is@ge{3.17}%
      \csname par@updaterelative\endcsname
    \fi
  \fi
  \edef\scr@geometryargs{%
    bindingoffset=\the\ta@bcor,
    lmargin=\the\dimexpr 1in+\oddsidemargin-\ta@bcor\relax,
    textwidth=\the\textwidth,
    \if@hincl
      includehead,%
      top=\the\dimexpr 1in+\topmargin\relax,
    \else
      includehead=false,%
      top=\the\dimexpr 1in+\topmargin+\headheight+\headsep\relax,
    \fi
    headheight=\the\headheight,
    headsep=\the\headsep,
    textheight=\the\textheight,
    \if@fincl
      includefoot,
    \else
      includefoot=false,
    \fi
    footskip=\the\footskip,
    \if@mincl
      includemp,
    \else
      includemp=false,
    \fi
    marginparwidth=\the\marginparwidth,
    marginparsep=\the\marginparsep
  }%
  \if@ta@usegeometry
    \@ifundefined{Gm@save}{%
      \if@atdocument\else
        \edef\scr@geometryargs{%
          paperwidth=\the\paperwidth,paperheight=\the\paperheight,%
          \scr@geometryargs
        }%
        \PassOptionsToPackage{\scr@geometryargs}{geometry}%
      \fi
    }{%
      \edef\Gm@restore@org{\Gm@restore}%
      \if@atdocument
        \expandafter\newgeometry\expandafter{\scr@geometryargs}%
      \else
        \edef\scr@geometryargs{%
          paperwidth=\the\paperwidth,paperheight=\the\paperheight,%
          \scr@geometryargs
        }%
        \expandafter\geometry\expandafter{\scr@geometryargs}%
      \fi
    }%
  \fi
}
\newcommand*{\scr@geometryargs}{}
\newcommand*\typearea[2][\z@]{%
  \scr@grouplevel@test\typearea
  \edef\@tempa{#1}\edef\@tempb{current}\ifx\@tempa\@tempb\else
    \setlength{\ta@bcor}{#1}%
  \fi
  \edef\@tempa{#2}%
  \def\@tempb{last}\ifx\@tempa\@tempb\let\@tempa=\@lastdiv
    \ifx\csname @tempa\endcsname\relax
      \def\@tempa{current}%
    \fi
  \fi
  \def\@tempb{areaset}\ifx\@tempa\@tempb
    \areaset[current]{\textwidth}{\textheight}%
  \else
    \def\@tempb{current}\ifx\@tempa\@tempb\else
      \def\@tempb{default}\ifx\@tempa\@tempb\ta@div=\z@ \else
        \def\@tempb{calc}\ifx\@tempa\@tempb\ta@div=\tw@ \else
          \def\@tempb{classic}\ifx\@tempa\@tempb\ta@div=\thr@@ \else
            \ta@div=\@tempa
          \fi
        \fi
      \fi
    \fi
    \edef\@lastdiv{\the\ta@div}%
    \if@atdocument\newpage\fi
    \normalsize
    \@ifundefined{ta@hh}{%
      \headheight=1.25\baselineskip
    }{%
      \headheight=\ta@hh
    }%
    \headsep=1.5\baselineskip
    \@ifundefined{footheight}{%
      \newlength\footheight
    }{}%
    \@ifundefined{ta@fh}{%
      \footheight=1.25\baselineskip
    }{%
      \footheight=\ta@fh
    }%
    \footskip=\dimexpr\footheight+2.25\baselineskip
    \marginparsep=1cc
    \marginparpush=0.45\baselineskip
    \ifnum\ta@div=\z@
      \@ifundefined{@ptsize}{%
        \@tempdima=\f@size\p@
        \advance\@tempdima by.5pt
        \ta@div=\@tempdima
        \divide\ta@div by65536
        \advance\ta@div by-10
        \xdef\@ptsize{\the\ta@div}%
        \PackageWarningNoLine{typearea}{%
          \string\@ptsize\space not defined!\MessageBreak
          Fontsize is \f@size pt.\MessageBreak
          Defining \string\@ptsize\space to \@ptsize%
        }%
      }{}%
      \ta@divfor{\@ptsize}%
    \fi
    \ifnum\ta@div=3
      \typeout{DIV calculation for classic typearea.}%
      \setlength{\ta@temp}{\paperwidth}%
      \addtolength{\ta@temp}{-\ta@bcor}%
      \if@hincl\else
        \addtolength{\ta@temp}{\headheight}%
        \addtolength{\ta@temp}{\headsep}%
      \fi
      \if@fincl\else
        \addtolength{\ta@temp}{\footskip}%
      \fi
      \ifdim \ta@temp >\paperheight
        \PackageWarningNoLine{typearea}{%
          No classic typearea with this papersize!\MessageBreak
          Using calculated DIV%
        }%
        \ta@div=\@ne
      \else
        \setlength{\ta@temp}{\paperheight}%
        \addtolength{\ta@temp}{-\paperwidth}%
        \addtolength{\ta@temp}{\ta@bcor}%
        \divide\ta@temp by3
        \ta@modiv{\paperheight}{\ta@temp}%
      \fi
    \fi
    \ifnum\ta@div <4
      \typeout{DIV calculation for typearea with good linewidth.}%
      \setlength{\textwidth}{\paperwidth}%
      \addtolength{\textwidth}{-\ta@bcor}%
      \ta@temp@goodwidth
      \if@twocolumn
        \addtolength{\ta@temp}{\ta@temp}%
        \addtolength{\ta@temp}{\columnsep}%
      \fi
      \setlength{\ta@hblk}{\paperwidth}%
      \addtolength{\ta@hblk}{-\ta@temp}%
      \divide\ta@hblk by3
      \ifdim \ta@hblk <\z@
        \setlength{\ta@hblk}{5mm}%
      \fi
      \if@mincl
        \setlength{\ta@temp}{.75\ta@hblk}%
      \else
        \setlength{\ta@temp}{\ta@hblk}%
      \fi
      \ta@modiv{\paperwidth}{\ta@temp}%
      \@typearea
      \setlength{\ta@temp}{-1in}%
      \addtolength{\ta@temp}{5mm}%
      \ifdim\topmargin <\ta@temp
        \setlength{\ta@temp}{15mm}%
        \if@hincl\else
          \addtolength{\ta@temp}{\headheight}%
          \addtolength{\ta@temp}{\headsep}%
        \fi
        \if@fincl\else
          \addtolength{\ta@temp}{\footskip}%
        \fi
        \divide\ta@temp by3
        \ta@modiv{\paperheight}{\ta@temp}%
      \fi
    \fi
    \@typearea
    \ta@temp@goodwidth
    \if@twocolumn
      \addtolength{\ta@temp}{\ta@temp}%
      \addtolength{\ta@temp}{\columnsep}%
    \fi
    \setlength{\@tempdima}{\ta@temp}%
    \addtolength{\ta@temp}{-\textwidth}%
    \divide\@tempdima by100
    \divide\ta@temp by\@tempdima
    \@tempcnta=\ta@temp
    \ifnum\@tempcnta <5
      \ifnum\@tempcnta >-5
        \@tempcnta=0
      \else
        \advance\@tempcnta by4
      \fi
    \else
      \advance\@tempcnta by-4
    \fi
    \ifnum\@tempcnta <-15
      \@tempcnta=-\@tempcnta
      \PackageWarningNoLine{typearea}{%
        Bad type area settings!\MessageBreak
        The detected line width is about
        \the\@tempcnta\@percentchar\MessageBreak
        larger than the heuristically detected line width.\MessageBreak
        You should e.g. decrease DIV, increase fontsize\MessageBreak
        or change papersize%
      }%
      \@tempcnta=-\@tempcnta
    \else
      \ifnum\@tempcnta>15
        \PackageWarningNoLine{typearea}{%
          Maybe no optimal type area settings!\MessageBreak
          The maximum limit of line width is about
          \the\@tempcnta\@percentchar\MessageBreak
          larger than the heuristically detected line width.\MessageBreak
          You may e.g. increase DIV, decrease fontsize\MessageBreak
          or change the papersize%
        }
    \fi\fi
    \ifnum\ta@div <6
      \PackageWarningNoLine{typearea}{%
        Very low DIV value!\MessageBreak
        DIV values less than 6 result in textwidth/-height\MessageBreak
        smaller than total marginwidth/-height.\MessageBreak
        You should e.g. increase DIV, increase fontsize or\MessageBreak
        change papersize%
      }
    \fi
    \ta@layoutinfo{\number\ta@div}{\the\@tempcnta}%
    \KOMA@kav@removekey{.typearea.\scr@pkgextension}{DIV}%
    \KOMA@kav@xadd{.typearea.\scr@pkgextension}{DIV}{\@lastdiv}%
    \KOMA@kav@removekey{.typearea.\scr@pkgextension}{BCOR}%
    \KOMA@kav@xadd{.typearea.\scr@pkgextension}{BCOR}{\the\ta@bcor}%
    \@typearea@end
    \activateareas
    \ifdim \dimexpr 1in+\topmargin
                   +\headheight+\headsep
                   +\textheight
                   +\footskip+\dp\strutbox\relax
           >\paperheight
      \PackageWarningNoLine{typearea}{%
        page content and margins higher than paper.\MessageBreak
        This may result in page footer out of paper.\MessageBreak
        You should decrease DIV, decrease foot height,\MessageBreak
        or include footer into type area%
      }%
    \fi
  \fi
}
\newcommand*{\ta@layoutinfo}[2]{%
  \PackageInfo{typearea}{%
    These are the values describing the layout:\MessageBreak
    DIV\space\space=\space#1\MessageBreak
    BCOR\space=\space\the\ta@bcor\MessageBreak
    \string\paperwidth\space\space\space\space\space\space=%
                         \space\the\paperwidth\MessageBreak
    \space\string\textwidth\space\space\space\space\space\space=%
                         \space\the\textwidth\MessageBreak
    \ifx\relax#2\relax\else
      \space DIV departure\space\space\space=%
                           \space#2\@percentchar\MessageBreak
    \fi
    \space\string\evensidemargin\space=%
                         \space\the\evensidemargin\MessageBreak
    \space\string\oddsidemargin\space\space=%
                           \space\the\oddsidemargin\MessageBreak
    \string\paperheight\space\space\space\space\space=%
                         \space\the\paperheight\MessageBreak
    \space\string\textheight\space\space\space\space\space=%
                         \space\the\textheight\MessageBreak
    \space\string\topmargin\space\space\space\space\space\space=%
                         \space\the\topmargin\MessageBreak
    \space\string\headheight\space\space\space\space\space=%
                         \space\the\headheight\MessageBreak
    \space\string\headsep\space\space\space\space\space\space\space\space=%
                         \space\the\headsep\MessageBreak
    \space\string\topskip\space\space\space\space\space\space\space\space=%
                         \space\the\topskip\MessageBreak
    \space\string\footskip\space\space\space\space\space\space\space=%
                         \space\the\footskip\MessageBreak
    \space\string\baselineskip\space\space\space=%
                         \space\the\baselineskip\MessageBreak
  }%
}
\AtEndOfPackage{\newcommand*{\recalctypearea}{\typearea[current]{last}}}
\newcommand*{\scr@grouplevel@test}[1]{%
  \ifcase\currentgrouptype\else
    \PackageWarning{typearea}{%
      \string#1\space used at group level
      \the\currentgrouplevel.\MessageBreak
      Using \string#1\space inside any group, e.g.\MessageBreak
      environments, math mode, boxes, etc. may result in\MessageBreak
      many type setting problems.\MessageBreak
      You should move the command \string#1\MessageBreak
      outside all groups%
    }%
  \fi
}
\newcommand*{\storeareas}[1]{%
  \edef\reserved@a{%
    \noexpand\newcommand*{\unexpanded{#1}}{%
      \noexpand\scr@grouplevel@test\unexpanded{#1}%
      \noexpand\csname scr@storeareas@before@hook\noexpand\endcsname
      \unexpanded\expandafter\expandafter\expandafter{%
        \csname scr@storeareas@before@current@hook\endcsname}%
      \noexpand\paperheight=\the\paperheight\space
      \noexpand\paperwidth=\the\paperwidth\space
      \noexpand\topmargin=\the\topmargin\space
      \noexpand\headheight=\the\headheight\space
      \noexpand\headsep=\the\headsep\space
      \noexpand\textheight=\the\textheight\space
      \noexpand\vsize=\the\vsize\space
      \noexpand\footskip=\the\footskip\space
      \noexpand\@colht=\the\@colht\space
      \noexpand\@colroom=\the\@colroom\space
      \noexpand\textwidth=\the\textwidth\space
      \noexpand\columnwidth=\the\columnwidth\space
      \noexpand\hsize=\the\hsize\space
      \noexpand\oddsidemargin=\the\oddsidemargin\space
      \noexpand\evensidemargin=\if@twoside
        \the\evensidemargin
      \else
        \the\oddsidemargin
      \fi\space
      \noexpand\linewidth=\the\linewidth\space
      \noexpand\maxdepth=\the\maxdepth\space
      \scr@ifundefinedorrelax{@pagesizelast}{}{%
        \noexpand\KOMAoptions{pagesize=\@pagesizelast}}%
      \noexpand\ta@div=\the\ta@div\space
      \noexpand\ta@bcor=\the\ta@bcor\space
      \noexpand\def\noexpand\@lastdiv{\@lastdiv}%
      \noexpand\marginparsep=\the\marginparsep\space
      \noexpand\marginparwidth=\the\marginparwidth\space
      \noexpand\def
      \expandafter\noexpand\csname scr@kav@KOMA.typearea.\scr@pkgextension\endcsname{%
        \unexpanded\expandafter\expandafter\expandafter{%
          \csname scr@kav@KOMA.typearea.\scr@pkgextension\endcsname}%
      }%
      \unexpanded\expandafter\expandafter\expandafter{%
        \csname scr@storeareas@after@current@hook\endcsname}%
      \noexpand\csname scr@storeareas@after@hook\noexpand\endcsname
    }%
  }%
  \reserved@a
}
\newcommand*{\BeforeRestoreareas}{%
  \kernel@ifstar{\scr@storeareashook{before@current}}%
                {\scr@storeareashook{before}}%
}
\newcommand*{\AfterRestoreareas}{%
  \kernel@ifstar{\scr@storeareashook{after@current}}%
                {\scr@storeareashook{after}}%
}
\newcommand*{\scr@storeareashook}[2]{%
  \expandafter\l@addto@macro\csname scr@storeareas@#1@hook\endcsname{#2}%
}
\newcommand*{\scr@storeareas@before@hook}{}
\newcommand*{\scr@storeareas@before@current@hook}{}
\newcommand*{\scr@storeareas@after@hook}{}
\newcommand*{\scr@storeareas@after@current@hook}{}
\newcommand*\areaset[3][\z@]{%
  \edef\@tempa{#1}\edef\@tempb{current}\ifx\@tempa\@tempb\else
    \setlength{\ta@bcor}{#1}%
  \fi
  \if@atdocument\newpage\fi
  \setlength{\textwidth}{#2}%
  \setlength{\textheight}{#3}%
  \def\@lastdiv{areaset}%
  \KOMA@kav@removekey{.typearea.\scr@pkgextension}{DIV}%
  \KOMA@kav@add{.typearea.\scr@pkgextension}{DIV}{areaset}%
  \KOMA@kav@removekey{.typearea.\scr@pkgextension}{BCOR}%
  \KOMA@kav@add{.typearea.\scr@pkgextension}{BCOR}{\the\ta@bcor}%
  \ta@hblk=\paperwidth
  \advance\ta@hblk by-\ta@bcor
  \advance\ta@hblk by-\textwidth
  \if@areasetadvanced
    \if@mincl
      \divide\ta@hblk by4
    \else
      \divide\ta@hblk by3
    \fi
  \else
    \divide\ta@hblk by3
  \fi
  \oddsidemargin=-1in
  \evensidemargin=-1in
  \if@twoside
    \if@semitwoside
      \advance\oddsidemargin by1.5\ta@hblk
      \advance\oddsidemargin by\ta@bcor
      \expandafter\ifnum\scr@ta@v@is@lt{3.12}\relax
        \evensidemargin=\oddsidemargin
      \else
        \advance\evensidemargin by1.5\ta@hblk
      \fi
    \else
      \advance\oddsidemargin by\ta@hblk
      \advance\oddsidemargin by\ta@bcor
      \advance\evensidemargin by2\ta@hblk
    \fi
  \else
    \advance\oddsidemargin by1.5\ta@hblk
    \advance\oddsidemargin by\ta@bcor
    \evensidemargin\oddsidemargin
  \fi
  \scr@ifundefinedorrelax{@ptsize}{%
    \topskip=\f@size\p@
  }{%
    \topskip=\@ptsize\p@
    \advance\topskip by 10\p@
  }%
  \if@areasetadvanced
    \normalsize
    \@ifundefined{ta@hh}{%
      \headheight=1.25\baselineskip
    }{%
      \headheight=\ta@hh
    }%
  \else
    \headheight=15\p@
    \advance\headheight by\f@size\p@
    \advance\headheight by-10\p@
  \fi
  \headsep=1.5\baselineskip
  \@ifundefined{footheight}{\newlength\footheight}{}
  \if@areasetadvanced
    \@ifundefined{ta@fh}{%
      \footheight=1.25\baselineskip
      \footskip=3.5\baselineskip
    }{%
      \footheight=\ta@fh
      \footskip=\dimexpr \footheight+2.25\baselineskip\relax
    }%
  \else
    \footheight=1.25\baselineskip
    \footskip=3.5\baselineskip
  \fi
  \ta@vblk=\paperheight
  \advance\ta@vblk by-\textheight
  \divide\ta@vblk by3
  \if@hincl
    \advance\textheight by-\headheight
    \advance\textheight by-\headsep
  \fi
  \if@fincl
    \advance\textheight by-\footskip
  \fi
  \topmargin=-1in
  \advance\topmargin by\ta@vblk
  \if@hincl \else
    \advance\topmargin by-\headheight
    \advance\topmargin by-\headsep
  \fi
  \if@twoside
    \if@semitwoside
      \marginparwidth=\ta@hblk
    \else
      \marginparwidth=1.5\ta@hblk
    \fi
  \else
    \marginparwidth=\ta@hblk
  \fi
  \marginparsep=1cc
  \if@areasetadvanced
    \if@mincl
      \marginparwidth=\ta@hblk
      \if@twoside\if@semitwoside\else
          \advance\evensidemargin by\marginparwidth
      \fi\fi
      \advance\marginparwidth by-\marginparsep
    \fi
  \fi
  \marginparpush=0.45\baselineskip
  \ta@layoutinfo{areaset}{}%
  \@areaset@end
  \activateareas
  \ifdim \dimexpr 1in+\topmargin
                 +\headheight+\headsep
                 +\textheight
                 +\footskip+\footheight-\ht\strutbox\relax
         >\paperheight
    \PackageWarningNoLine{typearea}{%
      page content and margins higher than paper.\MessageBreak
      This may result in page footer out of paper.\MessageBreak
      You should decrease DIV, decrease foot height,\MessageBreak
      or decreate height of text area%
    }%
  \fi
}
\newcommand*{\AfterSettingArea}{%
  \kernel@ifstar \l@addto@macro \g@addto@macro \@areaset@end
}
\newcommand*{\@areaset@end}{}
%%% From File: $Id: scrkernel-typearea.dtx 2959 2018-03-15 13:32:29Z kohm $
%%%            (run: final)
\typearea[current]{current}
%%% From File: $Id: scrlogo.dtx 2640 2017-05-08 09:36:55Z kohm $
\@ifundefined{KOMAScript}{%
  \DeclareRobustCommand{\KOMAScript}{\textsf{K\kern.05em O\kern.05em%
      M\kern.05em A\kern.1em-\kern.1em Script}}}{}
\endinput
%%
%% End of file `typearea.sty'.
