summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/koma-script/scrhack.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex/contrib/koma-script/scrhack.dtx')
-rw-r--r--macros/latex/contrib/koma-script/scrhack.dtx1954
1 files changed, 1954 insertions, 0 deletions
diff --git a/macros/latex/contrib/koma-script/scrhack.dtx b/macros/latex/contrib/koma-script/scrhack.dtx
new file mode 100644
index 0000000000..a656ed6fa3
--- /dev/null
+++ b/macros/latex/contrib/koma-script/scrhack.dtx
@@ -0,0 +1,1954 @@
+% \iffalse meta-comment
+% ======================================================================
+% scrhack.dtx
+% Copyright (c) Markus Kohm, 2008-2022
+%
+% This file is part of the LaTeX2e KOMA-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
+% version 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 Markus Kohm.
+%
+% This work consists of all files listed in MANIFEST.md.
+%
+% To create `scrhack.sty' run `tex scrhack.dtx'. Using LaTeX instead
+% of TeX would generate the implementation documentation.
+% ======================================================================
+%%% From File: $Id: scrhack.dtx 3889 2022-06-09 12:11:14Z kohm $
+%<package&identify>%%% using: package,identify
+%<package&option>%%% using: package,option
+%<package&body>%%% using: package,body
+%<package&identity>\NeedsTeXFormat{LaTeX2e}[1995/06/01]
+%<*dtx>
+\ifx\ProvidesFile\undefined\def\ProvidesFile#1[#2]{}\fi
+\begingroup
+ \def\filedate$#1: #2-#3-#4 #5${\gdef\filedate{#2/#3/#4}}
+ \filedate$Date: 2022-06-09 14:11:14 +0200 (Do, 09. Jun 2022) $
+ \def\filerevision$#1: #2 ${\gdef\filerevision{r#2}}
+ \filerevision$Revision: 3889 $
+\endgroup
+\ProvidesFile{scrhack.dtx}[\filedate\space\filerevision\space
+%</dtx>
+%<package&identify>\ProvidesPackage{scrhack}[%
+%<hyperref&identify>\ProvidesFile{hyperref.hak}[%
+%<float&identify>\ProvidesFile{float.hak}[%
+%<floatrow&identify>\ProvidesFile{floatrow.hak}[%
+%<listings&identify>\ProvidesFile{listings.hak}[%
+%<setspace&identify>\ProvidesFile{setspace.hak}[%
+%<lscape&identify>\ProvidesFile{lscape.hak}[%
+%<nomencl&identify>\ProvidesFile{nomencl.hak}[%
+%<standardsections&identify>\ProvidesFile{standardsections.hak}[%
+%<*dtx|identify>
+%!KOMAScriptVersion
+%<*dtx>
+ source of
+%</dtx>
+%<*dtx|package>
+ package (hacking other packages)%
+%</dtx|package>
+%<*hack>
+%<hack> scrhack part
+%<!standardsections> (hacking package
+%<hyperref&identify> hyperref)%
+%<float&identify> float)%
+%<floatrow&identify> floatrow)%
+%<listings&identify> listings)%
+%<setspace&identify> setspace)%
+%<lscape&identify> lscape)%
+%<nomencl&identify> nomencl)%
+%<standardsections&identify> (defining standard LaTeX class section headings)%
+%</hack>
+]
+%</dtx|identify>
+%<*dtx>
+\ifx\documentclass\undefined
+ \input scrdocstrip.tex
+ \@@input scrkernel-version.dtx
+ \@@input scrstrip.inc
+ \KOMAdefVariable{COPYRIGHTFROM}{2008}
+ \generate{\usepreamble\defaultpreamble
+ \file{scrhack.sty}{%
+ \from{scrkernel-version.dtx}{package,scrhack}%
+ \from{scrhack.dtx}{package,identify}%
+ \from{scrkernel-basics.dtx}{load}%
+ \from{scrhack.dtx}{package,option}%
+ \from{scrhack.dtx}{package,body}%
+ \from{scrlogo.dtx}{logo}%
+ }%
+ \file{hyperref.hak}{%
+ \from{scrkernel-version.dtx}{file,hyperref.hak}%
+ \from{scrhack.dtx}{hack,hyperref,identify}%
+ \from{scrhack.dtx}{hack,hyperref,body}%
+ }%
+ \file{float.hak}{%
+ \from{scrkernel-version.dtx}{file,float.hak}%
+ \from{scrhack.dtx}{hack,float,identify}%
+ \from{scrhack.dtx}{hack,float,body}%
+ }%
+ \file{floatrow.hak}{%
+ \from{scrkernel-version.dtx}{file,floatrow.hak}%
+ \from{scrhack.dtx}{hack,floatrow,identify}%
+ \from{scrhack.dtx}{hack,floatrow,body}%
+ }%
+ \file{listings.hak}{%
+ \from{scrkernel-version.dtx}{file,listings.hak}%
+ \from{scrhack.dtx}{hack,listings,identify}%
+ \from{scrhack.dtx}{hack,listings,body}%
+ }%
+ \file{setspace.hak}{%
+ \from{scrkernel-version.dtx}{file,setspace.hak}%
+ \from{scrhack.dtx}{hack,setspace,identify}%
+ \from{scrhack.dtx}{hack,setspace,body}%
+ }%
+ \file{lscape.hak}{%
+ \from{scrkernel-version.dtx}{file,lscape.hak}%
+ \from{scrhack.dtx}{hack,lscape,identify}%
+ \from{scrhack.dtx}{hack,lscape,body}%
+ }%
+ \file{nomencl.hak}{%
+ \from{scrkernel-version.dtx}{file,nomencl.hak}%
+ \from{scrhack.dtx}{hack,nomencl,identify}%
+ \from{scrhack.dtx}{hack,nomencl,body}%
+ }%
+ \file{standardsections.hak}{%
+ \from{scrkernel-version.dtx}{file,standardsections.hak}%
+ \from{scrhack.dtx}{hack,standardsections,identify}%
+ \from{scrhack.dtx}{hack,standardsections,body}%
+ }%
+ }
+ \@@input scrstrop.inc
+\else
+ \let\endbatchfile\relax
+\fi
+\endbatchfile
+\documentclass[USenglish]{koma-script-source-doc}
+\usepackage{babel}
+\setcounter{StandardModuleDepth}{2}
+\begin{document}
+ \DocInput{scrhack.dtx}
+\end{document}
+%</dtx>
+%\fi
+%
+% \changes{v3.03}{2009/03/12}{first version ever}
+% \changes{v3.36}{2022/02/08}{switch over from \cls*{scrdoc} to
+% \cls*{koma-script-source-doc}}
+% \changes{v3.36}{2022/02/08}{require package \pkg*{scrlogo} instead of
+% defining \cs{KOMAScript}}
+% \changes{v3.36}{2022/02/08}{whole implementation documentation in English}
+%
+% \GetFileInfo{scrhack.dtx}
+% \title{Patching Third-Party Packages using
+% \href{https://komascript.de}{\KOMAScript} Package \pkg*{scrhack}}
+% \author{\href{mailto:komascript@gmx.info}{Markus Kohm}}
+% \date{Revision \fileversion{} of \filedate}
+% \maketitle
+% \begin{abstract}
+% Some packages from other authors may have problems with \KOMAScript{}. In
+% my opinion some packages could be improved. With some packages this makes
+% only sense, if \KOMAScript{} was used. With some other packages the
+% package author has another opinion. Sometimes proposals was never
+% answered. Package \pkg*{scrhack} contains all those improvement proposals
+% for other packages. This means, \pkg*{scrhack} redefines macros of packages
+% from other authors! The redefinitions are only activated, if those
+% packages were loaded. Users may prevent \pkg*{scrhack} from redefining
+% macros of individual packages.
+% \end{abstract}
+% \tableofcontents
+%
+% \section{User Manual}
+%
+% You can find the user manuals of \pkg*{scrhack} in the \KOMAScript{} manual,
+% either the German \file{scrguide} or the English \file{scrguien}.
+%
+% \MaybeStop{\PrintIndex}
+%
+% \section{Implementation of \pkg*{scrhack}}
+%
+% \changes{v3.04b}{2009/08/05}{order of commands/macros and options changed}
+%
+% \subsection{Optionen}
+%
+% The package uses \cs{KOMAoptions} of \pkg*{scrkbase}, which is loaded by
+% (virtual) \file{scrkbase.ins}.
+%
+% The options allow the selection of the used manipulations of other
+% packages. But all these options are valid only until both \pkg*{scrhack} and
+% the other package has been loaded. Later settings are invalid.
+%
+%
+% \subsection{Used Macros and Commands}
+% \label{sec:macros}
+% \begin{macrocode}
+%<*package&body>
+% \end{macrocode}
+%
+% \begin{macro}{\scr@ifexpected}
+% Mentioned to do (re)definitions only, if local execution of code does not
+% change a command. Concrete, if (local) execution of \marg{test code} of
+% \begin{quote}
+% \cs{scr@ifexpected}\marg{command}\marg{test code}\marg{then
+% code}\marg{else code}
+% \end{quote}
+% would not result in a change of \cs{\meta{command}}, the \marg{then code}
+% will be executed, otherwise the \marg{else code}.
+% \begin{description}\item[Note:] \meta{test code} must not have any global
+% side effect!\end{description}
+% \begin{macrocode}
+\newcommand{\scr@ifexpected}[2]{%
+ \begingroup
+ \let\@tempa#1
+ #2
+ \ifx\@tempa#1
+ \aftergroup\@firstoftwo
+ \else
+ \aftergroup\@secondoftwo
+ \fi
+ \endgroup
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\scr@hack@load}
+% Conditionally loading of a hack file.
+% \begin{quote}
+% \cs{scr@hack@load}\marg{extension}\marg{basename}\marg{hack}%
+% \marg{true code}\marg{false code}
+% \end{quote}
+% The first two arguments \marg{} and \marg{extension} and \marg{basename} are
+% same to the internal\LaTeX{} kernel command \cs{@ifl@aded}. With \LaTeX{}
+% from 2021/11/15 we even could use \cs{@ifl@aded} for the test, because it is
+% not restricted to the preamble any more. But because it is restricted with
+% older \LaTeX{} kernels, we test the definition of
+% \cs{ver@}\meta{basename}\texttt{.}\meta{extension}. If it is defined, we
+% also test the definition of \cs{ver@}\meta{basename}\texttt{.hak}. If this
+% is not defined, \file{\meta{hack}.hak} is loaded and \meta{true code} is
+% executed. Otherwise \meta{false code} is executed. This means: A hack file
+% is only loaded, if a class or package (or other file with version) has
+% already been loaded, but the hack file has not already been loaded.
+% \begin{macrocode}
+\newcommand*{\scr@hack@load}[2]{%
+ \expandafter\ifx\csname ver@#2.#1\endcsname\relax
+ \expandafter\@secondoftwo
+ \else
+% \end{macrocode}
+% Load a hack only once.
+% \begin{macrocode}
+ \expandafter\ifx\csname ver@#2.hak\endcsname\relax
+ \expandafter\expandafter\expandafter\@firstoftwo
+ \else
+ \expandafter\expandafter\expandafter\@secondoftwo
+ \fi
+ \fi
+ {%
+ \PackageInfo{scrhack}{loading #2 hack}%
+ \edef\reserved@a{%
+ \noexpand\makeatletter\noexpand\input{#2.hak}%
+ \noexpand\catcode`\noexpand\@\the\catcode`\@\relax
+ }\reserved@a
+ }{%
+ \PackageInfo{scrhack}{ignorring #2 hack}%
+ }%
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+%</package&body>
+% \end{macrocode}
+%
+% \subsection{The \pkg*{hyperref} hack}
+%
+% Package \pkg{hyperref} places the anchor of the star variant of a heading
+% after the heading, but the anchor of the normal variant before the heading
+% even if the heading is not numbered because of the value of
+% \cnt{secnumdepth}. The hack changes this to more consistent placing always
+% before the heading.
+%
+% \begin{option}{hyperref}
+% \changes{v3.12}{2013/03/05}{using \cs{FamilyKeyStateProcessed}}
+% \changes{v3.17}{2015/03/09}{defaults by \cs{KOMAExecuteOptions}}
+% \begin{macrocode}
+%<*package&option>
+\KOMA@ifkey{hyperref}{@scrhack@hyperref}%
+\KOMAExecuteOptions{hyperref=true}%
+%</package&option>
+% \end{macrocode}
+% \changes{v3.04b}{2009/11/09}{loading \pkg{hyperref} hack earlier}
+% \changes{v3.17}{2015/03/09}{auto deactivation for newer versions of
+% \pkg{hyperref}}
+% \changes{v3.18}{2015/05/22}{newer versions of \KOMAScript{} classes also
+% deactivate the the hack}
+% This is a little bit tricky, because \pkg{hyperref} loads the driver file
+% via \cs{AtEndOfPackage} and the hack cannot be loaded before loading the
+% driver file. Using \cs{AfterPackage*} would not be good enough therefore,
+% because it would load the hack before the driver file. But using
+% \cs{AtEndOfPackage} inside \cs{AfterPackage*} should delay the loading
+% enough. This also works, if \pkg{hyperref} has already been loaded. In this
+% case the code will be executed at the end of \pkg*{scrhack} instead of
+% \pkg{hyperref}. This is no problem.
+% \begin{macrocode}
+%<*package&body>
+\BeforePackage{hyperref}{%
+ \scr@ifundefinedorrelax{hy@insteadofrefstepcounter}{}{%
+ \PackageInfo{scrhack}{hyperref hack deactivated because of\MessageBreak
+ detection of KOMA-Script class, that doesn't\MessageBreak
+ need that hack,}%
+ \KOMAExecuteOptions[.scrhack.sty]{hyperref=false}%
+ }%
+}
+\AfterPackage*{hyperref}{%
+ \if@scrhack@hyperref
+ \@ifpackagelater{hyperref}{2009/11/24}{%
+ \PackageInfo{scrhack}{hyperref hack deactivated because of\MessageBreak
+ detection of hyperref version, that doesn't\MessageBreak
+ need that hack,}%
+ \KOMAExecuteOptions[.scrhack.sty]{hyperref=false}%
+ }{%
+ \AtEndOfPackage{%
+ \KOMA@key[.scrhack.sty]{hyperref}{%
+ \PackageWarning{scrhack}{option `hyperref=#1' ignored}%
+ \FamilyKeyStateProcessed
+ }%
+ \if@scrhack@hyperref\scr@hack@load\@pkgextension{hyperref}\fi
+ }%
+ }%
+ \fi
+}
+%</package&body>
+% \end{macrocode}
+% \end{option}
+%
+%
+% \begin{macro}{\@schapter,\@spart,\@ssect}
+% We do not hack \pkg{hyperref} itself, but the driver files. After loading
+% \pkg{hyperref} the driver file is also loaded. Moreover, all driver files
+% that re-define these commands have to be patched also. So the patch is
+% related to the loading of \pkg{hyperref} instead of every single driver
+% file. This have already been tested by \cs{scr@hack@load}. So we just have
+% to test, whether the definition of these commands are the expected one.
+% derzeit den erwarteten Inhalt haben.
+% \begin{macrocode}
+%<*hyperref&body>
+\scr@ifexpected\@schapter{%
+ \def\@schapter#1{%
+ \H@old@schapter{#1}%
+ \begingroup
+ \let\@mkboth\@gobbletwo
+ \Hy@GlobalStepCount\Hy@linkcounter
+ \xdef\@currentHref{\Hy@chapapp*.\the\Hy@linkcounter}%
+ \Hy@raisedlink{%
+ \hyper@anchorstart{\@currentHref}\hyper@anchorend
+ }%
+ \endgroup
+ }%
+}{%
+ \PackageInfo{scrhack}{redefining \string\@schapter}%
+ \def\@schapter#1{%
+ \begingroup
+ \let\@mkboth\@gobbletwo
+ \Hy@GlobalStepCount\Hy@linkcounter
+ \xdef\@currentHref{\Hy@chapapp*.\the\Hy@linkcounter}%
+ \Hy@raisedlink{%
+ \hyper@anchorstart{\@currentHref}\hyper@anchorend
+ }%
+ \endgroup
+ \H@old@schapter{#1}%
+ }%
+}{%
+ \scr@ifexpected\@schapter{%
+ \def\@schapter#1{%
+ \begingroup
+ \let\@mkboth\@gobbletwo
+ \Hy@GlobalStepCount\Hy@linkcounter
+ \xdef\@currentHref{\Hy@chapapp*.\the\Hy@linkcounter}%
+ \Hy@raisedlink{%
+ \hyper@anchorstart{\@currentHref}\hyper@anchorend
+ }%
+ \endgroup
+ \H@old@schapter{#1}%
+ }%
+ }{}{%
+ \PackageWarningNoLine{scrhack}{unknown \string\@schapter\space
+ definition found!\MessageBreak
+ Maybe you are using a unsupported hyperref version}%
+ }%
+}
+\scr@ifexpected\@spart{%
+ \def\@spart#1{%
+ \H@old@spart{#1}%
+ \Hy@GlobalStepCount\Hy@linkcounter
+ \xdef\@currentHref{part*.\the\Hy@linkcounter}%
+ \Hy@raisedlink{%
+ \hyper@anchorstart{\@currentHref}\hyper@anchorend
+ }%
+ }%
+}{%
+ \PackageInfo{scrhack}{redefining \string\@spart}%
+ \def\@spart#1{%
+ \Hy@GlobalStepCount\Hy@linkcounter
+ \xdef\@currentHref{part*.\the\Hy@linkcounter}%
+ \Hy@raisedlink{%
+ \hyper@anchorstart{\@currentHref}\hyper@anchorend
+ }%
+ \H@old@spart{#1}%
+ }%
+}{%
+ \scr@ifexpected\@spart{%
+ \def\@spart#1{%
+ \Hy@GlobalStepCount\Hy@linkcounter
+ \xdef\@currentHref{part*.\the\Hy@linkcounter}%
+ \Hy@raisedlink{%
+ \hyper@anchorstart{\@currentHref}\hyper@anchorend
+ }%
+ \H@old@spart{#1}%
+ }%
+ }{}{%
+ \PackageWarningNoLine{scrhack}{unknown \string\@spart\space
+ definition found!\MessageBreak
+ Maybe you are using a unsupported hyperref version}%
+ }%
+}
+\scr@ifexpected\@ssect{%
+ \def\@ssect#1#2#3#4#5{%
+ \H@old@ssect{#1}{#2}{#3}{#4}{#5}%
+ \phantomsection
+ }%
+}{%
+ \PackageInfo{scrhack}{redefining \string\@ssect}%
+ \def\@ssect#1#2#3#4#5{%
+ \H@old@ssect{#1}{#2}{#3}{#4}{\phantomsection\ignorespaces#5}%
+ }%
+}{%
+ \scr@ifexpected\@ssect{%
+ \def\@ssect#1#2#3#4#5{%
+ \H@old@ssect{#1}{#2}{#3}{#4}{\phantomsection\ignorespaces#5}%
+ }%
+ }{}{%
+ \PackageWarningNoLine{scrhack}{unknown \string\@ssect\space
+ definition found!\MessageBreak
+ Maybe you are using a unsupported hyperref version}%
+ }%
+}
+%</hyperref&body>
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \subsection{The \pkg*{floatrow} hack}
+%
+% Package \pkg{floatrow} insists in using \cs{float@listhead} for the setting
+% of the headings. This is not recommended any longer since \KOMAScript~2.95
+% from July 2006! The \KOMAScript{} classes will remove the support for
+% this very limited approach. Recommended is the usage of \pkg*{tocbasic}. The
+% effort to do so, it very small and I do not understand, why package authors
+% are not willing to use it. Because the benefit would be a lot.
+%
+% This hack adds \pkg*{tocbasic} usage to \pkg{floatrow}. Nevertheless it is
+% more complicated than adding \pkg*{tocbasic} support into \pkg{floatrow}.
+%
+% \begin{option}{floatrow}
+% \changes{v3.12}{2013/03/05}{using \cs{FamilyKeyStateProcessed}}
+% \changes{v3.17}{2015/03/09}{using \cs{KOMAExecuteOptions}}
+% \changes{v3.34}{2021/06/03}{deactivation of the \pkg{float} hack}
+% \begin{macrocode}
+%<*package&option>
+\KOMA@ifkey{floatrow}{@scrhack@floatrow}
+\KOMAExecuteOptions{floatrow=true}
+%</package&option>
+%<*package&body>
+\AfterPackage*{floatrow}{%
+ \KOMAoptions{float=false}%
+ \PackageInfo{scrhack}{option `float' deactivated}%
+ \KOMA@key[.scrhack.sty]{floatrow}{%
+ \PackageWarning{scrhack}{option `floatrow' ignored}%
+ \FamilyKeyStateProcessed
+ }%
+ \if@scrhack@floatrow\scr@hack@load\@pkgextension{floatrow}\fi
+}
+%</package&body>
+% \end{macrocode}
+% \end{option}
+%
+%
+% \begin{command}{\DeclareNewFloatType,\listof}
+% \changes{v3.25}{2018/03/16}{using \cs{DeclareTOCStyleEntry}}
+% Command \cs{DeclareNewFloatType} is used to define a new float
+% environment. We have to add registration of the file extension (third
+% argument) with \pkg*{tocbasic}.
+% Command \cs{listof} outputs the list of the float environments. Here we
+% just use the corresponding macro of \pkg*{tocbasic}.
+% \begin{macro}{\float@addtolists}
+% The deprecated macro \cs{float@addtolists} is not needed any longer an will
+% be reset to the original definition.
+% \begin{macrocode}
+%<*floatrow&body>
+\scr@ifexpected{\DeclareNewFloatType}{%
+ \long\def\DeclareNewFloatType#1#2{\def\FB@captype{#1}%
+ \expandafter\edef\csname ftype@#1\endcsname{\the\c@float@type}%
+ \addtocounter{float@type}{\value{float@type}}%
+ \@namedef{#1name}{#1}\newcounter{#1}%
+ \expandafter\edef\csname fnum@#1\endcsname
+ {\expandafter\noexpand\csname #1name\endcsname\nobreakspace
+ \expandafter\noexpand\csname the#1\endcsname}%
+ \@namedef{the#1}{\arabic{#1}}\flnew@ext{lo#1}\@namedef{fps@#1}{tbp}%
+ \@namedef{l@#1}{\@dottedtocline{1}{1.5em}{2.3em}}%
+ \caption@setkeys[floatrow]{newfloat}{#2}\let\FR@tmp=\relax
+ \xdef\@tempa{\noexpand\flrow@types{\the\flrow@types \FR@tmp{#1}}}%
+ \@tempa}%
+}{%
+ \scr@ifexpected{\listof}{%
+ \def\listof#1#2{%
+ \@ifundefined{ext@#1}{\flrow@error{Unknown float style `#1'}}{%
+ \expandafter\providecommand\csname l@#1\endcsname
+ {\@dottedtocline{1}{1.5em}{2.3em}}%
+ \float@listhead{#2}%
+ \begingroup\setlength{\parskip}{\z@}%
+ \@starttoc{\@nameuse{ext@#1}}%
+ \endgroup}}%
+ }{%
+ \RequirePackage{tocbasic}%
+ \PackageInfo{scrhack}{redefining \string\DeclareNewFloatType}%
+% \end{macrocode}
+% \begin{description}
+% \item[Note:] It would be better to first test, if the new extension is
+% already in use like done at the \pkg{float} hack. But I don't know the
+% \pkg{floatrow} code good enough to make such a change!
+% \end{description}
+% \begin{macrocode}
+ \renewcommand\DeclareNewFloatType[2]{\def\FB@captype{#1}%
+ \expandafter\edef\csname ftype@#1\endcsname{\the\c@float@type}%
+ \addtocounter{float@type}{\value{float@type}}%
+ \@namedef{#1name}{#1}\newcounter{#1}%
+ \expandafter\edef\csname fnum@#1\endcsname
+ {\expandafter\noexpand\csname #1name\endcsname\nobreakspace
+ \expandafter\noexpand\csname the#1\endcsname}%
+ \@namedef{the#1}{\arabic{#1}}\flnew@ext{lo#1}\@namedef{fps@#1}{tbp}%
+ \DeclareTOCStyleEntry[level=1,numwidth=2.3em,indent=1.5em]{default}{#1}%
+ \caption@setkeys[floatrow]{newfloat}{#2}\let\FR@tmp=\relax
+ \xdef\@tempa{\noexpand\flrow@types{\the\flrow@types \FR@tmp{#1}}}%
+ \@tempa
+ \xdef\@tempa{\noexpand\addtotoclist[float]{\@nameuse{ext@\FB@captype}}%
+ \noexpand\setuptoc{\@nameuse{ext@\FB@captype}}{chapteratlist}%
+ }%
+ \@tempa
+ }%
+ \PackageInfo{scrhack}{redefining \string\listof}%
+ \renewcommand*\listof[2]{%
+ \@ifundefined{ext@#1}{\flrow@error{Unknown float style `#1'}}{%
+ \@ifundefined{l@#1}{\expandafter\let\csname l@#1\endcsname\l@figure
+ \@ifundefined{l@#1}{%
+ \DeclareTOCStyleEntry[level=1,numwidth=2.3em,indent=1.5em]
+ {default}{#1}%
+ }{}%
+ }{}%
+ \listoftoc[{#2}]{\csname ext@#1\endcsname}%
+ }%
+ }%
+ \scr@ifexpected{\float@addtolists}{%
+ \long\def\float@addtolists#1{%
+ \def\float@do##1{\addtocontents{##1}{#1}} \the\float@exts}%
+ }{%
+ \PackageInfo{scrhack}{undefining \string\float@addtolists}%
+ \let\float@addtolists\relax
+ }{%
+ \PackageWarningNoLine{scrhack}{unkown \string\float@addtolists\space
+ definition found!\MessageBreak
+ Maybe you are using a unsupported floatrow version}%
+ }%
+ }{%
+ \PackageWarningNoLine{scrhack}{unknown \string\listof\space
+ definition found!\MessageBreak
+ Maybe you are using a unsupported floatrow version}%
+ }%
+}{%
+ \PackageWarningNoLine{scrhack}{unknown \string\DeclareNewFloatType\space
+ definition found!\MessageBreak
+ Maybe you are using a unsupported floatrow version}%
+}
+%</floatrow&body>
+% \end{macrocode}
+% \end{macro}
+% \end{command}
+%
+%
+% \subsection{The \pkg*{float} hack}
+%
+% Package \pkg{float} insists in using \cs{float@listhead} for the setting
+% of the headings. This is not recommended any longer since \KOMAScript~2.95
+% from July 2006! The \KOMAScript{} classes will remove the support for
+% this very limited approach. Recommended is the usage of \pkg*{tocbasic}. The
+% effort to do so, it very small and I do not understand, why package authors
+% are not willing to use it. Because the benefit would be a lot.
+%
+% This hack adds \pkg*{tocbasic} usage to \pkg{float}. Nevertheless it is
+% more complicated than adding \pkg*{tocbasic} support into \pkg{float}.
+%
+% \begin{option}{float}
+% \changes{v3.12}{2013/03/05}{using \cs{FamilyKeyStateProcessed}}
+% \changes{v3.17}{2015/03/09}{using \cs{KOMAExecuteOptions}}
+% \begin{macrocode}
+%<*package&option>
+\KOMA@ifkey{float}{@scrhack@float}%
+\KOMAExecuteOptions{float=true}%
+%</package&option>
+%<*package&body>
+\AfterPackage*{float}{%
+ \KOMA@key[.scrhack.sty]{float}{%
+ \PackageWarning{scrhack}{option `float' ignored}%
+ \FamilyKeyStateProcessed
+ }%
+ \if@scrhack@float\scr@hack@load\@pkgextension{float}\fi
+}
+%</package&body>
+% \end{macrocode}
+% \end{option}
+%
+%
+% \begin{command}{\newfloat}
+% \changes{v3.28}{2019/11/19}{\cs{ifattoclist} replaced by
+% \cs{Ifattoclist}}
+% \changes{v3.25}{2018/03/16}{using \cs{DeclareTOCStyleEntry}}
+% We have to add registration of the file extension (third argument of
+% \cs{newfloat}) with \pkg*{tocbasic}.
+% \begin{command}{\listof}
+% Command \cs{listof} outputs the list of the float environments. Here we
+% just use the corresponding macro of \pkg*{tocbasic}.
+% \begin{macro}{\float@addtolists}
+% The deprecated macro \cs{float@addtolists} is not needed any longer an will
+% be reset to the original definition.
+% \begin{macrocode}
+%<*float&body>
+\scr@ifexpected{\newfloat}{%
+ \long\def\newfloat#1#2#3{\@namedef{ext@#1}{#3}
+ \let\float@do=\relax
+ \xdef\@tempa{\noexpand\float@exts{\the\float@exts \float@do{#3}}}%
+ \@tempa
+ \floatplacement{#1}{#2}%
+ \@ifundefined{fname@#1}{\floatname{#1}{#1}}{}
+ \expandafter\edef\csname ftype@#1\endcsname{\value{float@type}}%
+ \addtocounter{float@type}{\value{float@type}}
+ \restylefloat{#1}%
+ \expandafter\edef\csname fnum@#1\endcsname%
+ {\expandafter\noexpand\csname fname@#1\endcsname{}
+ \expandafter\noexpand\csname the#1\endcsname}
+ \@ifnextchar[%]
+ {\float@newx{#1}}%
+ {\@ifundefined{c@#1}{\newcounter{#1}\@namedef{the#1}{\arabic{#1}}}%
+ {}}}%
+}{%
+ \scr@ifexpected{\listof}{%
+ \def\listof#1#2{%
+ \@ifundefined{ext@#1}{\float@error{#1}}{%
+ \@namedef{l@#1}{\@dottedtocline{1}{1.5em}{2.3em}}%
+ \float@listhead{#2}%
+ \begingroup\setlength{\parskip}{\z@}%
+ \@starttoc{\@nameuse{ext@#1}}%
+ \endgroup}}%
+ }{%
+ \RequirePackage{tocbasic}%
+ \PackageInfo{scrhack}{redefining \string\newfloat}%
+ \renewcommand\newfloat[3]{%
+ \Ifattoclist{#3}{%
+ \PackageError{scrhack}{extension `#3' already in use}{%
+ Each extension may be used only once.\MessageBreak
+ You, the class, or another package already uses extension
+ `#3'.\MessageBreak
+ \string\newfloat\space command will be ignored!}%
+ }{%
+ \addtotoclist[float]{#3}%
+ \setuptoc{#3}{chapteratlist}%
+ \@namedef{ext@#1}{#3}%
+ \let\float@do=\relax
+ \xdef\@tempa{\noexpand\float@exts{\the\float@exts \float@do{#3}}}%
+ \@tempa
+ \floatplacement{#1}{#2}%
+ \@ifundefined{fname@#1}{\floatname{#1}{#1}}{}%
+ \expandafter\edef\csname ftype@#1\endcsname{\value{float@type}}%
+ \addtocounter{float@type}{\value{float@type}}
+ \restylefloat{#1}%
+ \expandafter\edef\csname fnum@#1\endcsname%
+ {\expandafter\noexpand\csname fname@#1\endcsname{}
+ \expandafter\noexpand\csname the#1\endcsname}%
+ \@ifnextchar[%]
+ {\float@newx{#1}}%
+ {\@ifundefined{c@#1}{\newcounter{#1}\@namedef{the#1}{\arabic{#1}}}%
+ {}}}%
+ }%
+ \PackageInfo{scrhack}{redefining \string\listof}%
+ \renewcommand*\listof[2]{%
+ \@ifundefined{ext@#1}{\float@error{#1}}{%
+ \@ifundefined{l@#1}{\expandafter\let\csname l@#1\endcsname\l@figure
+ \@ifundefined{l@#1}{%
+ \DeclareTOCStyleEntry[level=1,numwidth=2.3em,indent=1.5em]
+ {default}{#1}%
+ }{}%
+ }{}%
+ \listoftoc[{#2}]{\csname ext@#1\endcsname}%
+ }%
+ }%
+ \scr@ifexpected{\float@addtolists}{%
+ \long\def\float@addtolists#1{%
+ \def\float@do##1{\addtocontents{##1}{#1}} \the\float@exts}%
+ }{%
+ \PackageInfo{scrhack}{undefining \string\float@addtolists}%
+ \let\float@addtolists\relax
+ }{%
+ \PackageWarningNoLine{scrhack}{unkown \string\float@addtolists\space
+ definition found!\MessageBreak
+ Maybe you are using a unsupported float version}%
+ }%
+ }{%
+ \PackageWarningNoLine{scrhack}{unknown \string\listof\space
+ definition found!\MessageBreak
+ Maybe you are using a unsupported float version}%
+ }%
+}{%
+ \PackageWarningNoLine{scrhack}{unknown \string\newfloat\space
+ definition found!\MessageBreak
+ Maybe you are using a unsupported float version}%
+}
+%</float&body>
+% \end{macrocode}
+% \end{macro}
+% \end{command}
+% \end{command}
+%
+%
+% \subsection{The \pkg*{listings} hack}
+%
+% Package \pkg{listing} insists in using \cs{float@listhead} for the setting
+% of the headings. This is not recommended any longer since \KOMAScript~2.95
+% from July 2006! The \KOMAScript{} classes will remove the support for
+% this very limited approach. Recommended is the usage of \pkg*{tocbasic}. The
+% effort to do so, it very small and I do not understand, why package authors
+% are not willing to use it. Because the benefit would be a lot.
+%
+% This hack adds \pkg*{tocbasic} usage to \pkg{listings}. Nevertheless it is
+% more complicated than adding \pkg*{tocbasic} support into \pkg{listings}.
+%
+% \begin{option}{listings}
+% \changes{v3.12}{2013/03/05}{using \cs{FamilyKeyStateProcessed}}
+% \changes{v3.17}{2015/03/09}{using \cs{KOMAExecuteOptions}}
+% \begin{macrocode}
+%<*package&option>
+\KOMA@ifkey{listings}{@scrhack@listings}
+\KOMAExecuteOptions{listings=true}
+%</package&option>
+%<*package&body>
+\AfterPackage*{listings}{%
+ \KOMA@key[.scrhack.sty]{listings}{%
+ \PackageWarning{scrhack}{option `listings' ignored}%
+ \FamilyKeyStateProcessed
+ }%
+ \if@scrhack@listings\scr@hack@load\@pkgextension{listings}\fi
+}
+%</package&body>
+% \end{macrocode}
+% \end{option}
+%
+%
+% \begin{macro}{\scr@do@hack@listings}
+% \begin{command}{\lstlistoflistings}
+% \cs{scr@do@hack@listings} patches \pkg{listings} to use \pkg*{tocbasic} for
+% the whole output of the list of listings. This adds several new features to
+% \pkg{listings}.
+% \begin{macro}{\float@addtolists}
+% The deprecated macro \cs{float@addtolists} is not needed any longer an will
+% be reset to the original definition. But, because \pkg{listings} delays the
+% redefinition with \cs{AtBeginDocument} we have to do the same here.
+% \begin{macrocode}
+%<*listings&body>
+\newcommand*{\scr@do@hack@listings}{%
+ \RequirePackage{tocbasic}%
+ \addtotoclist[float]{lol}%
+ \setuptoc{lol}{chapteratlist}%
+ \PackageInfo{scrhack}{redefining \string\lstlistoflistings}%
+ \renewcommand*{\lstlistoflistings}{\listoftoc[{\lstlistlistingname}]{lol}}%
+ \AtBeginDocument{%
+ \scr@ifexpected{\float@addtolists}{%
+ \def\float@addtolists##1{\addtocontents{lol}{##1}}%
+ }{%
+ \PackageInfo{scrhack}{undefining \string\float@addtolists}%
+ \let\float@addtolists\relax
+ }{%
+ \scr@ifexpected{\float@addtolists}{%
+ \def\float@addtolists##1{\addtocontents{lol}{##1}%
+ \orig@float@addtolists{##1}}%
+ }{%
+ \PackageInfo{scrhack}{setting \string\float@addtolists\MessageBreak
+ to \string\orig@float@addtolists}%
+ \let\float@addtolists\orig@float@addtolists
+ }{%
+ \PackageWarningNoLine{scrhack}{unkown \string\float@addtolists\space
+ definition found!\MessageBreak
+ Maybe you are using a unsupported listings version}%
+ }%
+ }%
+ }%
+% \end{macrocode}
+% \begin{macro}{\lst@makecaption}
+% \changes{v3.30}{2020/04/01}{setting of \cs{@captype} added}
+% From version~3.30 setting of \cs{@captype} to \texttt{lstlisting} is added
+% to \cs{lst@makecaption}. This adds support for usage of
+% \cs{raggedlstlistingcaption} (if the user or a package author defines
+% it). The change is a little bit dangerous, because it will break, if
+% \pkg{listings} would add an argument to \cs{lst@makecaption}.
+% \begin{macrocode}
+ \expandafter\def\expandafter\lst@makecaption\expandafter{%
+ \expandafter\def\expandafter\@captype\expandafter{%
+ \expandafter l\expandafter s\expandafter t\expandafter l%
+ \expandafter i\expandafter s\expandafter t\expandafter i%
+ \expandafter n\expandafter g\expandafter}\lst@makecaption
+ }%
+ \let\scr@do@hack@listings\relax
+}
+\scr@ifexpected{\lstlistoflistings}{%
+ \def\lstlistoflistings{\bgroup
+ \let\contentsname\lstlistlistingname
+ \let\lst@temp\@starttoc \def\@starttoc##1{\lst@temp{lol}}%
+ \tableofcontents \egroup}%
+}{%
+ \scr@do@hack@listings
+}{%
+ \scr@ifexpected{\lstlistoflistings}{%
+ \def\lstlistoflistings{%
+ \begingroup
+ \@ifundefined{@restonecoltrue}{}{%
+ \if@twocolumn
+ \@restonecoltrue\onecolumn
+ \else
+ \@restonecolfalse
+ \fi
+ }%
+ \float@listhead{\lstlistlistingname}%
+ \parskip\z@\parindent\z@\parfillskip \z@ \@plus 1fil%
+ \@starttoc{lol}%
+ \@ifundefined{@restonecoltrue}{}{%
+ \if@restonecol\twocolumn\fi
+ }%
+ \endgroup
+ }%
+ }{%
+ \scr@do@hack@listings
+ }{%
+ \PackageWarningNoLine{scrhack}{unknown \string\lstlistoflistings\space
+ definition found!\MessageBreak
+ Maybe you are using a unsupported listings version}%
+ }%
+}
+%</listings&body>
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{command}
+% \end{macro}
+%
+%
+%
+% \subsection{The \pkg*{nomencl} hack}
+%
+% With package \pkg{nomencl} and the \KOMAScript{} classes there is only a
+% small disharmony between relating the ToC entry. Nevertheless the package
+% can benefit from using \pkg*{tocbasic}.
+%
+% This hack adds \pkg*{tocbasic} usage to \pkg{nomencl}. This is done using
+% \pkg{xpatch} Nevertheless it is much more complicated than adding real
+% \pkg*{tocbasic} support into \pkg{nomencl}. The mess is, that every new
+% release of \pkg{nomencl} changes the kind of ``support'' of
+% \pkg*{tocbasic}. For some versions there isn't any such support. Other
+% versions use \pkg*{tocbasic} if it has been loaded. Other versions need an
+% option to activate usage of \pkg*{tocbasic}. So don't expect that the
+% following hack does the correct thing for every version of \pkg{nomencl}!
+%
+% \begin{option}{nomencl}
+% \changes{v3.23}{2017/03/31}{added}
+% \begin{macrocode}
+%<*package&option>
+\RequirePackage{xpatch}%
+\KOMA@ifkey{nomencl}{@scrhack@nomencl}
+\KOMAExecuteOptions{nomencl=true}
+%</package&option>
+%<*package&body>
+\AfterPackage*{nomencl}{%
+ \KOMA@key[.scrhack.sty]{nomencl}{%
+ \PackageWarning{scrhack}{option `nomencl' ignored}%
+ \FamilyKeyStateProcessed
+ }%
+ \if@scrhack@nomencl\scr@hack@load\@pkgextension{nomencl}\fi
+}
+%</package&body>
+% \end{macrocode}
+% \end{option}^^A nomencl
+%
+% \begin{command}{\thenomenclature}
+% \changes{v3.23}{2017/03/31}{added}
+% Instead of using the several definitions by cases of the several versions of
+% \pkg{nomencl} we use a patch, that should remove all such cases and use
+% \pkg*{tocbasic} always.
+% \begin{macrocode}
+%<*nomencl&body>
+\RequirePackage{tocbasic}
+% \end{macrocode}
+% With \pkg{nomencl} > 5.0 this should be all.
+% Unfortunately is isn't, because newer versions of \pkg{nomencl} need option
+% \opt{tocbasic} to be set. Good luck: It is the default. So the chances
+% are good, that with new versions of \pkg{nomencl} usage of \pkg*{tocbasic} is
+% the default.
+% \begin{macrocode}
+\@ifpackagelater{nomencl}{2019/01/01}{%
+ \PackageInfo{scrhack}{only `tocbasic' loaded for `nomencl'}%
+ \expandafter\endinput
+}{}
+% \end{macrocode}
+% Otherwise we have to patch it.
+% \begin{macrocode}
+\addtotoclist[nomencl]{nlo}
+\addtotoclist[nomencl]{nls}
+\xpatchcmd{\thenomenclature}{%
+ \@ifundefined{chapter}%
+ {
+ \section*{\nomname}
+ \if@intoc\addcontentsline{toc}{section}{\nomname}\fi%
+ }%
+ {
+ \chapter*{\nomname}
+ \if@intoc\addcontentsline{toc}{chapter}{\nomname}\fi%
+ }%
+}{%
+ \scr@hack@nomencl@head
+}{%
+ \PackageInfo{scrhack}{\string\thenomenclature\space successfully patched}%
+}{%
+% \end{macrocode}
+% \changes{v3.26b}{2019/01/23}{new \pkg{nomencl} 5.0}
+% From \pkg{nomencl} 5.0 another code is used if the nomenclature is a
+% chapter. So we need another patch:
+% \begin{macrocode}
+ \xpatchcmd{\thenomenclature}{%
+ \@ifundefined{chapter}%
+ {
+ \section*{\nomname}
+ \if@intoc\addcontentsline{toc}{section}{\nomname}\fi%
+ }%
+ {
+ \chapter*{\nomname}
+ \markboth{\nomname}{\nomname}%
+ \if@intoc\addcontentsline{toc}{chapter}{\nomname}\fi%
+ }%
+ }{%
+ \scr@hack@nomencl@head
+ }{%
+ \PackageInfo{scrhack}{\string\thenomenclature\space successfully patched}%
+ }{%
+% \end{macrocode}
+% \changes{v3.26b}{2019/01/23}{prepared for hoply comming \pkg{nomencl}}
+% But this code is also wrong, because it breaks manual running heads, e.g.,
+% of page style \texttt{myheadings}. So I hope, there will be another code,
+% that needs a somehow different patch:
+% \begin{macrocode}
+ \xpatchcmd{\thenomenclature}{%
+ \@ifundefined{chapter}%
+ {
+ \section*{\nomname}
+ \if@intoc\addcontentsline{toc}{section}{\nomname}\fi%
+ }%
+ {
+ \chapter*{\nomname}
+ \@mkboth{\nomname}{\nomname}%
+ \if@intoc\addcontentsline{toc}{chapter}{\nomname}\fi%
+ }%
+ }{%
+ \scr@hack@nomencl@head
+ }{%
+ \PackageInfo{scrhack}{\string\thenomenclature\space successfully patched}%
+ }{%
+% \end{macrocode}
+% \changes{v3.25}{2019/01/23}{emergency patch added}
+% \changes{v3.30}{2020/02/25}{spurious space in warning message removed}
+% If this also does not work, we try an emergency patch, that could break
+% things.
+% \begin{macrocode}
+ \xpatchcmd{\thenomenclature}{%
+ \@ifundefined{chapter}%
+ }{%
+ \scr@hack@nomencl@head
+ \@gobbletwo
+ }{%
+ \PackageWarning{scrhack}{%
+ using emergency patch of \string\thenomenclature.\MessageBreak
+ This could happen if you are using an unknown\MessageBreak
+ release of package `nomencl'.\MessageBreak
+ Mostly this patch does work too, but it also could\MessageBreak
+ break `nomencl`. If this happens, please deactivate\MessageBreak
+ the `nomencl` hack of `scrhack`%
+ }%
+ }{%
+ \PackageWarning{scrhack}{%
+ cannot patch \string\thenomenclature.\MessageBreak
+ This could happen if you are using an unknown\MessageBreak
+ release of package `nomencl'%
+ }%
+ }%
+ }%
+ }%
+}
+%</nomencl&body>
+% \end{macrocode}
+% \end{command}^^A \thenomenclature
+%
+% \begin{macro}{\scr@hack@nomencl@head}
+% \changes{v3.23}{2017/03/31}{heading of \env{thenomenclature} by
+% \pkg*{tocbasic}}
+% \changes{v3.31}{2020/07/08}{internal \cs{list@fname} eliminated}
+% We don't need an extra group, because \env{thenomenclature} already adds the
+% group.
+% \begin{macrocode}
+%<*nomencl&body>
+\newcommand*{\scr@hack@nomencl@head}{%
+ \providecommand*{\listofnlsname}{\nomname}%
+ \def\@currext{nls}%
+ \tocbasic@listhead{\nomname}%
+}
+%</nomencl&body>
+% \end{macrocode}
+% \begin{description}
+% \item[Note:] Only the heading hooks of \pkg*{tocbasic} are used. The other
+% hooks can be set, but would never be used!
+% \end{description}
+% \end{macro}^^A \scr@hack@nomencl@head
+%
+% \begin{macro}{\if@intoc}
+% \changes{3.23}{2017/03/31}{support of \cs{if@intoc}}
+% Generally we have to support \pkg{nomencl}'s option \opt{intoc} and the
+% switch \cs{if@intoc}. This is done by (un-)setting \pkg*{tocbasic} feature
+% \texttt{totoc}. So additional changes of the feature can be done at first
+% after loading both, \pkg{nomencl} and \pkg*{scrhack}. Moreover, later changes
+% of \cs{if@intoc} are not recognized.
+% \begin{macrocode}
+%<*nomencl&body>
+\if@intoc
+ \setuptoc{nls}{totoc}
+\fi
+%</nomencl&body>
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \subsection{The \pkg*{setspace} hack}
+%
+% Package \pkg{setspace} internally uses \cs{@ptsize} in a way, that only
+% works as long as \cs{@ptsize} is an integer. But because \KOMAScript{}
+% supports non integer font sizes, \cs{@ptsize} can also contain non-integer
+% values. Moreover for \opt{11pt}, \LaTeX{} does not use a 11\,pt font but
+% a 10.95\,pt font with a \len{baselineskip} of 13.6\,pt, the correct factor
+% for, e.g., \cs{onehalfspacing} would be:
+% \[ 10{,}95\,\mathrm{pt} \dot 1{,5} / 13{,}6\,\mathrm{pt} \equiv 1{,}208 \]
+% But \pkg{setspace} uses 1.213, which would be correct for 11\,pt. Moreover
+% the factor is always relative to the base font size and not the current font
+% size. Because of this
+% \begin{verbatim}
+% \documentclass[10pt]{article}
+% \usepackage{setspace}
+% \begin{document}
+% \large\onehalfspacing\raggedright
+% Fontsize: \csname f@size\endcsname pt\\
+% Normal baselineskip: \csname f@baselineskip\endcsname\\
+% baselineskip: \the\baselineskip
+% \end{document}
+% \end{verbatim}
+% results in another \len{baselineskip} than:
+% \begin{verbatim}
+% \documentclass[11pt]{article}
+% \usepackage{setspace}
+% \begin{document}
+% \large\onehalfspacing\raggedright
+% Fontsize: \csname f@size\endcsname pt\\
+% Normal baselineskip: \csname f@baselineskip\endcsname\\
+% baselineskip: \the\baselineskip
+% \end{document}
+% \end{verbatim}
+% despite both examples use the same font size. So, to make it absolutely
+% correct, the factor would have to change with every change of the font
+% size. But the hack also does not do so. It just calculates the factor
+% depending on the base font size an the current font size. This is enough to
+% have the same \len{baselineskip} with both of the examples above.
+%
+% \begin{option}{setspace}
+% \changes{v3.17}{2015/04/16}{added}
+% \begin{macrocode}
+%<*package&option>
+\KOMA@ifkey{setspace}{@scrhack@setspace}
+\KOMAExecuteOptions{setspace=true}
+%</package&option>
+%<*package&body>
+\AfterPackage*{setspace}{%
+ \KOMA@key[.scrhack.sty]{setspace}{%
+ \PackageWarning{scrhack}{option `setspace' ignored}%
+ \FamilyKeyStateProcessed
+ }%
+ \if@scrhack@setspace\scr@hack@load\@pkgextension{setspace}\fi
+}
+%</package&body>
+% \end{macrocode}
+% \end{option}
+%
+%
+% \begin{command}{\onehalfspacing}
+% \changes{v3.17}{2015/04/16}{added}
+% This selects the one half line spacing. I think, a factor with three digits
+% for the decimals should be enough.
+% \begin{macrocode}
+%<*setspace&body>
+\scr@ifexpected{\onehalfspacing}{%
+ \long\def\onehalfspacing{%
+ \setstretch{1.25}% default
+ \ifcase \@ptsize \relax % 10pt
+ \setstretch {1.25}%
+ \or % 11pt
+ \setstretch {1.213}%
+ \or % 12pt
+ \setstretch {1.241}%
+ \fi
+ }%
+}{%
+ \renewcommand*{\onehalfspacing}{%
+ \@tempdima=\dimexpr (\f@size pt)*1500/
+ (\dimexpr \f@baselineskip\relax)*\p@/1000\relax
+ \expandafter\setstretch\expandafter{\strip@pt\@tempdima}%
+ }%
+}{%
+ \PackageWarning{scrhack}{unknown \string\onehalfspacing\space
+ definition found!\MessageBreak
+ Maybe you are using a unsupported setpace version}%
+}
+% \end{macrocode}
+% \end{command}
+% \begin{command}{\doublespacing}
+% \changes{v3.17}{2015/04/16}{new}
+% This selects the double line spacing. I think, a factor with three digits
+% for the decimals should be enough.
+% \begin{macrocode}
+\scr@ifexpected{\doublespacing}{%
+ \long\def\doublespacing{%
+ \setstretch{1.667}% default
+ \ifcase \@ptsize \relax % 10pt
+ \setstretch {1.667}%
+ \or % 11pt
+ \setstretch {1.618}%
+ \or % 12pt
+ \setstretch {1.655}%
+ \fi
+ }%
+}{%
+ \renewcommand*{\doublespacing}{%
+ \@tempdima=\dimexpr (\f@size pt)*2000/
+ (\dimexpr \f@baselineskip\relax)*\p@/1000\relax
+ \expandafter\setstretch\expandafter{\strip@pt\@tempdima}%
+ }%
+}{%
+ \PackageWarning{scrhack}{unknown \string\doublespacing\space
+ definition found!\MessageBreak
+ Maybe you are using a unsupported setpace version}%
+}
+%</setspace&body>
+% \end{macrocode}
+% \end{command}
+%
+%
+% \subsection{The \pkg*{lscape} hack}
+% \changes{v3.18a}{2015/07/07}{\pkg{lscape} hack added}
+%
+% The package does change \len{textheight} inside \env{landscape} to the prior
+% value of \len{textwidth}, nevertheless is does not change \len{textwidth} to
+% the prior value of \len{textheight}. This is at least inconsistent. After
+% asking him, David~Carlisle answered, that he does not change
+% \len{textwidth}, because this could result in problems. Therefore it is very
+% strange, that he does change \cs{textheight}, despite this also to problems,
+% e.g., with packages \pkg{showframe} or \pkg*{scrlayer}. So the patch here
+% also keeps \len{textheight} unchanged. This also has to take care for
+% \pkg{pdflscape}. The patches are done using \pkg{xpatch}.
+%
+%
+% \begin{option}{lscape}
+% \changes{v3.18a}{2015/07/07}{added}
+% \changes{v3.20}{2016/05/07}{loading \pkg{xpatch} in option part already}
+% \begin{macrocode}
+%<*package&option>
+\RequirePackage{xpatch}%
+\KOMA@ifkey{lscape}{@scrhack@lscape}%
+\KOMAExecuteOptions{lscape=true}%
+%</package&option>
+%<*package&body>
+\AfterPackage*{lscape}{%
+ \if@scrhack@lscape\scr@hack@load\@pkgextension{lscape}\else
+ \KOMA@key[.scrhack.sty]{lscape}{%
+ \PackageWarning{scrhack}{option `lscape' ignored}%
+ \FamilyKeyStateProcessed
+ }%
+ \fi
+}
+%</package&body>
+% \end{macrocode}
+% \end{option}
+%
+% \begin{command}{\landscape}
+% \changes{v3.18a}{2015/07/07}{added}
+% \changes{v3.20}{2016/05/07}{loading \pkg{xpatch} in option part already}
+% This command is the beginning of environment \env{landscape}. This has to be
+% patched using \pkg{xpatch}.
+% \begin{description}
+% \item[Note:] This is a load time option and cannot be changed after loading
+% the package!
+% \end{description}
+% \begin{macrocode}
+%<*lscape&body>
+\xpatchcmd{\landscape}{\textheight=\vsize}{%
+ \if@scrhack@lscape
+% \end{macrocode}
+% \begin{macro}{\@outputpage}
+% \changes{v3.18a}{2015/08/11}{added}
+% Here the changed value of \len{textheight} is needed for initialization of
+% \cs{@colht}. So we patch it to use the new internal \len{scr@LT@textheight}
+% instead of \len{textheight}.
+% \begin{macrocode}
+ \scrh@LT@textheight=\vsize
+ \let\scrh@LT@outputpage\@outputpage
+ \def\@outputpage{\scrh@LT@outputpage\global\@colht\scrh@LT@textheight}%
+ \else
+ \textheight=\vsize
+ \fi
+}{%
+ \PackageInfo{scrhack}{\string\landscape\space patched to make
+ \string\textheight\space change optional}%
+}{%
+ \PackageWarning{scrhack}{Cannot patch \string\landscape!\MessageBreak
+ Maybe you are using a unsupported lscape version}%
+ \@scrhack@lscapefalse
+}
+% \end{macrocode}
+% \begin{ilength}{\scrh@LT@textheight}
+% \changes{v3.18a}{2015/08/11}{new}
+% \begin{macrocode}
+\newlength{\scrh@LT@textheight}
+%</lscape&body>
+% \end{macrocode}
+% \end{ilength}^^A \scrh@LT@textheight
+% \end{macro}^^A \@outputpage
+% \end{command}^^A \landscape
+%
+%
+% \subsection{The standard classes sections hack}
+% \label{sec:standardsections}
+% The \emph{standard classes sections hack} differs from each other
+% hack. First of all it does not patch a specific package but the class
+% definitions of section commands from \cs{part} till
+% \cs{subparagraph}. Additionally it resets several internal \LaTeX{} macros
+% which are changed by \KOMAScript{} classes to their original
+% definition. Last but not least it is not activated by default, but the user
+% has to activate it, if he needs it. The hack has more potential to break
+% things than to make things better. Because of this, there is not any support
+% for using this hack and the hack shows several warning messages.
+%
+% \begin{option}{standardsections}
+% \begin{macrocode}
+%<*package&option>
+\KOMA@ifkey{standardsections}{@scrhack@standardsections}
+\KOMAExecuteOptions{standardsections=false}
+%</package&option>
+%<*package&body>
+\AtEndOfPackage{%
+ \if@scrhack@standardsections
+ \PackageInfo{scrhack}{loading standard classes sections hack}%
+ \input{standardsections.hak}%
+ \fi
+}
+%</package&body>
+% \end{macrocode}
+% \end{option}^^A standardsections
+%
+% \begin{command}{\part,\chapter,
+% \section,\subsection,\subsubsection,
+% \paragraph,\subparagraph}
+% The hack redefines all these commands to a definition copied from the
+% standard \LaTeX{} classes version v1.4i. Copyright of this code is by the
+% \LaTeX3{} Project. The complete, unmodified code can be found on
+% \url{https://ctan.org/tex-archive/macros/latex/base/classes.dtx}.
+% \begin{macrocode}
+%<*standardsections&body>
+\PackageWarningNoLine{scrhack}{%
+ You are loosing every kind of support because of\MessageBreak
+ using the dangerous standard classes sections hack!\MessageBreak
+ This hack can break several classes and packages.\MessageBreak
+ However, sometimes it is needed to make a\MessageBreak
+ package work%
+}%
+\PackageInfo{scrhack}{%
+ Using code from the standard LaTeX classes.\MessageBreak
+ For more information about this code and the\MessageBreak
+ license of this code, please see:\MessageBreak
+ https://ctan.org/tex-archive/macros/latex/base/classes.dtx
+}%
+\@ifpackageloaded{hyperref}{%
+ \PackageWarning{scrhack}{this hack should not be loaded after `hyperref'}%
+}{}
+\@ifpackageloaded{titlesec}{%
+ \PackageWarning{scrhack}{this hack should not be loaded after `titlesec'}%
+}{}
+\@ifpackageloaded{sectsty}{%
+ \PackageWarning{scrhack}{this hack should not be loaded after `sectsty'}%
+}{}
+\@ifpackageloaded{sectsty}{%
+ \PackageWarning{scrhack}{this hack should not be loaded after `sectsty'}%
+}{}
+\scr@ifundefinedorrelax{chapter}{%
+% \end{macrocode}
+% It seems to be an article class, so we use the code from
+% \href{http://mirrors.ctan.org/macros/latex/base/classes.dtx}{\cls*{article}}.
+% \begin{macrocode}
+ \scr@ifundefinedorrelax{c@part}{\newcounter{part}}{}%
+ \scr@ifundefinedorrelax{c@section}{\newcounter{section}}{}%
+ \scr@ifundefinedorrelax{c@subsection}{\newcounter{subsection}[section]}{}%
+ \scr@ifundefinedorrelax{c@subsubsection}{%
+ \newcounter{subsubsection}[subsection]}{}%
+ \scr@ifundefinedorrelax{c@paragraph}{%
+ \newcounter{paragraph}[subsubsection]}{}%
+ \scr@ifundefinedorrelax{c@subparagraph}{%
+ \newcounter{subparagraph}[paragraph]}{}%
+ \renewcommand\thepart {\@Roman\c@part}%
+ \renewcommand\thesection {\@arabic\c@section}%
+ \renewcommand\thesubsection {\thesection.\@arabic\c@subsection}%
+ \renewcommand\thesubsubsection{\thesubsection.\@arabic\c@subsubsection}%
+ \renewcommand\theparagraph {\thesubsubsection.\@arabic\c@paragraph}%
+ \renewcommand\thesubparagraph {\theparagraph.\@arabic\c@subparagraph}%
+ \def\part{%
+ \if@noskipsec \leavevmode \fi
+ \par
+ \addvspace{4ex}%
+ \@afterindentfalse
+ \secdef\@part\@spart}%
+ \def\@part[#1]#2{%
+ \ifnum \c@secnumdepth >\m@ne
+ \refstepcounter{part}%
+ \addcontentsline{toc}{part}{\thepart\hspace{1em}#1}%
+ \else
+ \addcontentsline{toc}{part}{#1}%
+ \fi
+ {\parindent \z@ \raggedright
+ \interlinepenalty \@M
+ \normalfont
+ \ifnum \c@secnumdepth >\m@ne
+ \Large\bfseries \partname\nobreakspace\thepart
+ \par\nobreak
+ \fi
+ \huge \bfseries #2%
+ \markboth{}{}\par}%
+ \nobreak
+ \vskip 3ex
+ \@afterheading}%
+ \def\@spart#1{%
+ {\parindent \z@ \raggedright
+ \interlinepenalty \@M
+ \normalfont
+ \huge \bfseries #1\par}%
+ \nobreak
+ \vskip 3ex
+ \@afterheading}%
+ \def\section{\@startsection {section}{1}{\z@}%
+ {-3.5ex \@plus -1ex \@minus -.2ex}%
+ {2.3ex \@plus.2ex}%
+ {\normalfont\Large\bfseries}}%
+ \def\subsection{\@startsection{subsection}{2}{\z@}%
+ {-3.25ex\@plus -1ex \@minus -.2ex}%
+ {1.5ex \@plus .2ex}%
+ {\normalfont\large\bfseries}}%
+ \def\subsubsection{\@startsection{subsubsection}{3}{\z@}%
+ {-3.25ex\@plus -1ex \@minus -.2ex}%
+ {1.5ex \@plus .2ex}%
+ {\normalfont\normalsize\bfseries}}%
+ \def\paragraph{\@startsection{paragraph}{4}{\z@}%
+ {3.25ex \@plus1ex \@minus.2ex}%
+ {-1em}%
+ {\normalfont\normalsize\bfseries}}%
+ \def\subparagraph{\@startsection{subparagraph}{5}{\parindent}%
+ {3.25ex \@plus1ex \@minus .2ex}%
+ {-1em}%
+ {\normalfont\normalsize\bfseries}}%
+}{%
+% \end{macrocode}
+% It seems to be either a book or report class.
+% \begin{macrocode}
+ \scr@ifundefinedorrelax{c@part}{\newcounter{part}}{}%
+ \scr@ifundefinedorrelax{c@chapter}{\newcounter{chapter}}{}%
+ \scr@ifundefinedorrelax{c@section}{\newcounter{section}[chapter]}{}%
+ \scr@ifundefinedorrelax{c@subsection}{\newcounter{subsection}[section]}{}%
+ \scr@ifundefinedorrelax{c@subsubsection}{%
+ \newcounter{subsubsection}[subsection]}{}%
+ \scr@ifundefinedorrelax{c@paragraph}{%
+ \newcounter{paragraph}[subsubsection]}{}%
+ \scr@ifundefinedorrelax{c@subparagraph}{%
+ \newcounter{subparagraph}[paragraph]}{}%
+ \def\@chapapp{\chaptername}%
+ \scr@ifundefinedorrelax{frontmatter}{%
+% \end{macrocode}
+% It seems not to be a book class.
+% \begin{macrocode}
+ \def\part{%
+ \if@openright
+ \cleardoublepage
+ \else
+ \clearpage
+ \fi
+ \thispagestyle{plain}%
+ \if@twocolumn
+ \onecolumn
+ \@tempswatrue
+ \else
+ \@tempswafalse
+ \fi
+ \null\vfil
+ \secdef\@part\@spart}
+
+ \def\@part[#1]#2{%
+ \ifnum \c@secnumdepth >-2\relax
+ \refstepcounter{part}%
+ \addcontentsline{toc}{part}{\thepart\hspace{1em}#1}%
+ \else
+ \addcontentsline{toc}{part}{#1}%
+ \fi
+ \markboth{}{}%
+ {\centering
+ \interlinepenalty \@M
+ \normalfont
+ \ifnum \c@secnumdepth >-2\relax
+ \huge\bfseries \partname\nobreakspace\thepart
+ \par
+ \vskip 20\p@
+ \fi
+ \Huge \bfseries #2\par}%
+ \@endpart}
+ \def\@spart#1{%
+ {\centering
+ \interlinepenalty \@M
+ \normalfont
+ \Huge \bfseries #1\par}%
+ \@endpart}
+ \def\@endpart{\vfil\newpage
+ \if@twoside
+ \if@openright
+ \null
+ \thispagestyle{empty}%
+ \newpage
+ \fi
+ \fi
+ \if@tempswa
+ \twocolumn
+ \fi}
+ \def\chapter{\if@openright\cleardoublepage\else\clearpage\fi
+ \thispagestyle{plain}%
+ \global\@topnum\z@
+ \@afterindentfalse
+ \secdef\@chapter\@schapter}
+ \def\@chapter[#1]#2{\ifnum \c@secnumdepth >\m@ne
+ \refstepcounter{chapter}%
+ \typeout{\@chapapp\space\thechapter.}%
+ \addcontentsline{toc}{chapter}%
+ {\protect\numberline{\thechapter}#1}%
+ \else
+ \addcontentsline{toc}{chapter}{#1}%
+ \fi
+ \chaptermark{#1}%
+ \addtocontents{lof}{\protect\addvspace{10\p@}}%
+ \addtocontents{lot}{\protect\addvspace{10\p@}}%
+ \if@twocolumn
+ \@topnewpage[\@makechapterhead{#2}]%
+ \else
+ \@makechapterhead{#2}%
+ \@afterheading
+ \fi}
+ \def\@makechapterhead#1{%
+ \vspace*{50\p@}%
+ {\parindent \z@ \raggedright \normalfont
+ \ifnum \c@secnumdepth >\m@ne
+ \huge\bfseries \@chapapp\space \thechapter
+ \par\nobreak
+ \vskip 20\p@
+ \fi
+ \interlinepenalty\@M
+ \Huge \bfseries #1\par\nobreak
+ \vskip 40\p@
+ }}
+ \def\@schapter#1{\if@twocolumn
+ \@topnewpage[\@makeschapterhead{#1}]%
+ \else
+ \@makeschapterhead{#1}%
+ \@afterheading
+ \fi}
+ \def\@makeschapterhead#1{%
+ \vspace*{50\p@}%
+ {\parindent \z@ \raggedright
+ \normalfont
+ \interlinepenalty\@M
+ \Huge \bfseries #1\par\nobreak
+ \vskip 40\p@
+ }}
+ \def\section{\@startsection {section}{1}{\z@}%
+ {-3.5ex \@plus -1ex \@minus -.2ex}%
+ {2.3ex \@plus.2ex}%
+ {\normalfont\Large\bfseries}}%
+ \def\subsection{\@startsection{subsection}{2}{\z@}%
+ {-3.25ex\@plus -1ex \@minus -.2ex}%
+ {1.5ex \@plus .2ex}%
+ {\normalfont\large\bfseries}}%
+ \def\subsubsection{\@startsection{subsubsection}{3}{\z@}%
+ {-3.25ex\@plus -1ex \@minus -.2ex}%
+ {1.5ex \@plus .2ex}%
+ {\normalfont\normalsize\bfseries}}%
+ \def\paragraph{\@startsection{paragraph}{4}{\z@}%
+ {3.25ex \@plus1ex \@minus.2ex}%
+ {-1em}%
+ {\normalfont\normalsize\bfseries}}%
+ \def\subparagraph{\@startsection{subparagraph}{5}{\parindent}%
+ {3.25ex \@plus1ex \@minus .2ex}%
+ {-1em}%
+ {\normalfont\normalsize\bfseries}}%
+ }{%
+% \end{macrocode}
+% It seems to be a book class.
+% \begin{macrocode}
+ \scr@ifundefinedorrelax{if@mainmatter}{%
+ \expandafter\newif\csname if@mainmatter\endcsname
+ }{}%
+ \def\frontmatter{%
+ \cleardoublepage
+ \@mainmatterfalse
+ \pagenumbering{roman}}%
+ \def\mainmatter{%
+ \cleardoublepage
+ \@mainmattertrue
+ \pagenumbering{arabic}}%
+ \def\backmatter{%
+ \if@openright
+ \cleardoublepage
+ \else
+ \clearpage
+ \fi
+ \@mainmatterfalse}%
+ \def\part{%
+ \if@openright
+ \cleardoublepage
+ \else
+ \clearpage
+ \fi
+ \thispagestyle{plain}%
+ \if@twocolumn
+ \onecolumn
+ \@tempswatrue
+ \else
+ \@tempswafalse
+ \fi
+ \null\vfil
+ \secdef\@part\@spart}%
+
+ \def\@part[#1]#2{%
+ \ifnum \c@secnumdepth >-2\relax
+ \refstepcounter{part}%
+ \addcontentsline{toc}{part}{\thepart\hspace{1em}#1}%
+ \else
+ \addcontentsline{toc}{part}{#1}%
+ \fi
+ \markboth{}{}%
+ {\centering
+ \interlinepenalty \@M
+ \normalfont
+ \ifnum \c@secnumdepth >-2\relax
+ \huge\bfseries \partname\nobreakspace\thepart
+ \par
+ \vskip 20\p@
+ \fi
+ \Huge \bfseries #2\par}%
+ \@endpart}%
+ \def\@spart#1{%
+ {\centering
+ \interlinepenalty \@M
+ \normalfont
+ \Huge \bfseries #1\par}%
+ \@endpart}%
+ \def\@endpart{\vfil\newpage
+ \if@twoside
+ \if@openright
+ \null
+ \thispagestyle{empty}%
+ \newpage
+ \fi
+ \fi
+ \if@tempswa
+ \twocolumn
+ \fi}%
+ \def\chapter{\if@openright\cleardoublepage\else\clearpage\fi
+ \thispagestyle{plain}%
+ \global\@topnum\z@
+ \@afterindentfalse
+ \secdef\@chapter\@schapter}%
+ \def\@chapter[#1]#2{\ifnum \c@secnumdepth >\m@ne
+ \if@mainmatter
+ \refstepcounter{chapter}%
+ \typeout{\@chapapp\space\thechapter.}%
+ \addcontentsline{toc}{chapter}%
+ {\protect\numberline{\thechapter}#1}%
+ \else
+ \addcontentsline{toc}{chapter}{#1}%
+ \fi
+ \else
+ \addcontentsline{toc}{chapter}{#1}%
+ \fi
+ \chaptermark{#1}%
+ \addtocontents{lof}{\protect\addvspace{10\p@}}%
+ \addtocontents{lot}{\protect\addvspace{10\p@}}%
+ \if@twocolumn
+ \@topnewpage[\@makechapterhead{#2}]%
+ \else
+ \@makechapterhead{#2}%
+ \@afterheading
+ \fi}%
+ \def\@makechapterhead#1{%
+ \vspace*{50\p@}%
+ {\parindent \z@ \raggedright \normalfont
+ \ifnum \c@secnumdepth >\m@ne
+ \if@mainmatter
+ \huge\bfseries \@chapapp\space \thechapter
+ \par\nobreak
+ \vskip 20\p@
+ \fi
+ \fi
+ \interlinepenalty\@M
+ \Huge \bfseries #1\par\nobreak
+ \vskip 40\p@
+ }}%
+ \def\@schapter#1{\if@twocolumn
+ \@topnewpage[\@makeschapterhead{#1}]%
+ \else
+ \@makeschapterhead{#1}%
+ \@afterheading
+ \fi}%
+ \def\@makeschapterhead#1{%
+ \vspace*{50\p@}%
+ {\parindent \z@ \raggedright
+ \normalfont
+ \interlinepenalty\@M
+ \Huge \bfseries #1\par\nobreak
+ \vskip 40\p@
+ }}%
+ \def\section{\@startsection {section}{1}{\z@}%
+ {-3.5ex \@plus -1ex \@minus -.2ex}%
+ {2.3ex \@plus.2ex}%
+ {\normalfont\Large\bfseries}}%
+ \def\subsection{\@startsection{subsection}{2}{\z@}%
+ {-3.25ex\@plus -1ex \@minus -.2ex}%
+ {1.5ex \@plus .2ex}%
+ {\normalfont\large\bfseries}}%
+ \def\subsubsection{\@startsection{subsubsection}{3}{\z@}%
+ {-3.25ex\@plus -1ex \@minus -.2ex}%
+ {1.5ex \@plus .2ex}%
+ {\normalfont\normalsize\bfseries}}%
+ \def\paragraph{\@startsection{paragraph}{4}{\z@}%
+ {3.25ex \@plus1ex \@minus.2ex}%
+ {-1em}%
+ {\normalfont\normalsize\bfseries}}%
+ \def\subparagraph{\@startsection{subparagraph}{5}{\parindent}%
+ {3.25ex \@plus1ex \@minus .2ex}%
+ {-1em}%
+ {\normalfont\normalsize\bfseries}}%
+ }%
+}% End of the derived code.
+% \end{macrocode}
+% \end{command}
+%
+% \begin{macro}{\@startsection}
+% \KOMAScript{} classes redefine this internal \LaTeX{} kernel macro. In this
+% case \cs{scr@saved@startsection} is defined, differs from
+% \cs{@startsection} and has the definition found before redefining the
+% original macro. We do nothing else but resetting \cs{@startsection} to this
+% saved definition.
+% \begin{macrocode}
+\scr@ifundefinedorrelax{scr@saved@startsection}{}{%
+ \ifx\@startsection\scr@saved@startsection\else
+ \PackageWarningNoLine{scrhack}{%
+ Resetting \string\@startsection,\MessageBreak
+ because of loading standard classes sections hack%
+ }%
+ \let\@startsection\scr@saved@startsection
+ \fi
+}
+% \end{macrocode}
+% \end{macro}^^A \@startsection
+%
+% \begin{macro}{\@sect,\@ssect,\@xsect}
+% All these should be resetted to their original definitions stored in
+% \cs{scr@latex@\dots}.
+% \begin{macrocode}
+\scr@ifundefinedorrelax{scr@latex@sect}{}{%
+ \ifx\@sect\scr@latex@sect\else
+ \PackageWarningNoLine{scrhack}{%
+ Resetting \string\@sect,\MessageBreak
+ because of loading standard classes sections hack%
+ }%
+ \let\@sect\scr@latex@sect
+ \fi
+}
+\scr@ifundefinedorrelax{scr@latex@ssect}{}{%
+ \ifx\@ssect\scr@latex@ssect\else
+ \PackageWarningNoLine{scrhack}{%
+ Resetting \string\@ssect,\MessageBreak
+ because of loading standard classes sections hack%
+ }%
+ \let\@sect\scr@latex@ssect
+ \fi
+}
+\scr@ifundefinedorrelax{scr@latex@xsect}{}{%
+ \ifx\@xsect\scr@latex@xsect\else
+ \PackageWarningNoLine{scrhack}{%
+ Resetting \string\@xsect,\MessageBreak
+ because of loading standard classes sections hack%
+ }%
+ \let\@sect\scr@latex@sect
+ \fi
+}
+% \end{macrocode}
+% \end{macro}^^A \@xsect,\@ssect,\@sect
+%
+% \begin{command}{\DeclareSectionCommand,\RedeclareSectionCommand,
+% \DeclareNewSectionCommand,\ProvideSectionCommand,
+% \DeclareSectionCommands,\RedeclareSectionCommands,
+% \DeclareNewSectionCommands,\ProvideSectionCommands}
+% These \KOMAScript{} commands do not make sense any longer after forced
+% redefinition of \cs{part} \dots{} \cs{subparagraph}. They even would not
+% work correctly after resetting, e.g., \cs{@startsection}. So best reaction
+% is to \emph{undefine} them.
+% \begin{macrocode}
+\scr@ifundefinedorrelax{DeclareSectionCommand}{}{%
+ \PackageWarningNoLine{scrhack}{%
+ \string\DeclareSectionCommand\space
+ and all derivates deactivated,\MessageBreak
+ because of loading standard classes sections hack%
+ }%
+ \let\DeclareSectionCommand\undefined
+ \let\DeclareSectionCommands\undefined
+ \let\RedeclareSectionCommand\undefined
+ \let\RedeclareSectionCommands\undefined
+ \let\DeclareNewSectionCommand\undefined
+ \let\DeclareNewSectionCommands\undefined
+ \let\ProvideSectionCommand\undefined
+ \let\ProvideSectionCommands\undefined
+}
+% \end{macrocode}
+% \begin{macro}{\scr@chapter@before@hyperref@patch,
+% \scr@chapter@after@hyperref@patch}
+% Now, definitions without respecting \pkg{hyperref} are used, so
+% \pkg{hyperref} should again be able to patch them. So the hack should
+% deactivate the patch deactivation of the \KOMAScript{} classes.
+% \begin{macrocode}
+\let\scr@chapter@before@hyperref@patch\relax
+\let\scr@chapter@after@hyperref@patch\relax
+% \end{macrocode}
+% \end{macro}
+% \end{command}
+%
+% \begin{macro}{\scr@osectarg}
+% The \KOMAScript{} classes use this macro to store how to use the optional
+% argument of section commands. But with the standard class definition the
+% only possibility is to use it as running head and write it into the table of
+% contents without any extended handling. So the only value, that makes sense
+% is 0.
+% \begin{macrocode}
+\scr@ifundefinedorrelax{scr@osectarg}{}{%
+ \def\reserved@a{0}%
+ \ifx\scr@osectarg\reserved@a\else
+ \let\scr@osectarg\reserved@a
+ \PackageWarningNoLine{scrhack}{%
+ Extended option handling for section commands deactivated,\MessageBreak
+ because of loading standard classes sections hack%
+ }%
+ \fi
+}%
+% \end{macrocode}
+% \begin{macro}{\scr@activate@xsection}
+% Further changing of the value has to be deactivated.
+% \begin{macrocode}
+\scr@ifundefinedorrelax{scr@activate@xsection}{}{%
+ \renewcommand*{\scr@activate@xsection}[1]{%
+ \edef\scr@osectarg{#1}\def\reserved@a{0}%
+ \ifx\scr@osectarg\reserved@a
+ \else
+ \let\scr@osectarg\reserved@a
+ \PackageWarning{scrhack}{%
+ Because of loading the standard classes\MessageBreak
+ sections hack, the extended option handling\MessageBreak
+ of section commands failed%
+ }%
+ \fi
+ }%
+}
+% \end{macrocode}
+% \end{macro}^^A \scr@activate@xsection
+% \end{macro}^^A \scr@osectarg
+%
+% \begin{command}{\partformat,\chapterformat}
+% Most \cs{\dots format} macros of \KOMAScript{} are still used, because of
+% the redefinition of \cs{@seccntformat}. But \cs{part} and \cs{chapter} are
+% defined without using them.
+% \begin{macrocode}
+\scr@ifundefinedorrelax{partformat}{}{%
+ \PackageWarningNoLine{scrhack}{%
+ Usage of \string\partformat\space
+ deactivated,\MessageBreak
+ because of loading the standard classes sections hack%
+ }%
+}
+\scr@ifundefinedorrelax{chapterformat}{}{%
+ \PackageWarningNoLine{scrhack}{%
+ Usage of \string\chapterformat\space
+ deactivated,\MessageBreak
+ because of loading the standard classes sections hack%
+ }%
+}
+% \end{macrocode}
+% \end{command}^^A \chapterformat,\partformat
+%
+% \begin{command}{\sectionformat,\subsectionformat,\subsubsectionformat,
+% \paragraphformat,\subparagraphformat}
+% All these commands have to be resetted to not use the automatic dot and to
+% add a \cs{quad} instead of an \cs{enskip}.
+% \begin{macrocode}
+\scr@ifundefinedorrelax{sectionformat}{}{%
+ \PackageWarningNoLine{scrhack}{%
+ \string\sectionformat\space set to
+ `\string\thesection\string\quad',\MessageBreak
+ because of loading the standard classes sections hack%
+ }%
+ \renewcommand*{\sectionformat}{\thesection\quad}%
+}
+\scr@ifundefinedorrelax{subsectionformat}{}{%
+ \PackageWarningNoLine{scrhack}{%
+ \string\subsectionformat\space set to
+ `\string\thesubsection\string\quad'\MessageBreak
+ because of loading the standard classes sections hack%
+ }%
+ \renewcommand*{\subsectionformat}{\thesubsection\quad}%
+}
+\scr@ifundefinedorrelax{subsubsectionformat}{}{%
+ \PackageWarningNoLine{scrhack}{%
+ \string\subsubsectionformat\space set to
+ `\string\thesubsubsection\string\quad'\MessageBreak
+ because of loading the standard classes sections hack%
+ }%
+ \renewcommand*{\subsubsectionformat}{\thesubsubsection\quad}%
+}
+\scr@ifundefinedorrelax{paragraphformat}{}{%
+ \PackageWarningNoLine{scrhack}{%
+ \string\paragraphformat\space set to
+ `\string\theparagraph\string\quad'\MessageBreak
+ because of loading the standard classes sections hack%
+ }%
+ \renewcommand*{\paragraphformat}{\theparagraph\quad}%
+}
+\scr@ifundefinedorrelax{subparagraphformat}{}{%
+ \PackageWarningNoLine{scrhack}{%
+ \string\subparagraphformat\space set to
+ `\string\thesubparagraph\string\quad'\MessageBreak
+ because of loading the standard classes sections hack%
+ }%
+ \renewcommand*{\subparagraphformat}{\thesubparagraph\quad}%
+}
+% \end{macrocode}
+% \end{command}
+%
+% \begin{command}{\partlineswithprefixformat,
+% \chapterlineswithprefixformat,\chapterlinesformat,
+% \sectionlinesformat,\sectioncatchphraseformat}
+% These \KOMAScript{} commands are not used any longer.
+% \begin{macrocode}
+\scr@ifundefinedorrelax{partlineswithprefixformat}{}{%
+ \PackageWarningNoLine{scrhack}{%
+ Usage of \string\partlineswithprefixformat\space deactivated,\MessageBreak
+ because of loading the standard classes sections hack%
+ }%
+}
+\scr@ifundefinedorrelax{chapterlineswithprefixformat}{}{%
+ \PackageWarningNoLine{scrhack}{%
+ Usage of \string\chapterlineswithprefixformat\space and\MessageBreak
+ \string\chapterlinesformat\space deactivated,\MessageBreak
+ because of using standard classes sections hack%
+ }%
+}
+\scr@ifundefinedorrelax{sectionlinesformat}{}{%
+ \PackageWarningNoLine{scrhack}{%
+ Usage of \string\sectionlinesformat\space and\MessageBreak
+ \string\sectioncatchphraseformat\space deactivated,\MessageBreak
+ because of using standard classes sections hack%
+ }%
+}
+% \end{macrocode}
+% \end{command}^^A \partlineswithprefixformat …
+%
+% \begin{option}{headings}
+% The \KOMAScript{} option does not make sense any longer. So it is
+% deactivated and usage will throw an error.
+% \begin{macrocode}
+\scr@ifundefinedorrelax{KOMAClassName}{}{%
+ \PackageWarningNoLine{scrhack}{%
+ KOMA-Script option `headings' removed,\MessageBreak
+ because of loading standard classes sections hack%
+ }%
+ \RelaxFamilyKey[.\KOMAClassFileName]{KOMA}{headings}%
+ \KOMA@kav@removekey{.\KOMAClassFileName}{headings}%
+}
+% \end{macrocode}
+% \end{option}^^A headings
+%
+% \begin{macro}{\scr@class@titlesec@warning}
+% The warning about loading \pkg{titlesec} has to be changes, because we do
+% not expect errors any longer.
+% \begin{macrocode}
+\def\scr@class@titlesec@warning{%
+ \PackageWarning{scrhack}{%
+ Usage of `titlesec' should work, because of\MessageBreak
+ loading the standard classes sections hack.\MessageBreak
+ However, you should know, there is not any\MessageBreak
+ support for this combination by the\MessageBreak
+ KOMA-Script author%
+ }%
+}
+%</standardsections&body>
+% \end{macrocode}
+% \end{macro}^^A \scr@class@titlesec@warning
+%
+% \subsection{Executing options}
+%
+% Last but not least the options have to be processed. In the generated
+% package this will be done before the commands of \autoref{sec:macros}.
+% \begin{macrocode}
+%<*package&option>
+\KOMAProcessOptions\relax
+%</package&option>
+% \end{macrocode}
+%
+% \Finale
+% \PrintChanges
+%
+\endinput
+% Local Variables:
+% mode: doctex
+% ispell-local-dictionary: "en_US"
+% eval: (flyspell-mode 1)
+% TeX-master: t
+% TeX-engine: luatex-dev
+% eval: (setcar (or (cl-member "Index" (setq-local TeX-command-list (copy-alist TeX-command-list)) :key #'car :test #'string-equal) (setq-local TeX-command-list (cons nil TeX-command-list))) '("Index" "mkindex %s" TeX-run-index nil t :help "makeindex for dtx"))
+% End: