| 1 |
% \iffalse meta-comment |
| 2 |
% ====================================================================== |
| 3 |
% scrhack-2023-07-07.dtx |
| 4 |
% Copyright © 2008–2023 Markus Kohm |
| 5 |
% |
| 6 |
% This work is a KOMA-Script spin-off. For the original sources of |
| 7 |
% KOMA-Script's `scrhack.sty' see file `scrhack.dtx' in the KOMA-Script |
| 8 |
% sources at <https://sourceforge.net/p/koma-script/code/>. |
| 9 |
% |
| 10 |
% Development is taking place as part of `scrhack' at |
| 11 |
% <https://github.com/komascript/third-party-enhancements>. New issues |
| 12 |
% should be reported there as well as known issues can be found. |
| 13 |
% |
| 14 |
% This work may be distributed and/or modified under the conditions of |
| 15 |
% the LaTeX Project Public License, version 1.3c of the license. |
| 16 |
% The latest version of this license is in |
| 17 |
% http://www.latex-project.org/lppl.txt |
| 18 |
% and version 1.<3c or later is part of all distributions of LaTeX |
| 19 |
% version 2005/12/01 or later and of this work. |
| 20 |
% |
| 21 |
% This work has the LPPL maintenance status "author-maintained". |
| 22 |
% |
| 23 |
% The Current Maintainer and author of this work is Markus Kohm. |
| 24 |
% |
| 25 |
% This work consists of the file `scrhack.dtx', |
| 26 |
% `scrhack-2023-07-07,dtx', and `README.md'. |
| 27 |
% |
| 28 |
% The recommended way to install `scrhack' is to use |
| 29 |
% the package manager of your TeX distribution. |
| 30 |
% ====================================================================== |
| 31 |
% |
| 32 |
%<package&identify>%%% using: package,identify |
| 33 |
%<package&option>%%% using: package,option |
| 34 |
%<package&body>%%% using: package,body |
| 35 |
%<package&identity>\NeedsTeXFormat{LaTeX2e}[1995/06/01] |
| 36 |
%<*dtx> |
| 37 |
\ifx\ProvidesFile\undefined\def\ProvidesFile#1[#2]{}\fi |
| 38 |
\begingroup |
| 39 |
\def\filedate$#1: #2-#3-#4 #5${\gdef\filedate{#2/#3/#4}} |
| 40 |
\filedate$Date: 2023-06-28 10:28:26 +0200 (Mi, 28 Jun 2023) $ |
| 41 |
\def\filerevision$#1: #2 ${\gdef\filerevision{r#2}} |
| 42 |
\filerevision$Revision: 4063 $ |
| 43 |
\endgroup |
| 44 |
\ProvidesFile{scrhack-2023-07-07.dtx}[\filedate\space\filerevision\space |
| 45 |
%</dtx> |
| 46 |
%<package&identify>\ProvidesPackage{scrhack}[% |
| 47 |
%<hyperref&identify>\ProvidesFile{hyperref.hak}[% |
| 48 |
%<float&identify>\ProvidesFile{float.hak}[% |
| 49 |
%<floatrow&identify>\ProvidesFile{floatrow.hak}[% |
| 50 |
%<listings&identify>\ProvidesFile{listings.hak}[% |
| 51 |
%<setspace&identify>\ProvidesFile{setspace.hak}[% |
| 52 |
%<lscape&identify>\ProvidesFile{lscape.hak}[% |
| 53 |
%<nomencl&identify>\ProvidesFile{nomencl.hak}[% |
| 54 |
%<standardsections&identify>\ProvidesFile{standardsections.hak}[% |
| 55 |
%<*dtx|identify> |
| 56 |
2024-04-17 v3.42 |
| 57 |
%<*dtx> |
| 58 |
source of |
| 59 |
%</dtx> |
| 60 |
%<*dtx|package> |
| 61 |
legacy version of package scrhack% |
| 62 |
%</dtx|package> |
| 63 |
%<*hack> |
| 64 |
%<hack> scrhack part |
| 65 |
%<!standardsections> (hacking package |
| 66 |
%<hyperref&identify> hyperref)% |
| 67 |
%<float&identify> float)% |
| 68 |
%<floatrow&identify> floatrow)% |
| 69 |
%<listings&identify> listings)% |
| 70 |
%<setspace&identify> setspace)% |
| 71 |
%<lscape&identify> lscape)% |
| 72 |
%<nomencl&identify> nomencl)% |
| 73 |
%<standardsections&identify> (defining standard LaTeX class section headings)% |
| 74 |
%</hack> |
| 75 |
] |
| 76 |
%</dtx|identify> |
| 77 |
%<*dtx> |
| 78 |
\ifx\documentclass\undefined |
| 79 |
\input docstrip.tex |
| 80 |
\generate{% |
| 81 |
\file{scrhack-2023-07-07.sty}{% |
| 82 |
\from{scrhack-2023-07-07.dtx}{package,identify}% |
| 83 |
\from{scrhack-2023-07-07.dtx}{package,option}% |
| 84 |
\from{scrhack-2023-07-07.dtx}{package,body}% |
| 85 |
}% |
| 86 |
\file{hyperref.hak}{% |
| 87 |
\from{scrhack-2023-07-07.dtx}{hack,hyperref,identify}% |
| 88 |
\from{scrhack-2023-07-07.dtx}{hack,hyperref,body}% |
| 89 |
}% |
| 90 |
\file{float.hak}{% |
| 91 |
\from{scrhack-2023-07-07.dtx}{hack,float,identify}% |
| 92 |
\from{scrhack-2023-07-07.dtx}{hack,float,body}% |
| 93 |
}% |
| 94 |
\file{floatrow.hak}{% |
| 95 |
\from{scrhack-2023-07-07.dtx}{hack,floatrow,identify}% |
| 96 |
\from{scrhack-2023-07-07.dtx}{hack,floatrow,body}% |
| 97 |
}% |
| 98 |
\file{listings.hak}{% |
| 99 |
\from{scrhack-2023-07-07.dtx}{hack,listings,identify}% |
| 100 |
\from{scrhack-2023-07-07.dtx}{hack,listings,body}% |
| 101 |
}% |
| 102 |
\file{setspace.hak}{% |
| 103 |
\from{scrhack-2023-07-07.dtx}{hack,setspace,identify}% |
| 104 |
\from{scrhack-2023-07-07.dtx}{hack,setspace,body}% |
| 105 |
}% |
| 106 |
\file{lscape.hak}{% |
| 107 |
\from{scrhack-2023-07-07.dtx}{hack,lscape,identify}% |
| 108 |
\from{scrhack-2023-07-07.dtx}{hack,lscape,body}% |
| 109 |
}% |
| 110 |
\file{nomencl.hak}{% |
| 111 |
\from{scrhack-2023-07-07.dtx}{hack,nomencl,identify}% |
| 112 |
\from{scrhack-2023-07-07.dtx}{hack,nomencl,body}% |
| 113 |
}% |
| 114 |
\file{standardsections.hak}{% |
| 115 |
\from{scrhack-2023-07-07.dtx}{hack,standardsections,identify}% |
| 116 |
\from{scrhack-2023-07-07.dtx}{hack,standardsections,body}% |
| 117 |
}% |
| 118 |
} |
| 119 |
\else |
| 120 |
\let\endbatchfile\relax |
| 121 |
\fi |
| 122 |
\endbatchfile |
| 123 |
\documentclass[USenglish]{koma-script-source-doc} |
| 124 |
\usepackage{babel} |
| 125 |
\setcounter{StandardModuleDepth}{2} |
| 126 |
\begin{document} |
| 127 |
\DocInput{scrhack-2023-07-07.dtx} |
| 128 |
\end{document} |
| 129 |
%</dtx> |
| 130 |
%\fi |
| 131 |
% |
| 132 |
% \changes{v3.03}{2009/03/12}{first version ever} |
| 133 |
% \changes{v3.36}{2022/02/08}{switch over from \cls*{scrdoc} to |
| 134 |
% \cls*{koma-script-source-doc}} |
| 135 |
% \changes{v3.36}{2022/02/08}{require package \pkg*{scrlogo} instead of |
| 136 |
% defining \cs{KOMAScript}} |
| 137 |
% \changes{v3.36}{2022/02/08}{whole implementation documentation in English} |
| 138 |
% \changes{v3.40}{2023/04/17}{guide names changed} |
| 139 |
% |
| 140 |
% \GetFileInfo{scrhack.dtx} |
| 141 |
% \title{Legacy Version of Package \pkg*{scrhack}} |
| 142 |
% \author{\href{mailto:[email protected]}{Markus Kohm}} |
| 143 |
% \date{2023-07-15} |
| 144 |
% \maketitle |
| 145 |
% \tableofcontents |
| 146 |
% |
| 147 |
% \section{User Manual} |
| 148 |
% |
| 149 |
% You can find the user manual of the legacy version in |
| 150 |
% \href{file:scrhack.pdf}{the manual of \pkg*{scrhack}}. |
| 151 |
% |
| 152 |
% \MaybeStop{\PrintIndex} |
| 153 |
% |
| 154 |
% \section{Implementation of the Legacy Version of |
| 155 |
% \texorpdfstring{\pkg*{scrhack}}{scrhack}} |
| 156 |
% |
| 157 |
% \changes{v3.04b}{2009/08/05}{order of commands/macros and options changed} |
| 158 |
% |
| 159 |
% \subsection{Options} |
| 160 |
% |
| 161 |
% The package uses \cs{KOMAoptions} of \pkg*{scrkbase} and needs at least the |
| 162 |
% one of \KOMAScript{} v3.39: |
| 163 |
% \begin{macrocode} |
| 164 |
%<*package&option> |
| 165 |
\RequirePackage{scrkbase}[2022-11-11] |
| 166 |
\@ifpackagelater{scrkbase}{2023-07-14}{% |
| 167 |
\PackageInfo{scrhack}{KOMA-Script >= 3.42 detected.\MessageBreak |
| 168 |
In this case you should not use this legacy version of\MessageBreak |
| 169 |
scrhack, but should be able to use the current version\MessageBreak |
| 170 |
or even replace loading scrhack by loading really\MessageBreak |
| 171 |
needed third-party patches, e.g., floatbytocbasic.\MessageBreak |
| 172 |
But you are the boss ..}% |
| 173 |
}{% |
| 174 |
\@ifpackagelater{scrkbase}{2022-11-11}{% |
| 175 |
\PackageWarningNoLine{scrhack}{KOMA-Script < 3.42 detected.\MessageBreak |
| 176 |
In this case the original scrhack of that version\MessageBreak |
| 177 |
should also be installed and used instead of this\MessageBreak |
| 178 |
legacy package}% |
| 179 |
}{% |
| 180 |
\PackageError{scrhack}{incompatible KOMA-Script < v3.39 detected}{% |
| 181 |
This error is fatal!\MessageBreak |
| 182 |
Loading of scrhack will be aborted!}% |
| 183 |
\expandafter\let\csname [email protected]\endcsname\undefined |
| 184 |
\endinput |
| 185 |
}% |
| 186 |
} |
| 187 |
%</package&option> |
| 188 |
% \end{macrocode} |
| 189 |
% The options allow the selection of the used manipulations of other |
| 190 |
% packages. But all these options are valid only until both \pkg*{scrhack} and |
| 191 |
% the other package has been loaded. Later settings are invalid. |
| 192 |
% |
| 193 |
% |
| 194 |
% \subsection{Used Macros and Commands} |
| 195 |
% \label{sec:macros} |
| 196 |
% \begin{macrocode} |
| 197 |
%<*package&body> |
| 198 |
% \end{macrocode} |
| 199 |
% |
| 200 |
% \begin{macro}{\scr@ifexpected} |
| 201 |
% Mentioned to do (re)definitions only, if local execution of code does not |
| 202 |
% change a command. Concrete, if (local) execution of \marg{test code} of |
| 203 |
% \begin{quote} |
| 204 |
% \cs{scr@ifexpected}\marg{command}\marg{test code}\marg{then |
| 205 |
% code}\marg{else code} |
| 206 |
% \end{quote} |
| 207 |
% would not result in a change of \cs{\meta{command}}, the \marg{then code} |
| 208 |
% will be executed, otherwise the \marg{else code}. |
| 209 |
% \begin{description}\item[Note:] \meta{test code} must not have any global |
| 210 |
% side effect!\end{description} |
| 211 |
% \begin{macrocode} |
| 212 |
\newcommand{\scr@ifexpected}[2]{% |
| 213 |
\begingroup |
| 214 |
\let\@tempa#1 |
| 215 |
#2 |
| 216 |
\ifx\@tempa#1 |
| 217 |
\aftergroup\@firstoftwo |
| 218 |
\else |
| 219 |
\aftergroup\@secondoftwo |
| 220 |
\fi |
| 221 |
\endgroup |
| 222 |
} |
| 223 |
% \end{macrocode} |
| 224 |
% \end{macro} |
| 225 |
% |
| 226 |
% \begin{macro}{\scr@hack@load} |
| 227 |
% Conditionally loading of a hack file. |
| 228 |
% \begin{quote} |
| 229 |
% \cs{scr@hack@load}\marg{extension}\marg{basename}\marg{hack}% |
| 230 |
% \marg{true code}\marg{false code} |
| 231 |
% \end{quote} |
| 232 |
% The first two arguments \marg{} and \marg{extension} and \marg{basename} are |
| 233 |
% same to the internal\LaTeX{} kernel command \cs{@ifl@aded}. With \LaTeX{} |
| 234 |
% from 2021/11/15 we even could use \cs{@ifl@aded} for the test, because it is |
| 235 |
% not restricted to the preamble any more. But because it is restricted with |
| 236 |
% older \LaTeX{} kernels, we test the definition of |
| 237 |
% \cs{ver@}\meta{basename}\texttt{.}\meta{extension}. If it is defined, we |
| 238 |
% also test the definition of \cs{ver@}\meta{basename}\texttt{.hak}. If this |
| 239 |
% is not defined, \file{\meta{hack}.hak} is loaded and \meta{true code} is |
| 240 |
% executed. Otherwise \meta{false code} is executed. This means: A hack file |
| 241 |
% is only loaded, if a class or package (or other file with version) has |
| 242 |
% already been loaded, but the hack file has not already been loaded. |
| 243 |
% \begin{macrocode} |
| 244 |
\newcommand*{\scr@hack@load}[2]{% |
| 245 |
\expandafter\ifx\csname ver@#2.#1\endcsname\relax |
| 246 |
\expandafter\@secondoftwo |
| 247 |
\else |
| 248 |
% \end{macrocode} |
| 249 |
% Load a hack only once. |
| 250 |
% \begin{macrocode} |
| 251 |
\expandafter\ifx\csname ver@#2.hak\endcsname\relax |
| 252 |
\expandafter\expandafter\expandafter\@firstoftwo |
| 253 |
\else |
| 254 |
\expandafter\expandafter\expandafter\@secondoftwo |
| 255 |
\fi |
| 256 |
\fi |
| 257 |
{% |
| 258 |
\PackageInfo{scrhack}{loading #2 hack}% |
| 259 |
\edef\reserved@a{% |
| 260 |
\noexpand\makeatletter\noexpand\input{#2.hak}% |
| 261 |
\noexpand\catcode`\noexpand\@\the\catcode`\@\relax |
| 262 |
}\reserved@a |
| 263 |
}{% |
| 264 |
\PackageInfo{scrhack}{ignorring #2 hack}% |
| 265 |
}% |
| 266 |
} |
| 267 |
% \end{macrocode} |
| 268 |
% \end{macro} |
| 269 |
% |
| 270 |
% \begin{macrocode} |
| 271 |
%</package&body> |
| 272 |
% \end{macrocode} |
| 273 |
% |
| 274 |
% \subsection{The \texorpdfstring{\pkg*{hyperref}}{hyperref} hack} |
| 275 |
% |
| 276 |
% Package \pkg{hyperref} places the anchor of the star variant of a heading |
| 277 |
% after the heading, but the anchor of the normal variant before the heading |
| 278 |
% even if the heading is not numbered because of the value of |
| 279 |
% \cnt{secnumdepth}. The hack changes this to more consistent placing always |
| 280 |
% before the heading. |
| 281 |
% |
| 282 |
% \begin{option}{hyperref} |
| 283 |
% \changes{v3.12}{2013/03/05}{using \cs{FamilyKeyStateProcessed}} |
| 284 |
% \changes{v3.17}{2015/03/09}{defaults by \cs{KOMAExecuteOptions}} |
| 285 |
% \begin{macrocode} |
| 286 |
%<*package&option> |
| 287 |
\KOMA@ifkey{hyperref}{@scrhack@hyperref}% |
| 288 |
\KOMAExecuteOptions{hyperref=true}% |
| 289 |
%</package&option> |
| 290 |
% \end{macrocode} |
| 291 |
% \changes{v3.04b}{2009/11/09}{loading \pkg{hyperref} hack earlier} |
| 292 |
% \changes{v3.17}{2015/03/09}{auto deactivation for newer versions of |
| 293 |
% \pkg{hyperref}} |
| 294 |
% \changes{v3.18}{2015/05/22}{newer versions of \KOMAScript{} classes also |
| 295 |
% deactivate the the hack} |
| 296 |
% \changes{v3.39}{2022/11/11}{initial dot in member argument of \cs{KOMA@key} |
| 297 |
% and \cs{KOMAExecuteOptions} removed} |
| 298 |
% This is a little bit tricky, because \pkg{hyperref} loads the driver file |
| 299 |
% via \cs{AtEndOfPackage} and the hack cannot be loaded before loading the |
| 300 |
% driver file. Using \cs{AfterPackage*} would not be good enough therefore, |
| 301 |
% because it would load the hack before the driver file. But using |
| 302 |
% \cs{AtEndOfPackage} inside \cs{AfterPackage*} should delay the loading |
| 303 |
% enough. This also works, if \pkg{hyperref} has already been loaded. In this |
| 304 |
% case the code will be executed at the end of \pkg*{scrhack} instead of |
| 305 |
% \pkg{hyperref}. This is no problem. |
| 306 |
% \begin{macrocode} |
| 307 |
%<*package&body> |
| 308 |
\BeforePackage{hyperref}{% |
| 309 |
\scr@ifundefinedorrelax{hy@insteadofrefstepcounter}{}{% |
| 310 |
\PackageInfo{scrhack}{hyperref hack deactivated because of\MessageBreak |
| 311 |
detection of KOMA-Script class, that doesn't\MessageBreak |
| 312 |
need that hack,}% |
| 313 |
\KOMAExecuteOptions[scrhack.sty]{hyperref=false}% |
| 314 |
}% |
| 315 |
} |
| 316 |
\AfterPackage*{hyperref}{% |
| 317 |
\if@scrhack@hyperref |
| 318 |
\@ifpackagelater{hyperref}{2009/11/24}{% |
| 319 |
\PackageInfo{scrhack}{hyperref hack deactivated because of\MessageBreak |
| 320 |
detection of hyperref version, that doesn't\MessageBreak |
| 321 |
need that hack,}% |
| 322 |
\KOMAExecuteOptions[scrhack.sty]{hyperref=false}% |
| 323 |
}{% |
| 324 |
\AtEndOfPackage{% |
| 325 |
\KOMA@key[scrhack.sty]{hyperref}[true]{% |
| 326 |
\PackageWarning{scrhack}{option `hyperref=#1' ignored}% |
| 327 |
\FamilyKeyStateProcessed |
| 328 |
}% |
| 329 |
\if@scrhack@hyperref\scr@hack@load\@pkgextension{hyperref}\fi |
| 330 |
}% |
| 331 |
}% |
| 332 |
\fi |
| 333 |
} |
| 334 |
%</package&body> |
| 335 |
% \end{macrocode} |
| 336 |
% \end{option} |
| 337 |
% |
| 338 |
% |
| 339 |
% \begin{macro}{\@schapter,\@spart,\@ssect} |
| 340 |
% We do not hack \pkg{hyperref} itself, but the driver files. After loading |
| 341 |
% \pkg{hyperref} the driver file is also loaded. Moreover, all driver files |
| 342 |
% that re-define these commands have to be patched also. So the patch is |
| 343 |
% related to the loading of \pkg{hyperref} instead of every single driver |
| 344 |
% file. This have already been tested by \cs{scr@hack@load}. So we just have |
| 345 |
% to test, whether the definition of these commands are the expected one. |
| 346 |
% derzeit den erwarteten Inhalt haben. |
| 347 |
% \begin{macrocode} |
| 348 |
%<*hyperref&body> |
| 349 |
\scr@ifexpected\@schapter{% |
| 350 |
\def\@schapter#1{% |
| 351 |
\H@old@schapter{#1}% |
| 352 |
\begingroup |
| 353 |
\let\@mkboth\@gobbletwo |
| 354 |
\Hy@GlobalStepCount\Hy@linkcounter |
| 355 |
\xdef\@currentHref{\Hy@chapapp*.\the\Hy@linkcounter}% |
| 356 |
\Hy@raisedlink{% |
| 357 |
\hyper@anchorstart{\@currentHref}\hyper@anchorend |
| 358 |
}% |
| 359 |
\endgroup |
| 360 |
}% |
| 361 |
}{% |
| 362 |
\PackageInfo{scrhack}{redefining \string\@schapter}% |
| 363 |
\def\@schapter#1{% |
| 364 |
\begingroup |
| 365 |
\let\@mkboth\@gobbletwo |
| 366 |
\Hy@GlobalStepCount\Hy@linkcounter |
| 367 |
\xdef\@currentHref{\Hy@chapapp*.\the\Hy@linkcounter}% |
| 368 |
\Hy@raisedlink{% |
| 369 |
\hyper@anchorstart{\@currentHref}\hyper@anchorend |
| 370 |
}% |
| 371 |
\endgroup |
| 372 |
\H@old@schapter{#1}% |
| 373 |
}% |
| 374 |
}{% |
| 375 |
\scr@ifexpected\@schapter{% |
| 376 |
\def\@schapter#1{% |
| 377 |
\begingroup |
| 378 |
\let\@mkboth\@gobbletwo |
| 379 |
\Hy@GlobalStepCount\Hy@linkcounter |
| 380 |
\xdef\@currentHref{\Hy@chapapp*.\the\Hy@linkcounter}% |
| 381 |
\Hy@raisedlink{% |
| 382 |
\hyper@anchorstart{\@currentHref}\hyper@anchorend |
| 383 |
}% |
| 384 |
\endgroup |
| 385 |
\H@old@schapter{#1}% |
| 386 |
}% |
| 387 |
}{}{% |
| 388 |
\PackageWarningNoLine{scrhack}{unknown \string\@schapter\space |
| 389 |
definition found!\MessageBreak |
| 390 |
Maybe you are using a unsupported hyperref version}% |
| 391 |
}% |
| 392 |
} |
| 393 |
\scr@ifexpected\@spart{% |
| 394 |
\def\@spart#1{% |
| 395 |
\H@old@spart{#1}% |
| 396 |
\Hy@GlobalStepCount\Hy@linkcounter |
| 397 |
\xdef\@currentHref{part*.\the\Hy@linkcounter}% |
| 398 |
\Hy@raisedlink{% |
| 399 |
\hyper@anchorstart{\@currentHref}\hyper@anchorend |
| 400 |
}% |
| 401 |
}% |
| 402 |
}{% |
| 403 |
\PackageInfo{scrhack}{redefining \string\@spart}% |
| 404 |
\def\@spart#1{% |
| 405 |
\Hy@GlobalStepCount\Hy@linkcounter |
| 406 |
\xdef\@currentHref{part*.\the\Hy@linkcounter}% |
| 407 |
\Hy@raisedlink{% |
| 408 |
\hyper@anchorstart{\@currentHref}\hyper@anchorend |
| 409 |
}% |
| 410 |
\H@old@spart{#1}% |
| 411 |
}% |
| 412 |
}{% |
| 413 |
\scr@ifexpected\@spart{% |
| 414 |
\def\@spart#1{% |
| 415 |
\Hy@GlobalStepCount\Hy@linkcounter |
| 416 |
\xdef\@currentHref{part*.\the\Hy@linkcounter}% |
| 417 |
\Hy@raisedlink{% |
| 418 |
\hyper@anchorstart{\@currentHref}\hyper@anchorend |
| 419 |
}% |
| 420 |
\H@old@spart{#1}% |
| 421 |
}% |
| 422 |
}{}{% |
| 423 |
\PackageWarningNoLine{scrhack}{unknown \string\@spart\space |
| 424 |
definition found!\MessageBreak |
| 425 |
Maybe you are using a unsupported hyperref version}% |
| 426 |
}% |
| 427 |
} |
| 428 |
\scr@ifexpected\@ssect{% |
| 429 |
\def\@ssect#1#2#3#4#5{% |
| 430 |
\H@old@ssect{#1}{#2}{#3}{#4}{#5}% |
| 431 |
\phantomsection |
| 432 |
}% |
| 433 |
}{% |
| 434 |
\PackageInfo{scrhack}{redefining \string\@ssect}% |
| 435 |
\def\@ssect#1#2#3#4#5{% |
| 436 |
\H@old@ssect{#1}{#2}{#3}{#4}{\phantomsection\ignorespaces#5}% |
| 437 |
}% |
| 438 |
}{% |
| 439 |
\scr@ifexpected\@ssect{% |
| 440 |
\def\@ssect#1#2#3#4#5{% |
| 441 |
\H@old@ssect{#1}{#2}{#3}{#4}{\phantomsection\ignorespaces#5}% |
| 442 |
}% |
| 443 |
}{}{% |
| 444 |
\PackageWarningNoLine{scrhack}{unknown \string\@ssect\space |
| 445 |
definition found!\MessageBreak |
| 446 |
Maybe you are using a unsupported hyperref version}% |
| 447 |
}% |
| 448 |
} |
| 449 |
%</hyperref&body> |
| 450 |
% \end{macrocode} |
| 451 |
% \end{macro} |
| 452 |
% |
| 453 |
% |
| 454 |
% \subsection{The \texorpdfstring{\pkg*{floatrow}}{floatrow} hack} |
| 455 |
% |
| 456 |
% Package \pkg{floatrow} insists in using \cs{float@listhead} for the setting |
| 457 |
% of the headings. This is not recommended any longer since \KOMAScript~2.95 |
| 458 |
% from July 2006! The \KOMAScript{} classes will remove the support for |
| 459 |
% this very limited approach. Recommended is the usage of \pkg*{tocbasic}. The |
| 460 |
% effort to do so, it very small and I do not understand, why package authors |
| 461 |
% are not willing to use it. Because the benefit would be a lot. |
| 462 |
% |
| 463 |
% This hack adds \pkg*{tocbasic} usage to \pkg{floatrow}. Nevertheless it is |
| 464 |
% more complicated than adding \pkg*{tocbasic} support into \pkg{floatrow}. |
| 465 |
% |
| 466 |
% \begin{option}{floatrow} |
| 467 |
% \changes{v3.12}{2013/03/05}{using \cs{FamilyKeyStateProcessed}} |
| 468 |
% \changes{v3.17}{2015/03/09}{using \cs{KOMAExecuteOptions}} |
| 469 |
% \changes{v3.34}{2021/06/03}{deactivation of the \pkg{float} hack} |
| 470 |
% \changes{v3.39}{2022/11/11}{initial dot in member argument of \cs{KOMA@key} |
| 471 |
% removed} |
| 472 |
% \begin{macrocode} |
| 473 |
%<*package&option> |
| 474 |
\KOMA@ifkey{floatrow}{@scrhack@floatrow} |
| 475 |
\KOMAExecuteOptions{floatrow=true} |
| 476 |
%</package&option> |
| 477 |
%<*package&body> |
| 478 |
\AfterPackage*{floatrow}{% |
| 479 |
\KOMAoptions{float=false}% |
| 480 |
\PackageInfo{scrhack}{option `float' deactivated}% |
| 481 |
\KOMA@key[scrhack.sty]{floatrow}{% |
| 482 |
\PackageWarning{scrhack}{option `floatrow' ignored}% |
| 483 |
\FamilyKeyStateProcessed |
| 484 |
}% |
| 485 |
\if@scrhack@floatrow\scr@hack@load\@pkgextension{floatrow}\fi |
| 486 |
} |
| 487 |
%</package&body> |
| 488 |
% \end{macrocode} |
| 489 |
% \end{option} |
| 490 |
% |
| 491 |
% |
| 492 |
% \begin{command}{\DeclareNewFloatType,\listof} |
| 493 |
% \changes{v3.25}{2018/03/16}{using \cs{DeclareTOCStyleEntry}} |
| 494 |
% Command \cs{DeclareNewFloatType} is used to define a new float |
| 495 |
% environment. We have to add registration of the file extension (third |
| 496 |
% argument) with \pkg*{tocbasic}. |
| 497 |
% Command \cs{listof} outputs the list of the float environments. Here we |
| 498 |
% just use the corresponding macro of \pkg*{tocbasic}. |
| 499 |
% \begin{macro}{\float@addtolists} |
| 500 |
% The deprecated macro \cs{float@addtolists} is not needed any longer an will |
| 501 |
% be reset to the original definition. |
| 502 |
% \begin{macrocode} |
| 503 |
%<*floatrow&body> |
| 504 |
\scr@ifexpected{\DeclareNewFloatType}{% |
| 505 |
\long\def\DeclareNewFloatType#1#2{\def\FB@captype{#1}% |
| 506 |
\expandafter\edef\csname ftype@#1\endcsname{\the\c@float@type}% |
| 507 |
\addtocounter{float@type}{\value{float@type}}% |
| 508 |
\@namedef{#1name}{#1}\newcounter{#1}% |
| 509 |
\expandafter\edef\csname fnum@#1\endcsname |
| 510 |
{\expandafter\noexpand\csname #1name\endcsname\nobreakspace |
| 511 |
\expandafter\noexpand\csname the#1\endcsname}% |
| 512 |
\@namedef{the#1}{\arabic{#1}}\flnew@ext{lo#1}\@namedef{fps@#1}{tbp}% |
| 513 |
\@namedef{l@#1}{\@dottedtocline{1}{1.5em}{2.3em}}% |
| 514 |
\caption@setkeys[floatrow]{newfloat}{#2}\let\FR@tmp=\relax |
| 515 |
\xdef\@tempa{\noexpand\flrow@types{\the\flrow@types \FR@tmp{#1}}}% |
| 516 |
\@tempa}% |
| 517 |
}{% |
| 518 |
\scr@ifexpected{\listof}{% |
| 519 |
\def\listof#1#2{% |
| 520 |
\@ifundefined{ext@#1}{\flrow@error{Unknown float style `#1'}}{% |
| 521 |
\expandafter\providecommand\csname l@#1\endcsname |
| 522 |
{\@dottedtocline{1}{1.5em}{2.3em}}% |
| 523 |
\float@listhead{#2}% |
| 524 |
\begingroup\setlength{\parskip}{\z@}% |
| 525 |
\@starttoc{\@nameuse{ext@#1}}% |
| 526 |
\endgroup}}% |
| 527 |
}{% |
| 528 |
\RequirePackage{tocbasic}% |
| 529 |
\PackageInfo{scrhack}{redefining \string\DeclareNewFloatType}% |
| 530 |
% \end{macrocode} |
| 531 |
% \begin{description} |
| 532 |
% \item[Note:] It would be better to first test, if the new extension is |
| 533 |
% already in use like done at the \pkg{float} hack. But I don't know the |
| 534 |
% \pkg{floatrow} code good enough to make such a change! |
| 535 |
% \end{description} |
| 536 |
% \begin{macrocode} |
| 537 |
\renewcommand\DeclareNewFloatType[2]{\def\FB@captype{#1}% |
| 538 |
\expandafter\edef\csname ftype@#1\endcsname{\the\c@float@type}% |
| 539 |
\addtocounter{float@type}{\value{float@type}}% |
| 540 |
\@namedef{#1name}{#1}\newcounter{#1}% |
| 541 |
\expandafter\edef\csname fnum@#1\endcsname |
| 542 |
{\expandafter\noexpand\csname #1name\endcsname\nobreakspace |
| 543 |
\expandafter\noexpand\csname the#1\endcsname}% |
| 544 |
\@namedef{the#1}{\arabic{#1}}\flnew@ext{lo#1}\@namedef{fps@#1}{tbp}% |
| 545 |
\DeclareTOCStyleEntry[level=1,numwidth=2.3em,indent=1.5em]{default}{#1}% |
| 546 |
\caption@setkeys[floatrow]{newfloat}{#2}\let\FR@tmp=\relax |
| 547 |
\xdef\@tempa{\noexpand\flrow@types{\the\flrow@types \FR@tmp{#1}}}% |
| 548 |
\@tempa |
| 549 |
\xdef\@tempa{\noexpand\addtotoclist[float]{\@nameuse{ext@\FB@captype}}% |
| 550 |
\noexpand\setuptoc{\@nameuse{ext@\FB@captype}}{chapteratlist}% |
| 551 |
}% |
| 552 |
\@tempa |
| 553 |
}% |
| 554 |
\PackageInfo{scrhack}{redefining \string\listof}% |
| 555 |
\renewcommand*\listof[2]{% |
| 556 |
\@ifundefined{ext@#1}{\flrow@error{Unknown float style `#1'}}{% |
| 557 |
\@ifundefined{l@#1}{\expandafter\let\csname l@#1\endcsname\l@figure |
| 558 |
\@ifundefined{l@#1}{% |
| 559 |
\DeclareTOCStyleEntry[level=1,numwidth=2.3em,indent=1.5em] |
| 560 |
{default}{#1}% |
| 561 |
}{}% |
| 562 |
}{}% |
| 563 |
\listoftoc[{#2}]{\csname ext@#1\endcsname}% |
| 564 |
}% |
| 565 |
}% |
| 566 |
\scr@ifexpected{\float@addtolists}{% |
| 567 |
\long\def\float@addtolists#1{% |
| 568 |
\def\float@do##1{\addtocontents{##1}{#1}} \the\float@exts}% |
| 569 |
}{% |
| 570 |
\PackageInfo{scrhack}{undefining \string\float@addtolists}% |
| 571 |
\let\float@addtolists\relax |
| 572 |
}{% |
| 573 |
\PackageWarningNoLine{scrhack}{unkown \string\float@addtolists\space |
| 574 |
definition found!\MessageBreak |
| 575 |
Maybe you are using a unsupported floatrow version}% |
| 576 |
}% |
| 577 |
}{% |
| 578 |
\PackageWarningNoLine{scrhack}{unknown \string\listof\space |
| 579 |
definition found!\MessageBreak |
| 580 |
Maybe you are using a unsupported floatrow version}% |
| 581 |
}% |
| 582 |
}{% |
| 583 |
\PackageWarningNoLine{scrhack}{unknown \string\DeclareNewFloatType\space |
| 584 |
definition found!\MessageBreak |
| 585 |
Maybe you are using a unsupported floatrow version}% |
| 586 |
} |
| 587 |
%</floatrow&body> |
| 588 |
% \end{macrocode} |
| 589 |
% \end{macro} |
| 590 |
% \end{command} |
| 591 |
% |
| 592 |
% |
| 593 |
% \subsection{The \texorpdfstring{\pkg*{float}}{float} hack} |
| 594 |
% |
| 595 |
% Package \pkg{float} insists in using \cs{float@listhead} for the setting |
| 596 |
% of the headings. This is not recommended any longer since \KOMAScript~2.95 |
| 597 |
% from July 2006! The \KOMAScript{} classes will remove the support for |
| 598 |
% this very limited approach. Recommended is the usage of \pkg*{tocbasic}. The |
| 599 |
% effort to do so, it very small and I do not understand, why package authors |
| 600 |
% are not willing to use it. Because the benefit would be a lot. |
| 601 |
% |
| 602 |
% This hack adds \pkg*{tocbasic} usage to \pkg{float}. Nevertheless it is |
| 603 |
% more complicated than adding \pkg*{tocbasic} support into \pkg{float}. |
| 604 |
% |
| 605 |
% \begin{option}{float} |
| 606 |
% \changes{v3.12}{2013/03/05}{using \cs{FamilyKeyStateProcessed}} |
| 607 |
% \changes{v3.17}{2015/03/09}{using \cs{KOMAExecuteOptions}} |
| 608 |
% \changes{v3.39}{2022/11/11}{initial dot in member argument of \cs{KOMA@key} |
| 609 |
% removed} |
| 610 |
% \begin{macrocode} |
| 611 |
%<*package&option> |
| 612 |
\KOMA@ifkey{float}{@scrhack@float}% |
| 613 |
\KOMAExecuteOptions{float=true}% |
| 614 |
%</package&option> |
| 615 |
%<*package&body> |
| 616 |
\AfterPackage*{float}{% |
| 617 |
\KOMA@key[scrhack.sty]{float}{% |
| 618 |
\PackageWarning{scrhack}{option `float' ignored}% |
| 619 |
\FamilyKeyStateProcessed |
| 620 |
}% |
| 621 |
\if@scrhack@float\scr@hack@load\@pkgextension{float}\fi |
| 622 |
} |
| 623 |
%</package&body> |
| 624 |
% \end{macrocode} |
| 625 |
% \end{option} |
| 626 |
% |
| 627 |
% |
| 628 |
% \begin{command}{\newfloat} |
| 629 |
% \changes{v3.28}{2019/11/19}{\cs{ifattoclist} replaced by |
| 630 |
% \cs{Ifattoclist}} |
| 631 |
% \changes{v3.25}{2018/03/16}{using \cs{DeclareTOCStyleEntry}} |
| 632 |
% We have to add registration of the file extension (third argument of |
| 633 |
% \cs{newfloat}) with \pkg*{tocbasic}. |
| 634 |
% \begin{command}{\listof} |
| 635 |
% Command \cs{listof} outputs the list of the float environments. Here we |
| 636 |
% just use the corresponding macro of \pkg*{tocbasic}. |
| 637 |
% \begin{macro}{\float@addtolists} |
| 638 |
% The deprecated macro \cs{float@addtolists} is not needed any longer an will |
| 639 |
% be reset to the original definition. |
| 640 |
% \begin{macrocode} |
| 641 |
%<*float&body> |
| 642 |
\scr@ifexpected{\newfloat}{% |
| 643 |
\long\def\newfloat#1#2#3{\@namedef{ext@#1}{#3} |
| 644 |
\let\float@do=\relax |
| 645 |
\xdef\@tempa{\noexpand\float@exts{\the\float@exts \float@do{#3}}}% |
| 646 |
\@tempa |
| 647 |
\floatplacement{#1}{#2}% |
| 648 |
\@ifundefined{fname@#1}{\floatname{#1}{#1}}{} |
| 649 |
\expandafter\edef\csname ftype@#1\endcsname{\value{float@type}}% |
| 650 |
\addtocounter{float@type}{\value{float@type}} |
| 651 |
\restylefloat{#1}% |
| 652 |
\expandafter\edef\csname fnum@#1\endcsname% |
| 653 |
{\expandafter\noexpand\csname fname@#1\endcsname{} |
| 654 |
\expandafter\noexpand\csname the#1\endcsname} |
| 655 |
\@ifnextchar[%] |
| 656 |
{\float@newx{#1}}% |
| 657 |
{\@ifundefined{c@#1}{\newcounter{#1}\@namedef{the#1}{\arabic{#1}}}% |
| 658 |
{}}}% |
| 659 |
}{% |
| 660 |
\scr@ifexpected{\listof}{% |
| 661 |
\def\listof#1#2{% |
| 662 |
\@ifundefined{ext@#1}{\float@error{#1}}{% |
| 663 |
\@namedef{l@#1}{\@dottedtocline{1}{1.5em}{2.3em}}% |
| 664 |
\float@listhead{#2}% |
| 665 |
\begingroup\setlength{\parskip}{\z@}% |
| 666 |
\@starttoc{\@nameuse{ext@#1}}% |
| 667 |
\endgroup}}% |
| 668 |
}{% |
| 669 |
\RequirePackage{tocbasic}% |
| 670 |
\PackageInfo{scrhack}{redefining \string\newfloat}% |
| 671 |
\renewcommand\newfloat[3]{% |
| 672 |
\Ifattoclist{#3}{% |
| 673 |
\PackageError{scrhack}{extension `#3' already in use}{% |
| 674 |
Each extension may be used only once.\MessageBreak |
| 675 |
You, the class, or another package already uses extension |
| 676 |
`#3'.\MessageBreak |
| 677 |
\string\newfloat\space command will be ignored!}% |
| 678 |
}{% |
| 679 |
\addtotoclist[float]{#3}% |
| 680 |
\setuptoc{#3}{chapteratlist}% |
| 681 |
\@namedef{ext@#1}{#3}% |
| 682 |
\let\float@do=\relax |
| 683 |
\xdef\@tempa{\noexpand\float@exts{\the\float@exts \float@do{#3}}}% |
| 684 |
\@tempa |
| 685 |
\floatplacement{#1}{#2}% |
| 686 |
\@ifundefined{fname@#1}{\floatname{#1}{#1}}{}% |
| 687 |
\expandafter\edef\csname ftype@#1\endcsname{\value{float@type}}% |
| 688 |
\addtocounter{float@type}{\value{float@type}} |
| 689 |
\restylefloat{#1}% |
| 690 |
\expandafter\edef\csname fnum@#1\endcsname% |
| 691 |
{\expandafter\noexpand\csname fname@#1\endcsname{} |
| 692 |
\expandafter\noexpand\csname the#1\endcsname}% |
| 693 |
\@ifnextchar[%] |
| 694 |
{\float@newx{#1}}% |
| 695 |
{\@ifundefined{c@#1}{\newcounter{#1}\@namedef{the#1}{\arabic{#1}}}% |
| 696 |
{}}}% |
| 697 |
}% |
| 698 |
\PackageInfo{scrhack}{redefining \string\listof}% |
| 699 |
\renewcommand*\listof[2]{% |
| 700 |
\@ifundefined{ext@#1}{\float@error{#1}}{% |
| 701 |
\@ifundefined{l@#1}{\expandafter\let\csname l@#1\endcsname\l@figure |
| 702 |
\@ifundefined{l@#1}{% |
| 703 |
\DeclareTOCStyleEntry[level=1,numwidth=2.3em,indent=1.5em] |
| 704 |
{default}{#1}% |
| 705 |
}{}% |
| 706 |
}{}% |
| 707 |
\listoftoc[{#2}]{\csname ext@#1\endcsname}% |
| 708 |
}% |
| 709 |
}% |
| 710 |
\scr@ifexpected{\float@addtolists}{% |
| 711 |
\long\def\float@addtolists#1{% |
| 712 |
\def\float@do##1{\addtocontents{##1}{#1}} \the\float@exts}% |
| 713 |
}{% |
| 714 |
\PackageInfo{scrhack}{undefining \string\float@addtolists}% |
| 715 |
\let\float@addtolists\relax |
| 716 |
}{% |
| 717 |
\PackageWarningNoLine{scrhack}{unkown \string\float@addtolists\space |
| 718 |
definition found!\MessageBreak |
| 719 |
Maybe you are using a unsupported float version}% |
| 720 |
}% |
| 721 |
}{% |
| 722 |
\PackageWarningNoLine{scrhack}{unknown \string\listof\space |
| 723 |
definition found!\MessageBreak |
| 724 |
Maybe you are using a unsupported float version}% |
| 725 |
}% |
| 726 |
}{% |
| 727 |
\PackageWarningNoLine{scrhack}{unknown \string\newfloat\space |
| 728 |
definition found!\MessageBreak |
| 729 |
Maybe you are using a unsupported float version}% |
| 730 |
} |
| 731 |
%</float&body> |
| 732 |
% \end{macrocode} |
| 733 |
% \end{macro} |
| 734 |
% \end{command} |
| 735 |
% \end{command} |
| 736 |
% |
| 737 |
% |
| 738 |
% \subsection{The \texorpdfstring{\pkg*{listings}}{listings} hack} |
| 739 |
% |
| 740 |
% Package \pkg{listing} insists in using \cs{float@listhead} for the setting |
| 741 |
% of the headings. This is not recommended any longer since \KOMAScript~2.95 |
| 742 |
% from July 2006! The \KOMAScript{} classes will remove the support for |
| 743 |
% this very limited approach. Recommended is the usage of \pkg*{tocbasic}. The |
| 744 |
% effort to do so, it very small and I do not understand, why package authors |
| 745 |
% are not willing to use it. Because the benefit would be a lot. |
| 746 |
% |
| 747 |
% This hack adds \pkg*{tocbasic} usage to old versions of |
| 748 |
% \pkg{listings}. Nevertheless it is more complicated than adding |
| 749 |
% \pkg*{tocbasic} support into \pkg{listings}. |
| 750 |
% |
| 751 |
% \begin{option}{listings} |
| 752 |
% \changes{v3.12}{2013/03/05}{using \cs{FamilyKeyStateProcessed}} |
| 753 |
% \changes{v3.17}{2015/03/09}{using \cs{KOMAExecuteOptions}} |
| 754 |
% \changes{v3.39}{2022/11/11}{initial dot in member argument of \cs{KOMA@key} |
| 755 |
% removed} |
| 756 |
% \changes{v3.42}{2024/04/17}{automatic deactivation for new \pkg{listings}} |
| 757 |
% Note: The deactivation of the hack for new version of \pkg{listings} cannot |
| 758 |
% be done comparing the \pkg{listings} version, because \pkg{listings} version |
| 759 |
% 1.10 uses \cs{AtEndOfPackage} for \cs{ProvidesPackage} and therefore the |
| 760 |
% version is not defined when the after package hook is executed. So we test |
| 761 |
% instead the \pkg{lstmisc} version. |
| 762 |
% \begin{macrocode} |
| 763 |
%<*package&option> |
| 764 |
\KOMA@ifkey{listings}{@scrhack@listings} |
| 765 |
\KOMAExecuteOptions{listings=true} |
| 766 |
%</package&option> |
| 767 |
%<*package&body> |
| 768 |
\AfterPackage*{listings}{% |
| 769 |
\@ifpackagelater{lstmisc}{2024/02/15}{% |
| 770 |
\PackageInfo{scrhack}{listings hack deactivated because of\MessageBreak |
| 771 |
detection of listings version, that doesn't\MessageBreak |
| 772 |
need that hack,}% |
| 773 |
\KOMAExecuteOptions[scrhack.sty]{listings=false}% |
| 774 |
}{% |
| 775 |
\if@scrhack@listings\scr@hack@load\@pkgextension{listings}\fi |
| 776 |
}% |
| 777 |
\KOMA@key[scrhack.sty]{listings}[true]{% |
| 778 |
\PackageWarning{scrhack}{option `listings=#1' ignored}% |
| 779 |
\FamilyKeyStateProcessed |
| 780 |
}% |
| 781 |
} |
| 782 |
%</package&body> |
| 783 |
% \end{macrocode} |
| 784 |
% \end{option} |
| 785 |
% |
| 786 |
% |
| 787 |
% \begin{macro}{\scr@do@hack@listings} |
| 788 |
% \changes{v3.41}{2023/06/28}{patching \cs{lst@MakeCaption} to use |
| 789 |
% \cs{ext@lstlisting}} |
| 790 |
% \begin{command}{\lstlistoflistings} |
| 791 |
% \cs{scr@do@hack@listings} patches \pkg{listings} to use \pkg*{tocbasic} for |
| 792 |
% the whole output of the list of listings. This adds several new features to |
| 793 |
% \pkg{listings}. |
| 794 |
% \begin{macro}{\ext@lstlisting,\lst@MakeCaption,\float@addtolists} |
| 795 |
% Macro \cs{ext@lstlisting} is defined, to make \cs{captionof} work with |
| 796 |
% argument \texttt{lstlisting}. Additionally \cs{lst@MakeCaption} is patched |
| 797 |
% to use the new macro. The deprecated macro \cs{float@addtolists} is not |
| 798 |
% needed any longer an will be reset to the original definition. But, because |
| 799 |
% \pkg{listings} delays the redefinition with \cs{AtBeginDocument} we have to |
| 800 |
% do the same here. |
| 801 |
% \begin{macrocode} |
| 802 |
%<*listings&body> |
| 803 |
\newcommand*{\scr@do@hack@listings}{% |
| 804 |
\RequirePackage{tocbasic}% |
| 805 |
\addtotoclist[float]{lol}% |
| 806 |
\setuptoc{lol}{chapteratlist}% |
| 807 |
\PackageInfo{scrhack}{redefining \string\lstlistoflistings}% |
| 808 |
\renewcommand*{\lstlistoflistings}{\listoftoc[{\lstlistlistingname}]{lol}}% |
| 809 |
\providecommand*{\ext@lstlisting}{lol}% |
| 810 |
\@tempswafalse |
| 811 |
\xpatchcmd\lst@MakeCaption |
| 812 |
{\addcontentsline{lol}}% |
| 813 |
{\addcontentsline{\ext@lstlisting}}% |
| 814 |
{\PackageInfo{scrhack}{patching \string\lst@MakeCaption}\@tempswatrue}% |
| 815 |
{\PackageWarning{scrhack}{cannot patch \string\lst@MakeCaption}}% |
| 816 |
\@whilesw\if@tempswa\fi{% |
| 817 |
\xpatchcmd\lst@MakeCaption |
| 818 |
{\addcontentsline{lol}}% |
| 819 |
{\addcontentsline{\ext@lstlisting}}% |
| 820 |
{}% |
| 821 |
{\@tempswafalse}% |
| 822 |
}% |
| 823 |
\AtBeginDocument{% |
| 824 |
\scr@ifexpected{\float@addtolists}{% |
| 825 |
\def\float@addtolists##1{\addtocontents{lol}{##1}}% |
| 826 |
}{% |
| 827 |
\PackageInfo{scrhack}{undefining \string\float@addtolists}% |
| 828 |
\let\float@addtolists\relax |
| 829 |
}{% |
| 830 |
\scr@ifexpected{\float@addtolists}{% |
| 831 |
\def\float@addtolists##1{\addtocontents{lol}{##1}% |
| 832 |
\orig@float@addtolists{##1}}% |
| 833 |
}{% |
| 834 |
\PackageInfo{scrhack}{setting \string\float@addtolists\MessageBreak |
| 835 |
to \string\orig@float@addtolists}% |
| 836 |
\let\float@addtolists\orig@float@addtolists |
| 837 |
}{% |
| 838 |
\PackageWarningNoLine{scrhack}{unkown \string\float@addtolists\space |
| 839 |
definition found!\MessageBreak |
| 840 |
Maybe you are using a unsupported listings version}% |
| 841 |
}% |
| 842 |
}% |
| 843 |
}% |
| 844 |
% \end{macrocode} |
| 845 |
% \begin{macro}{\lst@makecaption} |
| 846 |
% \changes{v3.30}{2020/04/01}{setting of \cs{@captype} added} |
| 847 |
% From version~3.30 setting of \cs{@captype} to \texttt{lstlisting} is added |
| 848 |
% to \cs{lst@makecaption}. This adds support for usage of |
| 849 |
% \cs{raggedlstlistingcaption} (if the user or a package author defines |
| 850 |
% it). The change is a little bit dangerous, because it will break, if |
| 851 |
% \pkg{listings} would add an argument to \cs{lst@makecaption}. |
| 852 |
% \begin{macrocode} |
| 853 |
\expandafter\def\expandafter\lst@makecaption\expandafter{% |
| 854 |
\expandafter\def\expandafter\@captype\expandafter{% |
| 855 |
\expandafter l\expandafter s\expandafter t\expandafter l% |
| 856 |
\expandafter i\expandafter s\expandafter t\expandafter i% |
| 857 |
\expandafter n\expandafter g\expandafter}\lst@makecaption |
| 858 |
}% |
| 859 |
\let\scr@do@hack@listings\relax |
| 860 |
} |
| 861 |
\scr@ifexpected{\lstlistoflistings}{% |
| 862 |
\def\lstlistoflistings{\bgroup |
| 863 |
\let\contentsname\lstlistlistingname |
| 864 |
\let\lst@temp\@starttoc \def\@starttoc##1{\lst@temp{lol}}% |
| 865 |
\tableofcontents \egroup}% |
| 866 |
}{% |
| 867 |
\scr@do@hack@listings |
| 868 |
}{% |
| 869 |
\scr@ifexpected{\lstlistoflistings}{% |
| 870 |
\def\lstlistoflistings{% |
| 871 |
\begingroup |
| 872 |
\@ifundefined{@restonecoltrue}{}{% |
| 873 |
\if@twocolumn |
| 874 |
\@restonecoltrue\onecolumn |
| 875 |
\else |
| 876 |
\@restonecolfalse |
| 877 |
\fi |
| 878 |
}% |
| 879 |
\float@listhead{\lstlistlistingname}% |
| 880 |
\parskip\z@\parindent\z@\parfillskip \z@ \@plus 1fil% |
| 881 |
\@starttoc{lol}% |
| 882 |
\@ifundefined{@restonecoltrue}{}{% |
| 883 |
\if@restonecol\twocolumn\fi |
| 884 |
}% |
| 885 |
\endgroup |
| 886 |
}% |
| 887 |
}{% |
| 888 |
\scr@do@hack@listings |
| 889 |
}{% |
| 890 |
\PackageWarningNoLine{scrhack}{unknown \string\lstlistoflistings\space |
| 891 |
definition found!\MessageBreak |
| 892 |
Maybe you are using a unsupported listings version}% |
| 893 |
}% |
| 894 |
} |
| 895 |
%</listings&body> |
| 896 |
% \end{macrocode} |
| 897 |
% \end{macro} |
| 898 |
% \end{macro} |
| 899 |
% \end{command} |
| 900 |
% \end{macro} |
| 901 |
% |
| 902 |
% |
| 903 |
% |
| 904 |
% \subsection{The \texorpdfstring{\pkg*{nomencl}}{nomencl} hack} |
| 905 |
% |
| 906 |
% With package \pkg{nomencl} and the \KOMAScript{} classes there is only a |
| 907 |
% small disharmony between relating the ToC entry. Nevertheless the package |
| 908 |
% can benefit from using \pkg*{tocbasic}. |
| 909 |
% |
| 910 |
% This hack adds \pkg*{tocbasic} usage to \pkg{nomencl}. This is done using |
| 911 |
% \pkg{xpatch} Nevertheless it is much more complicated than adding real |
| 912 |
% \pkg*{tocbasic} support into \pkg{nomencl}. The mess is, that every new |
| 913 |
% release of \pkg{nomencl} changes the kind of ``support'' of |
| 914 |
% \pkg*{tocbasic}. For some versions there isn't any such support. Other |
| 915 |
% versions use \pkg*{tocbasic} if it has been loaded. Other versions need an |
| 916 |
% option to activate usage of \pkg*{tocbasic}. So don't expect that the |
| 917 |
% following hack does the correct thing for every version of \pkg{nomencl}! |
| 918 |
% |
| 919 |
% \begin{option}{nomencl} |
| 920 |
% \changes{v3.23}{2017/03/31}{added} |
| 921 |
% \changes{v3.39}{2022/11/11}{initial dot in member argument of \cs{KOMA@key} |
| 922 |
% removed} |
| 923 |
% \begin{macrocode} |
| 924 |
%<*package&option> |
| 925 |
\RequirePackage{xpatch}% |
| 926 |
\KOMA@ifkey{nomencl}{@scrhack@nomencl} |
| 927 |
\KOMAExecuteOptions{nomencl=true} |
| 928 |
%</package&option> |
| 929 |
%<*package&body> |
| 930 |
\AfterPackage*{nomencl}{% |
| 931 |
\KOMA@key[scrhack.sty]{nomencl}{% |
| 932 |
\PackageWarning{scrhack}{option `nomencl' ignored}% |
| 933 |
\FamilyKeyStateProcessed |
| 934 |
}% |
| 935 |
\if@scrhack@nomencl\scr@hack@load\@pkgextension{nomencl}\fi |
| 936 |
} |
| 937 |
%</package&body> |
| 938 |
% \end{macrocode} |
| 939 |
% \end{option}^^A nomencl |
| 940 |
% |
| 941 |
% \begin{command}{\thenomenclature} |
| 942 |
% \changes{v3.23}{2017/03/31}{added} |
| 943 |
% Instead of using the several definitions by cases of the several versions of |
| 944 |
% \pkg{nomencl} we use a patch, that should remove all such cases and use |
| 945 |
% \pkg*{tocbasic} always. |
| 946 |
% \begin{macrocode} |
| 947 |
%<*nomencl&body> |
| 948 |
\RequirePackage{tocbasic} |
| 949 |
% \end{macrocode} |
| 950 |
% With \pkg{nomencl} > 5.0 this should be all. |
| 951 |
% Unfortunately is isn't, because newer versions of \pkg{nomencl} need option |
| 952 |
% \opt{tocbasic} to be set. Good luck: It is the default. So the chances |
| 953 |
% are good, that with new versions of \pkg{nomencl} usage of \pkg*{tocbasic} is |
| 954 |
% the default. |
| 955 |
% \begin{macrocode} |
| 956 |
\@ifpackagelater{nomencl}{2019/01/01}{% |
| 957 |
\PackageInfo{scrhack}{only `tocbasic' loaded for `nomencl'}% |
| 958 |
\expandafter\endinput |
| 959 |
}{} |
| 960 |
% \end{macrocode} |
| 961 |
% Otherwise we have to patch it. |
| 962 |
% \begin{macrocode} |
| 963 |
\addtotoclist[nomencl]{nlo} |
| 964 |
\addtotoclist[nomencl]{nls} |
| 965 |
\xpatchcmd{\thenomenclature}{% |
| 966 |
\@ifundefined{chapter}% |
| 967 |
{ |
| 968 |
\section*{\nomname} |
| 969 |
\if@intoc\addcontentsline{toc}{section}{\nomname}\fi% |
| 970 |
}% |
| 971 |
{ |
| 972 |
\chapter*{\nomname} |
| 973 |
\if@intoc\addcontentsline{toc}{chapter}{\nomname}\fi% |
| 974 |
}% |
| 975 |
}{% |
| 976 |
\scr@hack@nomencl@head |
| 977 |
}{% |
| 978 |
\PackageInfo{scrhack}{\string\thenomenclature\space successfully patched}% |
| 979 |
}{% |
| 980 |
% \end{macrocode} |
| 981 |
% \changes{v3.26b}{2019/01/23}{new \pkg{nomencl} 5.0} |
| 982 |
% From \pkg{nomencl} 5.0 another code is used if the nomenclature is a |
| 983 |
% chapter. So we need another patch: |
| 984 |
% \begin{macrocode} |
| 985 |
\xpatchcmd{\thenomenclature}{% |
| 986 |
\@ifundefined{chapter}% |
| 987 |
{ |
| 988 |
\section*{\nomname} |
| 989 |
\if@intoc\addcontentsline{toc}{section}{\nomname}\fi% |
| 990 |
}% |
| 991 |
{ |
| 992 |
\chapter*{\nomname} |
| 993 |
\markboth{\nomname}{\nomname}% |
| 994 |
\if@intoc\addcontentsline{toc}{chapter}{\nomname}\fi% |
| 995 |
}% |
| 996 |
}{% |
| 997 |
\scr@hack@nomencl@head |
| 998 |
}{% |
| 999 |
\PackageInfo{scrhack}{\string\thenomenclature\space successfully patched}% |
| 1000 |
}{% |
| 1001 |
% \end{macrocode} |
| 1002 |
% \changes{v3.26b}{2019/01/23}{prepared for hoply comming \pkg{nomencl}} |
| 1003 |
% But this code is also wrong, because it breaks manual running heads, e.g., |
| 1004 |
% of page style \texttt{myheadings}. So I hope, there will be another code, |
| 1005 |
% that needs a somehow different patch: |
| 1006 |
% \begin{macrocode} |
| 1007 |
\xpatchcmd{\thenomenclature}{% |
| 1008 |
\@ifundefined{chapter}% |
| 1009 |
{ |
| 1010 |
\section*{\nomname} |
| 1011 |
\if@intoc\addcontentsline{toc}{section}{\nomname}\fi% |
| 1012 |
}% |
| 1013 |
{ |
| 1014 |
\chapter*{\nomname} |
| 1015 |
\@mkboth{\nomname}{\nomname}% |
| 1016 |
\if@intoc\addcontentsline{toc}{chapter}{\nomname}\fi% |
| 1017 |
}% |
| 1018 |
}{% |
| 1019 |
\scr@hack@nomencl@head |
| 1020 |
}{% |
| 1021 |
\PackageInfo{scrhack}{\string\thenomenclature\space successfully patched}% |
| 1022 |
}{% |
| 1023 |
% \end{macrocode} |
| 1024 |
% \changes{v3.25}{2019/01/23}{emergency patch added} |
| 1025 |
% \changes{v3.30}{2020/02/25}{spurious space in warning message removed} |
| 1026 |
% If this also does not work, we try an emergency patch, that could break |
| 1027 |
% things. |
| 1028 |
% \begin{macrocode} |
| 1029 |
\xpatchcmd{\thenomenclature}{% |
| 1030 |
\@ifundefined{chapter}% |
| 1031 |
}{% |
| 1032 |
\scr@hack@nomencl@head |
| 1033 |
\@gobbletwo |
| 1034 |
}{% |
| 1035 |
\PackageWarning{scrhack}{% |
| 1036 |
using emergency patch of \string\thenomenclature.\MessageBreak |
| 1037 |
This could happen if you are using an unknown\MessageBreak |
| 1038 |
release of package `nomencl'.\MessageBreak |
| 1039 |
Mostly this patch does work too, but it also could\MessageBreak |
| 1040 |
break `nomencl`. If this happens, please deactivate\MessageBreak |
| 1041 |
the `nomencl` hack of `scrhack`% |
| 1042 |
}% |
| 1043 |
}{% |
| 1044 |
\PackageWarning{scrhack}{% |
| 1045 |
cannot patch \string\thenomenclature.\MessageBreak |
| 1046 |
This could happen if you are using an unknown\MessageBreak |
| 1047 |
release of package `nomencl'% |
| 1048 |
}% |
| 1049 |
}% |
| 1050 |
}% |
| 1051 |
}% |
| 1052 |
} |
| 1053 |
%</nomencl&body> |
| 1054 |
% \end{macrocode} |
| 1055 |
% \end{command}^^A \thenomenclature |
| 1056 |
% |
| 1057 |
% \begin{macro}{\scr@hack@nomencl@head} |
| 1058 |
% \changes{v3.23}{2017/03/31}{heading of \env{thenomenclature} by |
| 1059 |
% \pkg*{tocbasic}} |
| 1060 |
% \changes{v3.31}{2020/07/08}{internal \cs{list@fname} eliminated} |
| 1061 |
% We don't need an extra group, because \env{thenomenclature} already adds the |
| 1062 |
% group. |
| 1063 |
% \begin{macrocode} |
| 1064 |
%<*nomencl&body> |
| 1065 |
\newcommand*{\scr@hack@nomencl@head}{% |
| 1066 |
\providecommand*{\listofnlsname}{\nomname}% |
| 1067 |
\def\@currext{nls}% |
| 1068 |
\tocbasic@listhead{\nomname}% |
| 1069 |
} |
| 1070 |
%</nomencl&body> |
| 1071 |
% \end{macrocode} |
| 1072 |
% \begin{description} |
| 1073 |
% \item[Note:] Only the heading hooks of \pkg*{tocbasic} are used. The other |
| 1074 |
% hooks can be set, but would never be used! |
| 1075 |
% \end{description} |
| 1076 |
% \end{macro}^^A \scr@hack@nomencl@head |
| 1077 |
% |
| 1078 |
% \begin{macro}{\if@intoc} |
| 1079 |
% \changes{3.23}{2017/03/31}{support of \cs{if@intoc}} |
| 1080 |
% Generally we have to support \pkg{nomencl}'s option \opt{intoc} and the |
| 1081 |
% switch \cs{if@intoc}. This is done by (un-)setting \pkg*{tocbasic} feature |
| 1082 |
% \texttt{totoc}. So additional changes of the feature can be done at first |
| 1083 |
% after loading both, \pkg{nomencl} and \pkg*{scrhack}. Moreover, later changes |
| 1084 |
% of \cs{if@intoc} are not recognized. |
| 1085 |
% \begin{macrocode} |
| 1086 |
%<*nomencl&body> |
| 1087 |
\if@intoc |
| 1088 |
\setuptoc{nls}{totoc} |
| 1089 |
\fi |
| 1090 |
%</nomencl&body> |
| 1091 |
% \end{macrocode} |
| 1092 |
% \end{macro} |
| 1093 |
% |
| 1094 |
% |
| 1095 |
% \subsection{The \texorpdfstring{\pkg*{setspace}}{setspace} hack} |
| 1096 |
% |
| 1097 |
% Package \pkg{setspace} internally uses \cs{@ptsize} in a way, that only |
| 1098 |
% works as long as \cs{@ptsize} is an integer. But because \KOMAScript{} |
| 1099 |
% supports non integer font sizes, \cs{@ptsize} can also contain non-integer |
| 1100 |
% values. Moreover for \opt{11pt}, \LaTeX{} does not use a 11\,pt font but |
| 1101 |
% a 10.95\,pt font with a \len{baselineskip} of 13.6\,pt, the correct factor |
| 1102 |
% for, e.g., \cs{onehalfspacing} would be: |
| 1103 |
% \[ 10{,}95\,\mathrm{pt} \dot 1{,5} / 13{,}6\,\mathrm{pt} \equiv 1{,}208 \] |
| 1104 |
% But \pkg{setspace} uses 1.213, which would be correct for 11\,pt. Moreover |
| 1105 |
% the factor is always relative to the base font size and not the current font |
| 1106 |
% size. Because of this |
| 1107 |
% \begin{verbatim} |
| 1108 |
% \documentclass[10pt]{article} |
| 1109 |
% \usepackage{setspace} |
| 1110 |
% \begin{document} |
| 1111 |
% \large\onehalfspacing\raggedright |
| 1112 |
% Fontsize: \csname f@size\endcsname pt\\ |
| 1113 |
% Normal baselineskip: \csname f@baselineskip\endcsname\\ |
| 1114 |
% baselineskip: \the\baselineskip |
| 1115 |
% \end{document} |
| 1116 |
% \end{verbatim} |
| 1117 |
% results in another \len{baselineskip} than: |
| 1118 |
% \begin{verbatim} |
| 1119 |
% \documentclass[11pt]{article} |
| 1120 |
% \usepackage{setspace} |
| 1121 |
% \begin{document} |
| 1122 |
% \large\onehalfspacing\raggedright |
| 1123 |
% Fontsize: \csname f@size\endcsname pt\\ |
| 1124 |
% Normal baselineskip: \csname f@baselineskip\endcsname\\ |
| 1125 |
% baselineskip: \the\baselineskip |
| 1126 |
% \end{document} |
| 1127 |
% \end{verbatim} |
| 1128 |
% despite both examples use the same font size. So, to make it absolutely |
| 1129 |
% correct, the factor would have to change with every change of the font |
| 1130 |
% size. But the hack also does not do so. It just calculates the factor |
| 1131 |
% depending on the base font size an the current font size. This is enough to |
| 1132 |
% have the same \len{baselineskip} with both of the examples above. |
| 1133 |
% |
| 1134 |
% \begin{option}{setspace} |
| 1135 |
% \changes{v3.17}{2015/04/16}{added} |
| 1136 |
% \changes{v3.39}{2022/11/11}{initial dot in member argument of \cs{KOMA@key} |
| 1137 |
% removed} |
| 1138 |
% \begin{macrocode} |
| 1139 |
%<*package&option> |
| 1140 |
\KOMA@ifkey{setspace}{@scrhack@setspace} |
| 1141 |
\KOMAExecuteOptions{setspace=true} |
| 1142 |
%</package&option> |
| 1143 |
%<*package&body> |
| 1144 |
\AfterPackage*{setspace}{% |
| 1145 |
\KOMA@key[scrhack.sty]{setspace}{% |
| 1146 |
\PackageWarning{scrhack}{option `setspace' ignored}% |
| 1147 |
\FamilyKeyStateProcessed |
| 1148 |
}% |
| 1149 |
\if@scrhack@setspace\scr@hack@load\@pkgextension{setspace}\fi |
| 1150 |
} |
| 1151 |
%</package&body> |
| 1152 |
% \end{macrocode} |
| 1153 |
% \end{option} |
| 1154 |
% |
| 1155 |
% |
| 1156 |
% \begin{command}{\onehalfspacing} |
| 1157 |
% \changes{v3.17}{2015/04/16}{added} |
| 1158 |
% This selects the one half line spacing. I think, a factor with three digits |
| 1159 |
% for the decimals should be enough. |
| 1160 |
% \begin{macrocode} |
| 1161 |
%<*setspace&body> |
| 1162 |
\scr@ifexpected{\onehalfspacing}{% |
| 1163 |
\long\def\onehalfspacing{% |
| 1164 |
\setstretch{1.25}% default |
| 1165 |
\ifcase \@ptsize \relax % 10pt |
| 1166 |
\setstretch {1.25}% |
| 1167 |
\or % 11pt |
| 1168 |
\setstretch {1.213}% |
| 1169 |
\or % 12pt |
| 1170 |
\setstretch {1.241}% |
| 1171 |
\fi |
| 1172 |
}% |
| 1173 |
}{% |
| 1174 |
\renewcommand*{\onehalfspacing}{% |
| 1175 |
\@tempdima=\dimexpr (\f@size pt)*1500/ |
| 1176 |
(\dimexpr \f@baselineskip\relax)*\p@/1000\relax |
| 1177 |
\expandafter\setstretch\expandafter{\strip@pt\@tempdima}% |
| 1178 |
}% |
| 1179 |
}{% |
| 1180 |
% \end{macrocode} |
| 1181 |
% \changes{v3.39}{2023/03/15}{support for \pkg{setspace} 6.7b added} |
| 1182 |
% \begin{macrocode} |
| 1183 |
\scr@ifexpected{\onehalfspacing}{% |
| 1184 |
\long\def\onehalfspacing{% |
| 1185 |
\setstretch{1.25}% default |
| 1186 |
% DPC 6.7b guard \@ptsize |
| 1187 |
\ifx\@ptsize\@undefined\else |
| 1188 |
\ifcase \@ptsize \relax % 10pt |
| 1189 |
\setstretch {1.25}% |
| 1190 |
\or % 11pt |
| 1191 |
\setstretch {1.213}% |
| 1192 |
\or % 12pt |
| 1193 |
\setstretch {1.241}% |
| 1194 |
\fi |
| 1195 |
\fi |
| 1196 |
}% |
| 1197 |
}{% |
| 1198 |
\renewcommand*{\onehalfspacing}{% |
| 1199 |
\@tempdima=\dimexpr (\f@size pt)*1500/ |
| 1200 |
(\dimexpr \f@baselineskip\relax)*\p@/1000\relax |
| 1201 |
\expandafter\setstretch\expandafter{\strip@pt\@tempdima}% |
| 1202 |
}% |
| 1203 |
}{% |
| 1204 |
\PackageWarning{scrhack}{unknown \string\onehalfspacing\space |
| 1205 |
definition found!\MessageBreak |
| 1206 |
Maybe you are using a unsupported setpace version}% |
| 1207 |
}% |
| 1208 |
} |
| 1209 |
% \end{macrocode} |
| 1210 |
% \end{command} |
| 1211 |
% \begin{command}{\doublespacing} |
| 1212 |
% \changes{v3.17}{2015/04/16}{new} |
| 1213 |
% This selects the double line spacing. I think, a factor with three digits |
| 1214 |
% for the decimals should be enough. |
| 1215 |
% \begin{macrocode} |
| 1216 |
\scr@ifexpected{\doublespacing}{% |
| 1217 |
\long\def\doublespacing{% |
| 1218 |
\setstretch{1.667}% default |
| 1219 |
\ifcase \@ptsize \relax % 10pt |
| 1220 |
\setstretch {1.667}% |
| 1221 |
\or % 11pt |
| 1222 |
\setstretch {1.618}% |
| 1223 |
\or % 12pt |
| 1224 |
\setstretch {1.655}% |
| 1225 |
\fi |
| 1226 |
}% |
| 1227 |
}{% |
| 1228 |
\renewcommand*{\doublespacing}{% |
| 1229 |
\@tempdima=\dimexpr (\f@size pt)*2000/ |
| 1230 |
(\dimexpr \f@baselineskip\relax)*\p@/1000\relax |
| 1231 |
\expandafter\setstretch\expandafter{\strip@pt\@tempdima}% |
| 1232 |
}% |
| 1233 |
}{% |
| 1234 |
% \end{macrocode} |
| 1235 |
% \changes{v3.39}{2023/03/15}{support for \pkg{setspace} 6.7b added} |
| 1236 |
% \begin{macrocode} |
| 1237 |
\scr@ifexpected{\doublespacing}{% |
| 1238 |
\long\def\doublespacing{% |
| 1239 |
\setstretch {1.667}% default |
| 1240 |
% DPC 6.7b guard \@ptsize |
| 1241 |
\ifx\@ptsize\@undefined\else |
| 1242 |
\ifcase \@ptsize \relax % 10pt |
| 1243 |
\setstretch {1.667}% |
| 1244 |
\or % 11pt |
| 1245 |
\setstretch {1.618}% |
| 1246 |
\or % 12pt |
| 1247 |
\setstretch {1.655}% |
| 1248 |
\fi |
| 1249 |
\fi |
| 1250 |
}% |
| 1251 |
}{% |
| 1252 |
\renewcommand*{\doublespacing}{% |
| 1253 |
\@tempdima=\dimexpr (\f@size pt)*2000/ |
| 1254 |
(\dimexpr \f@baselineskip\relax)*\p@/1000\relax |
| 1255 |
\expandafter\setstretch\expandafter{\strip@pt\@tempdima}% |
| 1256 |
}% |
| 1257 |
}{% |
| 1258 |
\PackageWarning{scrhack}{unknown \string\doublespacing\space |
| 1259 |
definition found!\MessageBreak |
| 1260 |
Maybe you are using a unsupported setpace version}% |
| 1261 |
}% |
| 1262 |
} |
| 1263 |
%</setspace&body> |
| 1264 |
% \end{macrocode} |
| 1265 |
% \end{command} |
| 1266 |
% |
| 1267 |
% |
| 1268 |
% \subsection{The \texorpdfstring{\pkg*{lscape}}{lscape} hack} |
| 1269 |
% \changes{v3.18a}{2015/07/07}{\pkg{lscape} hack added} |
| 1270 |
% |
| 1271 |
% The package does change \len{textheight} inside \env{landscape} to the prior |
| 1272 |
% value of \len{textwidth}, nevertheless is does not change \len{textwidth} to |
| 1273 |
% the prior value of \len{textheight}. This is at least inconsistent. After |
| 1274 |
% asking him, David~Carlisle answered, that he does not change |
| 1275 |
% \len{textwidth}, because this could result in problems. Therefore it is very |
| 1276 |
% strange, that he does change \cs{textheight}, despite this also to problems, |
| 1277 |
% e.g., with packages \pkg{showframe} or \pkg*{scrlayer}. So the patch here |
| 1278 |
% also keeps \len{textheight} unchanged. This also has to take care for |
| 1279 |
% \pkg{pdflscape}. The patches are done using \pkg{xpatch}. |
| 1280 |
% |
| 1281 |
% |
| 1282 |
% \begin{option}{lscape} |
| 1283 |
% \changes{v3.18a}{2015/07/07}{added} |
| 1284 |
% \changes{v3.20}{2016/05/07}{loading \pkg{xpatch} in option part already} |
| 1285 |
% \changes{v3.39}{2022/11/11}{initial dot in member argument of \cs{KOMA@key} |
| 1286 |
% removed} |
| 1287 |
% \begin{macrocode} |
| 1288 |
%<*package&option> |
| 1289 |
\RequirePackage{xpatch}% |
| 1290 |
\KOMA@ifkey{lscape}{@scrhack@lscape}% |
| 1291 |
\KOMAExecuteOptions{lscape=true}% |
| 1292 |
%</package&option> |
| 1293 |
%<*package&body> |
| 1294 |
\AfterPackage*{lscape}{% |
| 1295 |
\if@scrhack@lscape\scr@hack@load\@pkgextension{lscape}\else |
| 1296 |
\KOMA@key[scrhack.sty]{lscape}{% |
| 1297 |
\PackageWarning{scrhack}{option `lscape' ignored}% |
| 1298 |
\FamilyKeyStateProcessed |
| 1299 |
}% |
| 1300 |
\fi |
| 1301 |
} |
| 1302 |
%</package&body> |
| 1303 |
% \end{macrocode} |
| 1304 |
% \end{option} |
| 1305 |
% |
| 1306 |
% \begin{command}{\landscape} |
| 1307 |
% \changes{v3.18a}{2015/07/07}{added} |
| 1308 |
% \changes{v3.20}{2016/05/07}{loading \pkg{xpatch} in option part already} |
| 1309 |
% This command is the beginning of environment \env{landscape}. This has to be |
| 1310 |
% patched using \pkg{xpatch}. |
| 1311 |
% \begin{description} |
| 1312 |
% \item[Note:] This is a load time option and cannot be changed after loading |
| 1313 |
% the package! |
| 1314 |
% \end{description} |
| 1315 |
% \begin{macrocode} |
| 1316 |
%<*lscape&body> |
| 1317 |
\xpatchcmd{\landscape}{\textheight=\vsize}{% |
| 1318 |
\if@scrhack@lscape |
| 1319 |
% \end{macrocode} |
| 1320 |
% \begin{macro}{\@outputpage} |
| 1321 |
% \changes{v3.18a}{2015/08/11}{added} |
| 1322 |
% Here the changed value of \len{textheight} is needed for initialization of |
| 1323 |
% \cs{@colht}. So we patch it to use the new internal \len{scr@LT@textheight} |
| 1324 |
% instead of \len{textheight}. |
| 1325 |
% \begin{macrocode} |
| 1326 |
\scrh@LT@textheight=\vsize |
| 1327 |
\let\scrh@LT@outputpage\@outputpage |
| 1328 |
\def\@outputpage{\scrh@LT@outputpage\global\@colht\scrh@LT@textheight}% |
| 1329 |
\else |
| 1330 |
\textheight=\vsize |
| 1331 |
\fi |
| 1332 |
}{% |
| 1333 |
\PackageInfo{scrhack}{\string\landscape\space patched to make |
| 1334 |
\string\textheight\space change optional}% |
| 1335 |
}{% |
| 1336 |
\PackageWarning{scrhack}{Cannot patch \string\landscape!\MessageBreak |
| 1337 |
Maybe you are using a unsupported lscape version}% |
| 1338 |
\@scrhack@lscapefalse |
| 1339 |
} |
| 1340 |
% \end{macrocode} |
| 1341 |
% \begin{ilength}{\scrh@LT@textheight} |
| 1342 |
% \changes{v3.18a}{2015/08/11}{new} |
| 1343 |
% \begin{macrocode} |
| 1344 |
\newlength{\scrh@LT@textheight} |
| 1345 |
%</lscape&body> |
| 1346 |
% \end{macrocode} |
| 1347 |
% \end{ilength}^^A \scrh@LT@textheight |
| 1348 |
% \end{macro}^^A \@outputpage |
| 1349 |
% \end{command}^^A \landscape |
| 1350 |
% |
| 1351 |
% |
| 1352 |
% \subsection{The standard classes sections hack} |
| 1353 |
% \label{sec:standardsections} |
| 1354 |
% The \emph{standard classes sections hack} differs from each other |
| 1355 |
% hack. First of all it does not patch a specific package but the class |
| 1356 |
% definitions of section commands from \cs{part} till |
| 1357 |
% \cs{subparagraph}. Additionally it resets several internal \LaTeX{} macros |
| 1358 |
% which are changed by \KOMAScript{} classes to their original |
| 1359 |
% definition. Last but not least it is not activated by default, but the user |
| 1360 |
% has to activate it, if he needs it. The hack has more potential to break |
| 1361 |
% things than to make things better. Because of this, there is not any support |
| 1362 |
% for using this hack and the hack shows several warning messages. |
| 1363 |
% |
| 1364 |
% \begin{option}{standardsections} |
| 1365 |
% \begin{macrocode} |
| 1366 |
%<*package&option> |
| 1367 |
\KOMA@ifkey{standardsections}{@scrhack@standardsections} |
| 1368 |
\KOMAExecuteOptions{standardsections=false} |
| 1369 |
%</package&option> |
| 1370 |
%<*package&body> |
| 1371 |
\AtEndOfPackage{% |
| 1372 |
\if@scrhack@standardsections |
| 1373 |
\PackageInfo{scrhack}{loading standard classes sections hack}% |
| 1374 |
\input{standardsections.hak}% |
| 1375 |
\fi |
| 1376 |
} |
| 1377 |
%</package&body> |
| 1378 |
% \end{macrocode} |
| 1379 |
% \end{option}^^A standardsections |
| 1380 |
% |
| 1381 |
% \begin{command}{\part,\chapter, |
| 1382 |
% \section,\subsection,\subsubsection, |
| 1383 |
% \paragraph,\subparagraph} |
| 1384 |
% The hack redefines all these commands to a definition copied from the |
| 1385 |
% standard \LaTeX{} classes version v1.4i. Copyright of this code is by the |
| 1386 |
% \LaTeX3{} Project. The complete, unmodified code can be found on |
| 1387 |
% \url{https://ctan.org/tex-archive/macros/latex/base/classes.dtx}. |
| 1388 |
% \begin{macrocode} |
| 1389 |
%<*standardsections&body> |
| 1390 |
\PackageWarningNoLine{scrhack}{% |
| 1391 |
You are loosing every kind of support because of\MessageBreak |
| 1392 |
using the dangerous standard classes sections hack!\MessageBreak |
| 1393 |
This hack can break several classes and packages.\MessageBreak |
| 1394 |
However, sometimes it is needed to make a\MessageBreak |
| 1395 |
package work% |
| 1396 |
}% |
| 1397 |
\PackageInfo{scrhack}{% |
| 1398 |
Using code from the standard LaTeX classes.\MessageBreak |
| 1399 |
For more information about this code and the\MessageBreak |
| 1400 |
license of this code, please see:\MessageBreak |
| 1401 |
https://ctan.org/tex-archive/macros/latex/base/classes.dtx |
| 1402 |
}% |
| 1403 |
\@ifpackageloaded{hyperref}{% |
| 1404 |
\PackageWarning{scrhack}{this hack should not be loaded after `hyperref'}% |
| 1405 |
}{} |
| 1406 |
\@ifpackageloaded{titlesec}{% |
| 1407 |
\PackageWarning{scrhack}{this hack should not be loaded after `titlesec'}% |
| 1408 |
}{} |
| 1409 |
\@ifpackageloaded{sectsty}{% |
| 1410 |
\PackageWarning{scrhack}{this hack should not be loaded after `sectsty'}% |
| 1411 |
}{} |
| 1412 |
\scr@ifundefinedorrelax{chapter}{% |
| 1413 |
% \end{macrocode} |
| 1414 |
% It seems to be an article class, so we use the code from |
| 1415 |
% \href{http://mirrors.ctan.org/macros/latex/base/classes.dtx}{\cls*{article}}. |
| 1416 |
% \begin{macrocode} |
| 1417 |
\scr@ifundefinedorrelax{c@part}{\newcounter{part}}{}% |
| 1418 |
\scr@ifundefinedorrelax{c@section}{\newcounter{section}}{}% |
| 1419 |
\scr@ifundefinedorrelax{c@subsection}{\newcounter{subsection}[section]}{}% |
| 1420 |
\scr@ifundefinedorrelax{c@subsubsection}{% |
| 1421 |
\newcounter{subsubsection}[subsection]}{}% |
| 1422 |
\scr@ifundefinedorrelax{c@paragraph}{% |
| 1423 |
\newcounter{paragraph}[subsubsection]}{}% |
| 1424 |
\scr@ifundefinedorrelax{c@subparagraph}{% |
| 1425 |
\newcounter{subparagraph}[paragraph]}{}% |
| 1426 |
\renewcommand\thepart {\@Roman\c@part}% |
| 1427 |
\renewcommand\thesection {\@arabic\c@section}% |
| 1428 |
\renewcommand\thesubsection {\thesection.\@arabic\c@subsection}% |
| 1429 |
\renewcommand\thesubsubsection{\thesubsection.\@arabic\c@subsubsection}% |
| 1430 |
\renewcommand\theparagraph {\thesubsubsection.\@arabic\c@paragraph}% |
| 1431 |
\renewcommand\thesubparagraph {\theparagraph.\@arabic\c@subparagraph}% |
| 1432 |
\def\part{% |
| 1433 |
\if@noskipsec \leavevmode \fi |
| 1434 |
\par |
| 1435 |
\addvspace{4ex}% |
| 1436 |
\@afterindentfalse |
| 1437 |
\secdef\@part\@spart}% |
| 1438 |
\def\@part[#1]#2{% |
| 1439 |
\ifnum \c@secnumdepth >\m@ne |
| 1440 |
\refstepcounter{part}% |
| 1441 |
\addcontentsline{toc}{part}{\thepart\hspace{1em}#1}% |
| 1442 |
\else |
| 1443 |
\addcontentsline{toc}{part}{#1}% |
| 1444 |
\fi |
| 1445 |
{\parindent \z@ \raggedright |
| 1446 |
\interlinepenalty \@M |
| 1447 |
\normalfont |
| 1448 |
\ifnum \c@secnumdepth >\m@ne |
| 1449 |
\Large\bfseries \partname\nobreakspace\thepart |
| 1450 |
\par\nobreak |
| 1451 |
\fi |
| 1452 |
\huge \bfseries #2% |
| 1453 |
\markboth{}{}\par}% |
| 1454 |
\nobreak |
| 1455 |
\vskip 3ex |
| 1456 |
\@afterheading}% |
| 1457 |
\def\@spart#1{% |
| 1458 |
{\parindent \z@ \raggedright |
| 1459 |
\interlinepenalty \@M |
| 1460 |
\normalfont |
| 1461 |
\huge \bfseries #1\par}% |
| 1462 |
\nobreak |
| 1463 |
\vskip 3ex |
| 1464 |
\@afterheading}% |
| 1465 |
\def\section{\@startsection {section}{1}{\z@}% |
| 1466 |
{-3.5ex \@plus -1ex \@minus -.2ex}% |
| 1467 |
{2.3ex \@plus.2ex}% |
| 1468 |
{\normalfont\Large\bfseries}}% |
| 1469 |
\def\subsection{\@startsection{subsection}{2}{\z@}% |
| 1470 |
{-3.25ex\@plus -1ex \@minus -.2ex}% |
| 1471 |
{1.5ex \@plus .2ex}% |
| 1472 |
{\normalfont\large\bfseries}}% |
| 1473 |
\def\subsubsection{\@startsection{subsubsection}{3}{\z@}% |
| 1474 |
{-3.25ex\@plus -1ex \@minus -.2ex}% |
| 1475 |
{1.5ex \@plus .2ex}% |
| 1476 |
{\normalfont\normalsize\bfseries}}% |
| 1477 |
\def\paragraph{\@startsection{paragraph}{4}{\z@}% |
| 1478 |
{3.25ex \@plus1ex \@minus.2ex}% |
| 1479 |
{-1em}% |
| 1480 |
{\normalfont\normalsize\bfseries}}% |
| 1481 |
\def\subparagraph{\@startsection{subparagraph}{5}{\parindent}% |
| 1482 |
{3.25ex \@plus1ex \@minus .2ex}% |
| 1483 |
{-1em}% |
| 1484 |
{\normalfont\normalsize\bfseries}}% |
| 1485 |
}{% |
| 1486 |
% \end{macrocode} |
| 1487 |
% It seems to be either a book or report class. |
| 1488 |
% \begin{macrocode} |
| 1489 |
\scr@ifundefinedorrelax{c@part}{\newcounter{part}}{}% |
| 1490 |
\scr@ifundefinedorrelax{c@chapter}{\newcounter{chapter}}{}% |
| 1491 |
\scr@ifundefinedorrelax{c@section}{\newcounter{section}[chapter]}{}% |
| 1492 |
\scr@ifundefinedorrelax{c@subsection}{\newcounter{subsection}[section]}{}% |
| 1493 |
\scr@ifundefinedorrelax{c@subsubsection}{% |
| 1494 |
\newcounter{subsubsection}[subsection]}{}% |
| 1495 |
\scr@ifundefinedorrelax{c@paragraph}{% |
| 1496 |
\newcounter{paragraph}[subsubsection]}{}% |
| 1497 |
\scr@ifundefinedorrelax{c@subparagraph}{% |
| 1498 |
\newcounter{subparagraph}[paragraph]}{}% |
| 1499 |
\def\@chapapp{\chaptername}% |
| 1500 |
\scr@ifundefinedorrelax{frontmatter}{% |
| 1501 |
% \end{macrocode} |
| 1502 |
% It seems not to be a book class. |
| 1503 |
% \begin{macrocode} |
| 1504 |
\def\part{% |
| 1505 |
\if@openright |
| 1506 |
\cleardoublepage |
| 1507 |
\else |
| 1508 |
\clearpage |
| 1509 |
\fi |
| 1510 |
\thispagestyle{plain}% |
| 1511 |
\if@twocolumn |
| 1512 |
\onecolumn |
| 1513 |
\@tempswatrue |
| 1514 |
\else |
| 1515 |
\@tempswafalse |
| 1516 |
\fi |
| 1517 |
\null\vfil |
| 1518 |
\secdef\@part\@spart} |
| 1519 |
|
| 1520 |
\def\@part[#1]#2{% |
| 1521 |
\ifnum \c@secnumdepth >-2\relax |
| 1522 |
\refstepcounter{part}% |
| 1523 |
\addcontentsline{toc}{part}{\thepart\hspace{1em}#1}% |
| 1524 |
\else |
| 1525 |
\addcontentsline{toc}{part}{#1}% |
| 1526 |
\fi |
| 1527 |
\markboth{}{}% |
| 1528 |
{\centering |
| 1529 |
\interlinepenalty \@M |
| 1530 |
\normalfont |
| 1531 |
\ifnum \c@secnumdepth >-2\relax |
| 1532 |
\huge\bfseries \partname\nobreakspace\thepart |
| 1533 |
\par |
| 1534 |
\vskip 20\p@ |
| 1535 |
\fi |
| 1536 |
\Huge \bfseries #2\par}% |
| 1537 |
\@endpart} |
| 1538 |
\def\@spart#1{% |
| 1539 |
{\centering |
| 1540 |
\interlinepenalty \@M |
| 1541 |
\normalfont |
| 1542 |
\Huge \bfseries #1\par}% |
| 1543 |
\@endpart} |
| 1544 |
\def\@endpart{\vfil\newpage |
| 1545 |
\if@twoside |
| 1546 |
\if@openright |
| 1547 |
\null |
| 1548 |
\thispagestyle{empty}% |
| 1549 |
\newpage |
| 1550 |
\fi |
| 1551 |
\fi |
| 1552 |
\if@tempswa |
| 1553 |
\twocolumn |
| 1554 |
\fi} |
| 1555 |
\def\chapter{\if@openright\cleardoublepage\else\clearpage\fi |
| 1556 |
\thispagestyle{plain}% |
| 1557 |
\global\@topnum\z@ |
| 1558 |
\@afterindentfalse |
| 1559 |
\secdef\@chapter\@schapter} |
| 1560 |
\def\@chapter[#1]#2{\ifnum \c@secnumdepth >\m@ne |
| 1561 |
\refstepcounter{chapter}% |
| 1562 |
\typeout{\@chapapp\space\thechapter.}% |
| 1563 |
\addcontentsline{toc}{chapter}% |
| 1564 |
{\protect\numberline{\thechapter}#1}% |
| 1565 |
\else |
| 1566 |
\addcontentsline{toc}{chapter}{#1}% |
| 1567 |
\fi |
| 1568 |
\chaptermark{#1}% |
| 1569 |
\addtocontents{lof}{\protect\addvspace{10\p@}}% |
| 1570 |
\addtocontents{lot}{\protect\addvspace{10\p@}}% |
| 1571 |
\if@twocolumn |
| 1572 |
\@topnewpage[\@makechapterhead{#2}]% |
| 1573 |
\else |
| 1574 |
\@makechapterhead{#2}% |
| 1575 |
\@afterheading |
| 1576 |
\fi} |
| 1577 |
\def\@makechapterhead#1{% |
| 1578 |
\vspace*{50\p@}% |
| 1579 |
{\parindent \z@ \raggedright \normalfont |
| 1580 |
\ifnum \c@secnumdepth >\m@ne |
| 1581 |
\huge\bfseries \@chapapp\space \thechapter |
| 1582 |
\par\nobreak |
| 1583 |
\vskip 20\p@ |
| 1584 |
\fi |
| 1585 |
\interlinepenalty\@M |
| 1586 |
\Huge \bfseries #1\par\nobreak |
| 1587 |
\vskip 40\p@ |
| 1588 |
}} |
| 1589 |
\def\@schapter#1{\if@twocolumn |
| 1590 |
\@topnewpage[\@makeschapterhead{#1}]% |
| 1591 |
\else |
| 1592 |
\@makeschapterhead{#1}% |
| 1593 |
\@afterheading |
| 1594 |
\fi} |
| 1595 |
\def\@makeschapterhead#1{% |
| 1596 |
\vspace*{50\p@}% |
| 1597 |
{\parindent \z@ \raggedright |
| 1598 |
\normalfont |
| 1599 |
\interlinepenalty\@M |
| 1600 |
\Huge \bfseries #1\par\nobreak |
| 1601 |
\vskip 40\p@ |
| 1602 |
}} |
| 1603 |
\def\section{\@startsection {section}{1}{\z@}% |
| 1604 |
{-3.5ex \@plus -1ex \@minus -.2ex}% |
| 1605 |
{2.3ex \@plus.2ex}% |
| 1606 |
{\normalfont\Large\bfseries}}% |
| 1607 |
\def\subsection{\@startsection{subsection}{2}{\z@}% |
| 1608 |
{-3.25ex\@plus -1ex \@minus -.2ex}% |
| 1609 |
{1.5ex \@plus .2ex}% |
| 1610 |
{\normalfont\large\bfseries}}% |
| 1611 |
\def\subsubsection{\@startsection{subsubsection}{3}{\z@}% |
| 1612 |
{-3.25ex\@plus -1ex \@minus -.2ex}% |
| 1613 |
{1.5ex \@plus .2ex}% |
| 1614 |
{\normalfont\normalsize\bfseries}}% |
| 1615 |
\def\paragraph{\@startsection{paragraph}{4}{\z@}% |
| 1616 |
{3.25ex \@plus1ex \@minus.2ex}% |
| 1617 |
{-1em}% |
| 1618 |
{\normalfont\normalsize\bfseries}}% |
| 1619 |
\def\subparagraph{\@startsection{subparagraph}{5}{\parindent}% |
| 1620 |
{3.25ex \@plus1ex \@minus .2ex}% |
| 1621 |
{-1em}% |
| 1622 |
{\normalfont\normalsize\bfseries}}% |
| 1623 |
}{% |
| 1624 |
% \end{macrocode} |
| 1625 |
% It seems to be a book class. |
| 1626 |
% \begin{macrocode} |
| 1627 |
\scr@ifundefinedorrelax{if@mainmatter}{% |
| 1628 |
\expandafter\newif\csname if@mainmatter\endcsname |
| 1629 |
}{}% |
| 1630 |
\def\frontmatter{% |
| 1631 |
\cleardoublepage |
| 1632 |
\@mainmatterfalse |
| 1633 |
\pagenumbering{roman}}% |
| 1634 |
\def\mainmatter{% |
| 1635 |
\cleardoublepage |
| 1636 |
\@mainmattertrue |
| 1637 |
\pagenumbering{arabic}}% |
| 1638 |
\def\backmatter{% |
| 1639 |
\if@openright |
| 1640 |
\cleardoublepage |
| 1641 |
\else |
| 1642 |
\clearpage |
| 1643 |
\fi |
| 1644 |
\@mainmatterfalse}% |
| 1645 |
\def\part{% |
| 1646 |
\if@openright |
| 1647 |
\cleardoublepage |
| 1648 |
\else |
| 1649 |
\clearpage |
| 1650 |
\fi |
| 1651 |
\thispagestyle{plain}% |
| 1652 |
\if@twocolumn |
| 1653 |
\onecolumn |
| 1654 |
\@tempswatrue |
| 1655 |
\else |
| 1656 |
\@tempswafalse |
| 1657 |
\fi |
| 1658 |
\null\vfil |
| 1659 |
\secdef\@part\@spart}% |
| 1660 |
|
| 1661 |
\def\@part[#1]#2{% |
| 1662 |
\ifnum \c@secnumdepth >-2\relax |
| 1663 |
\refstepcounter{part}% |
| 1664 |
\addcontentsline{toc}{part}{\thepart\hspace{1em}#1}% |
| 1665 |
\else |
| 1666 |
\addcontentsline{toc}{part}{#1}% |
| 1667 |
\fi |
| 1668 |
\markboth{}{}% |
| 1669 |
{\centering |
| 1670 |
\interlinepenalty \@M |
| 1671 |
\normalfont |
| 1672 |
\ifnum \c@secnumdepth >-2\relax |
| 1673 |
\huge\bfseries \partname\nobreakspace\thepart |
| 1674 |
\par |
| 1675 |
\vskip 20\p@ |
| 1676 |
\fi |
| 1677 |
\Huge \bfseries #2\par}% |
| 1678 |
\@endpart}% |
| 1679 |
\def\@spart#1{% |
| 1680 |
{\centering |
| 1681 |
\interlinepenalty \@M |
| 1682 |
\normalfont |
| 1683 |
\Huge \bfseries #1\par}% |
| 1684 |
\@endpart}% |
| 1685 |
\def\@endpart{\vfil\newpage |
| 1686 |
\if@twoside |
| 1687 |
\if@openright |
| 1688 |
\null |
| 1689 |
\thispagestyle{empty}% |
| 1690 |
\newpage |
| 1691 |
\fi |
| 1692 |
\fi |
| 1693 |
\if@tempswa |
| 1694 |
\twocolumn |
| 1695 |
\fi}% |
| 1696 |
\def\chapter{\if@openright\cleardoublepage\else\clearpage\fi |
| 1697 |
\thispagestyle{plain}% |
| 1698 |
\global\@topnum\z@ |
| 1699 |
\@afterindentfalse |
| 1700 |
\secdef\@chapter\@schapter}% |
| 1701 |
\def\@chapter[#1]#2{\ifnum \c@secnumdepth >\m@ne |
| 1702 |
\if@mainmatter |
| 1703 |
\refstepcounter{chapter}% |
| 1704 |
\typeout{\@chapapp\space\thechapter.}% |
| 1705 |
\addcontentsline{toc}{chapter}% |
| 1706 |
{\protect\numberline{\thechapter}#1}% |
| 1707 |
\else |
| 1708 |
\addcontentsline{toc}{chapter}{#1}% |
| 1709 |
\fi |
| 1710 |
\else |
| 1711 |
\addcontentsline{toc}{chapter}{#1}% |
| 1712 |
\fi |
| 1713 |
\chaptermark{#1}% |
| 1714 |
\addtocontents{lof}{\protect\addvspace{10\p@}}% |
| 1715 |
\addtocontents{lot}{\protect\addvspace{10\p@}}% |
| 1716 |
\if@twocolumn |
| 1717 |
\@topnewpage[\@makechapterhead{#2}]% |
| 1718 |
\else |
| 1719 |
\@makechapterhead{#2}% |
| 1720 |
\@afterheading |
| 1721 |
\fi}% |
| 1722 |
\def\@makechapterhead#1{% |
| 1723 |
\vspace*{50\p@}% |
| 1724 |
{\parindent \z@ \raggedright \normalfont |
| 1725 |
\ifnum \c@secnumdepth >\m@ne |
| 1726 |
\if@mainmatter |
| 1727 |
\huge\bfseries \@chapapp\space \thechapter |
| 1728 |
\par\nobreak |
| 1729 |
\vskip 20\p@ |
| 1730 |
\fi |
| 1731 |
\fi |
| 1732 |
\interlinepenalty\@M |
| 1733 |
\Huge \bfseries #1\par\nobreak |
| 1734 |
\vskip 40\p@ |
| 1735 |
}}% |
| 1736 |
\def\@schapter#1{\if@twocolumn |
| 1737 |
\@topnewpage[\@makeschapterhead{#1}]% |
| 1738 |
\else |
| 1739 |
\@makeschapterhead{#1}% |
| 1740 |
\@afterheading |
| 1741 |
\fi}% |
| 1742 |
\def\@makeschapterhead#1{% |
| 1743 |
\vspace*{50\p@}% |
| 1744 |
{\parindent \z@ \raggedright |
| 1745 |
\normalfont |
| 1746 |
\interlinepenalty\@M |
| 1747 |
\Huge \bfseries #1\par\nobreak |
| 1748 |
\vskip 40\p@ |
| 1749 |
}}% |
| 1750 |
\def\section{\@startsection {section}{1}{\z@}% |
| 1751 |
{-3.5ex \@plus -1ex \@minus -.2ex}% |
| 1752 |
{2.3ex \@plus.2ex}% |
| 1753 |
{\normalfont\Large\bfseries}}% |
| 1754 |
\def\subsection{\@startsection{subsection}{2}{\z@}% |
| 1755 |
{-3.25ex\@plus -1ex \@minus -.2ex}% |
| 1756 |
{1.5ex \@plus .2ex}% |
| 1757 |
{\normalfont\large\bfseries}}% |
| 1758 |
\def\subsubsection{\@startsection{subsubsection}{3}{\z@}% |
| 1759 |
{-3.25ex\@plus -1ex \@minus -.2ex}% |
| 1760 |
{1.5ex \@plus .2ex}% |
| 1761 |
{\normalfont\normalsize\bfseries}}% |
| 1762 |
\def\paragraph{\@startsection{paragraph}{4}{\z@}% |
| 1763 |
{3.25ex \@plus1ex \@minus.2ex}% |
| 1764 |
{-1em}% |
| 1765 |
{\normalfont\normalsize\bfseries}}% |
| 1766 |
\def\subparagraph{\@startsection{subparagraph}{5}{\parindent}% |
| 1767 |
{3.25ex \@plus1ex \@minus .2ex}% |
| 1768 |
{-1em}% |
| 1769 |
{\normalfont\normalsize\bfseries}}% |
| 1770 |
}% |
| 1771 |
}% End of the derived code. |
| 1772 |
% \end{macrocode} |
| 1773 |
% \end{command} |
| 1774 |
% |
| 1775 |
% \begin{macro}{\@startsection} |
| 1776 |
% \KOMAScript{} classes redefine this internal \LaTeX{} kernel macro. In this |
| 1777 |
% case \cs{scr@saved@startsection} is defined, differs from |
| 1778 |
% \cs{@startsection} and has the definition found before redefining the |
| 1779 |
% original macro. We do nothing else but resetting \cs{@startsection} to this |
| 1780 |
% saved definition. |
| 1781 |
% \begin{macrocode} |
| 1782 |
\scr@ifundefinedorrelax{scr@saved@startsection}{}{% |
| 1783 |
\ifx\@startsection\scr@saved@startsection\else |
| 1784 |
\PackageWarningNoLine{scrhack}{% |
| 1785 |
Resetting \string\@startsection,\MessageBreak |
| 1786 |
because of loading standard classes sections hack% |
| 1787 |
}% |
| 1788 |
\let\@startsection\scr@saved@startsection |
| 1789 |
\fi |
| 1790 |
} |
| 1791 |
% \end{macrocode} |
| 1792 |
% \end{macro}^^A \@startsection |
| 1793 |
% |
| 1794 |
% \begin{macro}{\@sect,\@ssect,\@xsect} |
| 1795 |
% All these should be resetted to their original definitions stored in |
| 1796 |
% \cs{scr@latex@\dots}. |
| 1797 |
% \begin{macrocode} |
| 1798 |
\scr@ifundefinedorrelax{scr@latex@sect}{}{% |
| 1799 |
\ifx\@sect\scr@latex@sect\else |
| 1800 |
\PackageWarningNoLine{scrhack}{% |
| 1801 |
Resetting \string\@sect,\MessageBreak |
| 1802 |
because of loading standard classes sections hack% |
| 1803 |
}% |
| 1804 |
\let\@sect\scr@latex@sect |
| 1805 |
\fi |
| 1806 |
} |
| 1807 |
\scr@ifundefinedorrelax{scr@latex@ssect}{}{% |
| 1808 |
\ifx\@ssect\scr@latex@ssect\else |
| 1809 |
\PackageWarningNoLine{scrhack}{% |
| 1810 |
Resetting \string\@ssect,\MessageBreak |
| 1811 |
because of loading standard classes sections hack% |
| 1812 |
}% |
| 1813 |
\let\@ssect\scr@latex@ssect |
| 1814 |
\fi |
| 1815 |
} |
| 1816 |
\scr@ifundefinedorrelax{scr@latex@xsect}{}{% |
| 1817 |
\ifx\@xsect\scr@latex@xsect\else |
| 1818 |
\PackageWarningNoLine{scrhack}{% |
| 1819 |
Resetting \string\@xsect,\MessageBreak |
| 1820 |
because of loading standard classes sections hack% |
| 1821 |
}% |
| 1822 |
\let\@xsect\scr@latex@xsect |
| 1823 |
\fi |
| 1824 |
} |
| 1825 |
% \end{macrocode} |
| 1826 |
% \end{macro}^^A \@xsect,\@ssect,\@sect |
| 1827 |
% |
| 1828 |
% \begin{command}{\DeclareSectionCommand,\RedeclareSectionCommand, |
| 1829 |
% \DeclareNewSectionCommand,\ProvideSectionCommand, |
| 1830 |
% \DeclareSectionCommands,\RedeclareSectionCommands, |
| 1831 |
% \DeclareNewSectionCommands,\ProvideSectionCommands} |
| 1832 |
% These \KOMAScript{} commands do not make sense any longer after forced |
| 1833 |
% redefinition of \cs{part} \dots{} \cs{subparagraph}. They even would not |
| 1834 |
% work correctly after resetting, e.g., \cs{@startsection}. So best reaction |
| 1835 |
% is to \emph{undefine} them. |
| 1836 |
% \begin{macrocode} |
| 1837 |
\scr@ifundefinedorrelax{DeclareSectionCommand}{}{% |
| 1838 |
\PackageWarningNoLine{scrhack}{% |
| 1839 |
\string\DeclareSectionCommand\space |
| 1840 |
and all derivates deactivated,\MessageBreak |
| 1841 |
because of loading standard classes sections hack% |
| 1842 |
}% |
| 1843 |
\let\DeclareSectionCommand\undefined |
| 1844 |
\let\DeclareSectionCommands\undefined |
| 1845 |
\let\RedeclareSectionCommand\undefined |
| 1846 |
\let\RedeclareSectionCommands\undefined |
| 1847 |
\let\DeclareNewSectionCommand\undefined |
| 1848 |
\let\DeclareNewSectionCommands\undefined |
| 1849 |
\let\ProvideSectionCommand\undefined |
| 1850 |
\let\ProvideSectionCommands\undefined |
| 1851 |
} |
| 1852 |
% \end{macrocode} |
| 1853 |
% \begin{macro}{\scr@chapter@before@hyperref@patch, |
| 1854 |
% \scr@chapter@after@hyperref@patch} |
| 1855 |
% Now, definitions without respecting \pkg{hyperref} are used, so |
| 1856 |
% \pkg{hyperref} should again be able to patch them. So the hack should |
| 1857 |
% deactivate the patch deactivation of the \KOMAScript{} classes. |
| 1858 |
% \begin{macrocode} |
| 1859 |
\let\scr@chapter@before@hyperref@patch\relax |
| 1860 |
\let\scr@chapter@after@hyperref@patch\relax |
| 1861 |
% \end{macrocode} |
| 1862 |
% \end{macro} |
| 1863 |
% \end{command} |
| 1864 |
% |
| 1865 |
% \begin{macro}{\scr@osectarg} |
| 1866 |
% The \KOMAScript{} classes use this macro to store how to use the optional |
| 1867 |
% argument of section commands. But with the standard class definition the |
| 1868 |
% only possibility is to use it as running head and write it into the table of |
| 1869 |
% contents without any extended handling. So the only value, that makes sense |
| 1870 |
% is 0. |
| 1871 |
% \begin{macrocode} |
| 1872 |
\scr@ifundefinedorrelax{scr@osectarg}{}{% |
| 1873 |
\def\reserved@a{0}% |
| 1874 |
\ifx\scr@osectarg\reserved@a\else |
| 1875 |
\let\scr@osectarg\reserved@a |
| 1876 |
\PackageWarningNoLine{scrhack}{% |
| 1877 |
Extended option handling for section commands deactivated,\MessageBreak |
| 1878 |
because of loading standard classes sections hack% |
| 1879 |
}% |
| 1880 |
\fi |
| 1881 |
}% |
| 1882 |
% \end{macrocode} |
| 1883 |
% \begin{macro}{\scr@activate@xsection} |
| 1884 |
% Further changing of the value has to be deactivated. |
| 1885 |
% \begin{macrocode} |
| 1886 |
\scr@ifundefinedorrelax{scr@activate@xsection}{}{% |
| 1887 |
\renewcommand*{\scr@activate@xsection}[1]{% |
| 1888 |
\edef\scr@osectarg{#1}\def\reserved@a{0}% |
| 1889 |
\ifx\scr@osectarg\reserved@a |
| 1890 |
\else |
| 1891 |
\let\scr@osectarg\reserved@a |
| 1892 |
\PackageWarning{scrhack}{% |
| 1893 |
Because of loading the standard classes\MessageBreak |
| 1894 |
sections hack, the extended option handling\MessageBreak |
| 1895 |
of section commands failed% |
| 1896 |
}% |
| 1897 |
\fi |
| 1898 |
}% |
| 1899 |
} |
| 1900 |
% \end{macrocode} |
| 1901 |
% \end{macro}^^A \scr@activate@xsection |
| 1902 |
% \end{macro}^^A \scr@osectarg |
| 1903 |
% |
| 1904 |
% \begin{command}{\partformat,\chapterformat} |
| 1905 |
% Most \cs{\dots format} macros of \KOMAScript{} are still used, because of |
| 1906 |
% the redefinition of \cs{@seccntformat}. But \cs{part} and \cs{chapter} are |
| 1907 |
% defined without using them. |
| 1908 |
% \begin{macrocode} |
| 1909 |
\scr@ifundefinedorrelax{partformat}{}{% |
| 1910 |
\PackageWarningNoLine{scrhack}{% |
| 1911 |
Usage of \string\partformat\space |
| 1912 |
deactivated,\MessageBreak |
| 1913 |
because of loading the standard classes sections hack% |
| 1914 |
}% |
| 1915 |
} |
| 1916 |
\scr@ifundefinedorrelax{chapterformat}{}{% |
| 1917 |
\PackageWarningNoLine{scrhack}{% |
| 1918 |
Usage of \string\chapterformat\space |
| 1919 |
deactivated,\MessageBreak |
| 1920 |
because of loading the standard classes sections hack% |
| 1921 |
}% |
| 1922 |
} |
| 1923 |
% \end{macrocode} |
| 1924 |
% \end{command}^^A \chapterformat,\partformat |
| 1925 |
% |
| 1926 |
% \begin{command}{\sectionformat,\subsectionformat,\subsubsectionformat, |
| 1927 |
% \paragraphformat,\subparagraphformat} |
| 1928 |
% All these commands have to be resetted to not use the automatic dot and to |
| 1929 |
% add a \cs{quad} instead of an \cs{enskip}. |
| 1930 |
% \begin{macrocode} |
| 1931 |
\scr@ifundefinedorrelax{sectionformat}{}{% |
| 1932 |
\PackageWarningNoLine{scrhack}{% |
| 1933 |
\string\sectionformat\space set to |
| 1934 |
`\string\thesection\string\quad',\MessageBreak |
| 1935 |
because of loading the standard classes sections hack% |
| 1936 |
}% |
| 1937 |
\renewcommand*{\sectionformat}{\thesection\quad}% |
| 1938 |
} |
| 1939 |
\scr@ifundefinedorrelax{subsectionformat}{}{% |
| 1940 |
\PackageWarningNoLine{scrhack}{% |
| 1941 |
\string\subsectionformat\space set to |
| 1942 |
`\string\thesubsection\string\quad'\MessageBreak |
| 1943 |
because of loading the standard classes sections hack% |
| 1944 |
}% |
| 1945 |
\renewcommand*{\subsectionformat}{\thesubsection\quad}% |
| 1946 |
} |
| 1947 |
\scr@ifundefinedorrelax{subsubsectionformat}{}{% |
| 1948 |
\PackageWarningNoLine{scrhack}{% |
| 1949 |
\string\subsubsectionformat\space set to |
| 1950 |
`\string\thesubsubsection\string\quad'\MessageBreak |
| 1951 |
because of loading the standard classes sections hack% |
| 1952 |
}% |
| 1953 |
\renewcommand*{\subsubsectionformat}{\thesubsubsection\quad}% |
| 1954 |
} |
| 1955 |
\scr@ifundefinedorrelax{paragraphformat}{}{% |
| 1956 |
\PackageWarningNoLine{scrhack}{% |
| 1957 |
\string\paragraphformat\space set to |
| 1958 |
`\string\theparagraph\string\quad'\MessageBreak |
| 1959 |
because of loading the standard classes sections hack% |
| 1960 |
}% |
| 1961 |
\renewcommand*{\paragraphformat}{\theparagraph\quad}% |
| 1962 |
} |
| 1963 |
\scr@ifundefinedorrelax{subparagraphformat}{}{% |
| 1964 |
\PackageWarningNoLine{scrhack}{% |
| 1965 |
\string\subparagraphformat\space set to |
| 1966 |
`\string\thesubparagraph\string\quad'\MessageBreak |
| 1967 |
because of loading the standard classes sections hack% |
| 1968 |
}% |
| 1969 |
\renewcommand*{\subparagraphformat}{\thesubparagraph\quad}% |
| 1970 |
} |
| 1971 |
% \end{macrocode} |
| 1972 |
% \end{command} |
| 1973 |
% |
| 1974 |
% \begin{command}{\partlineswithprefixformat, |
| 1975 |
% \chapterlineswithprefixformat,\chapterlinesformat, |
| 1976 |
% \sectionlinesformat,\sectioncatchphraseformat} |
| 1977 |
% These \KOMAScript{} commands are not used any longer. |
| 1978 |
% \begin{macrocode} |
| 1979 |
\scr@ifundefinedorrelax{partlineswithprefixformat}{}{% |
| 1980 |
\PackageWarningNoLine{scrhack}{% |
| 1981 |
Usage of \string\partlineswithprefixformat\space deactivated,\MessageBreak |
| 1982 |
because of loading the standard classes sections hack% |
| 1983 |
}% |
| 1984 |
} |
| 1985 |
\scr@ifundefinedorrelax{chapterlineswithprefixformat}{}{% |
| 1986 |
\PackageWarningNoLine{scrhack}{% |
| 1987 |
Usage of \string\chapterlineswithprefixformat\space and\MessageBreak |
| 1988 |
\string\chapterlinesformat\space deactivated,\MessageBreak |
| 1989 |
because of using standard classes sections hack% |
| 1990 |
}% |
| 1991 |
} |
| 1992 |
\scr@ifundefinedorrelax{sectionlinesformat}{}{% |
| 1993 |
\PackageWarningNoLine{scrhack}{% |
| 1994 |
Usage of \string\sectionlinesformat\space and\MessageBreak |
| 1995 |
\string\sectioncatchphraseformat\space deactivated,\MessageBreak |
| 1996 |
because of using standard classes sections hack% |
| 1997 |
}% |
| 1998 |
} |
| 1999 |
% \end{macrocode} |
| 2000 |
% \end{command}^^A \partlineswithprefixformat … |
| 2001 |
% |
| 2002 |
% \begin{option}{headings} |
| 2003 |
% \changes{v3.39}{2022/11/11}{initial dot in member argument of option storage |
| 2004 |
% commands removed} |
| 2005 |
% The \KOMAScript{} option does not make sense any longer. So it is |
| 2006 |
% deactivated and usage will throw an error. |
| 2007 |
% \begin{macrocode} |
| 2008 |
\scr@ifundefinedorrelax{KOMAClassName}{}{% |
| 2009 |
\PackageWarningNoLine{scrhack}{% |
| 2010 |
KOMA-Script option `headings' removed,\MessageBreak |
| 2011 |
because of loading standard classes sections hack% |
| 2012 |
}% |
| 2013 |
\RelaxFamilyKey[.\KOMAClassFileName]{KOMA}{headings}% |
| 2014 |
\KOMA@kav@removekey{\KOMAClassFileName}{headings}% |
| 2015 |
} |
| 2016 |
% \end{macrocode} |
| 2017 |
% \end{option}^^A headings |
| 2018 |
% |
| 2019 |
% \begin{macro}{\scr@class@titlesec@warning} |
| 2020 |
% The warning about loading \pkg{titlesec} has to be changes, because we do |
| 2021 |
% not expect errors any longer. |
| 2022 |
% \begin{macrocode} |
| 2023 |
\def\scr@class@titlesec@warning{% |
| 2024 |
\PackageWarning{scrhack}{% |
| 2025 |
Usage of `titlesec' should work, because of\MessageBreak |
| 2026 |
loading the standard classes sections hack.\MessageBreak |
| 2027 |
However, you should know, there is not any\MessageBreak |
| 2028 |
support for this combination by the\MessageBreak |
| 2029 |
KOMA-Script author% |
| 2030 |
}% |
| 2031 |
} |
| 2032 |
%</standardsections&body> |
| 2033 |
% \end{macrocode} |
| 2034 |
% \end{macro}^^A \scr@class@titlesec@warning |
| 2035 |
% |
| 2036 |
% \subsection{Executing options} |
| 2037 |
% |
| 2038 |
% Last but not least the options have to be processed. In the generated |
| 2039 |
% package this will be done before the commands of \autoref{sec:macros}. |
| 2040 |
% \begin{macrocode} |
| 2041 |
%<*package&option> |
| 2042 |
\KOMAProcessOptions\relax |
| 2043 |
%</package&option> |
| 2044 |
% \end{macrocode} |
| 2045 |
% |
| 2046 |
% \Finale |
| 2047 |
% \PrintChanges |
| 2048 |
% |
| 2049 |
\endinput |
| 2050 |
% Local Variables: |
| 2051 |
% mode: doctex |
| 2052 |
% ispell-local-dictionary: "en_US" |
| 2053 |
% eval: (flyspell-mode 1) |
| 2054 |
% TeX-master: t |
| 2055 |
% TeX-engine: luatex-dev |
| 2056 |
% 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")) |
| 2057 |
% End: |