% \CheckSum{679} % \iffalse meta-comment % ====================================================================== % scrhack.dtx % Copyright (c) Markus Kohm, 2008-2013 % % 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.txt. % % To create `scrhack.sty' run `tex scrhack.dtx'. Using LaTeX instead % of TeX would generate the implementation documentation. % ---------------------------------------------------------------------- % scrhack.dtx % Copyright (c) Markus Kohm, 2008-2013 % % Dieses Werk darf nach den Bedingungen der LaTeX Project Public Lizenz, % Version 1.3c, verteilt und/oder veraendert werden. % Die neuste Version dieser Lizenz ist % http://www.latex-project.org/lppl.txt % und Version 1.3c ist Teil aller Verteilungen von LaTeX % Version 2005/12/01 oder spaeter und dieses Werks. % % Dieses Werk hat den LPPL-Verwaltungs-Status "author-maintained" % (allein durch den Autor verwaltet). % % Der Aktuelle Verwalter und Autor dieses Werkes ist Markus Kohm. % % Dieses Werk besteht aus den in manifest.txt aufgefuehrten Dateien. % % `scrhack.sty' kann durch den Aufruf `tex scrhack.dtx' erzeugt % werden. Bei Verwendung von LaTeX statt TeX wird hingegen die % Implementierungsdokumentation erzeugt. % ====================================================================== % \fi % % \CharacterTable % {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z % Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z % Digits \0\1\2\3\4\5\6\7\8\9 % Exclamation \! Double quote \" Hash (number) \# % Dollar \$ Percent \% Ampersand \& % Acute accent \' Left paren \( Right paren \) % Asterisk \* Plus \+ Comma \, % Minus \- Point \. Solidus \/ % Colon \: Semicolon \; Less than \< % Equals \= Greater than \> Question mark \? % Commercial at \@ Left bracket \[ Backslash \\ % Right bracket \] Circumflex \^ Underscore \_ % Grave accent \` Left brace \{ Vertical bar \| % Right brace \} Tilde \~} % % \iffalse %%% From File: $Id: scrhack.dtx 1383 2013-10-01 15:44:28Z mjk $ %%%% using: package,identify %%%% using: package,option %%%% using: package,body %\NeedsTeXFormat{LaTeX2e}[1995/06/01] %<*driver> \ifx\ProvidesFile\undefined\def\ProvidesFile#1[#2]{}\fi \ProvidesFile{scrhack.dtx}[% % %\ProvidesFile{scrhack.tex}[% %\ProvidesPackage{scrhack}[% %\ProvidesFile{hyperref.hak}[% %\ProvidesFile{float.hak}[% %\ProvidesFile{floatrow.hak}[% %\ProvidesFile{listings.hak}[% %<*driver|manual|identify> %!KOMAScriptVersion package %<*!identify> (hacking other packages)% % % % (hacking package % hyperref)% % float)% % floatrow)% % listings)% %<*driver|manual|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}% }% } \@@input scrstrop.inc \else \let\endbatchfile\relax \fi \endbatchfile % %<*driver> \documentclass[halfparskip-]{scrdoc} \usepackage[latin1]{inputenc} \usepackage[english,ngerman]{babel} \usepackage[T1]{fontenc} \usepackage{lmodern} \CodelineIndex \RecordChanges \begin{document} \GetFileInfo{scrhack.dtx} \DocInput{scrhack.dtx} \end{document} % % \fi % % % \selectlanguage{english} % % \newcommand*{\Package}[1]{\textsf{\mbox{#1}}} % \let\File\Package % \let\Macro\cs % \let\PName\meta % \let\Parameter\marg % \providecommand*{\PParameter}[1]{\texttt{\{#1\}}} % \providecommand*{\Counter}[1]{\texttt{\mbox{#1}}} % \providecommand*{\OptionValue}[2]{\texttt{\mbox{#1=}\linebreak[3]\mbox{#2}}} % \let\PValue\texttt % % \title{\KOMAScript{} \partname\ \texttt{\filename}% % \thanks{This file is version \fileversion\ of \texttt{\filename}.}} % \date{\filedate} % \author{Markus Kohm\thanks{mailto:komascript(at)gmx.info}} % \maketitle % \begin{abstract} % \iffalse %<*manual|dtx> %<*manual> \chapter{Hacks for Third-Party Packages by Package \Package{scrhack}} \labelbase{scrhack} % % \fi 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 \Package{scrhack} contains all those improvement proposals for other packages. This means, \Package{scrhack} redefines macros of packages from other authors! The redefinitions are only activated, if those packages were loaded. Users may prevent \Package{scrhack} from redefining macros of individual packages. %\iffalse %<*dtx> %\fi % \end{abstract} % \tableofcontents %\iffalse % %\fi \section{The \Package{hyperref} hack} \label{sec:scrhack.hyperref} Before version~6.79h package \Package{hyperref} does behave different at part, chapter, and section headings that get no number. If they get no number, because of to low counter \Counter{secnumdepth} \Package{hyperref} sets an anchor for links and bookmarks before the heading. Same would be, if the headings have a number. But if the headings get no number because of usage of the star version of the commands, e.g., \Macro{part*}, \Macro{chapter*} or \Macro{section*}, the anchor for links and bookmarks are set after the headings. The anchors for numbered headings are always set before the headings. Package \Package{scrhack} redefines some macros of some hyperref driver files, e.g., \File{hpdftex.def}, after loading the hyperref driver file. With this redefinitions the anchor of not numbered headings will be set always before the headings, too. % \iffalse \begin{Declaration} \KOption{hyperref}{switch} \end{Declaration} % \fi You may switch off the \Package{hyperref} hack loading package \Package{scrhack} with option \OptionValue{hyperref}{false}. You may also switch off the \Package{hyperref} hack using \Macro{KOMAoptions}\PParameter{hyperref=false} or \Macro{KOMAoption}\PParameter{hyperref}\PParameter{false} somewhere after loading package \Package{scrhack}, but before loading the hyperref driver package, that is by default after loading the package. \section{The \Package{float} hack} \label{sec:scrhack.float} Package \Package{float} uses macros \Macro{float@listhead} to set the headings of a float listing and \Macro{float@addtolists} to add informations to all float listings. These macros where proposed by the \KOMAScript{} author for some years. In theory those macros may be used by several class and package authors to deligate some parts of the creation of a float listing to the class. This would increase the compatiblity of packages and classes. But unfortunately some package authors, even the author of package \Package{float}, implemented the commands in such a way, that these packages will become incompatible to each other. Because of this \KOMAScript\ stopped support for \Macro{float@addtolists} and \Macro{float@listhead} with version 3. Instead of this \KOMAScript\ supports several improvements for package authors using \KOMAScript\ package \Package{tocbasic}. Package \Package{scrhack} redefines some macros of package \Package{float} to not longer use \Macro{float@addtolists} and \Macro{float@listhead} but use the interface of package \Package{tocbasic}. This does not only improve the compatibility of \KOMAScript\ and package \Package{float}, but also improves the compatibility of packages \Package{babel} and \Package{float}. % \iffalse \begin{Declaration} \KOption{float}{switch} \end{Declaration} % \fi You may switch off the \Package{float} hack loading package \Package{scrhack} with option \OptionValue{float}{false}. You may also switch off the \Package{float} hack using \Macro{KOMAoptions}\PParameter{float=false} or \Macro{KOMAoption}\PParameter{float}\PParameter{false} somewhere after loading package \Package{scrhack}, but before loading package \Package{float}. \section{The \Package{floatrow} hack} \label{sec:scrhack.floatrow} Package \Package{floatrow} uses macros \Macro{float@listhead} to set the headings of a float listing and \Macro{float@addtolists} to add informations to all float listings. These macros where proposed by the \KOMAScript{} author for some years. In theory those macros may be used by several class and package authors to deligate some parts of the creation of a float listing to the class. This would increase the compatiblity of packages and classes. But unfortunately some package authors, even the author of package \Package{floatrow}, implemented the commands in such a way, that these packages will become incompatible to each other. Because of this \KOMAScript\ stopped support for \Macro{float@addtolists} and \Macro{float@listhead} with version 3. Instead of this \KOMAScript\ supports several improvements for package authors using \KOMAScript\ package \Package{tocbasic}. Package \Package{scrhack} redefines some macros of package \Package{floatrow} to not longer use \Macro{float@addtolists} and \Macro{float@listhead} but use the interface of package \Package{tocbasic}. This does not only improve the compatibility of \KOMAScript\ and package \Package{floatrow}, but also improves the compatibility of packages \Package{babel} and \Package{floatrow}. % \iffalse \begin{Declaration} \KOption{floatrow}{switch} \end{Declaration} % \fi You may switch off the \Package{floatrow} hack loading package \Package{scrhack} with option \OptionValue{floatrow}{false}. You may also switch off the \Package{floatrow} hack using \Macro{KOMAoptions}\PParameter{floatrow=false} or \Macro{KOMAoption}\PParameter{floatrow}\PParameter{false} somewhere after loading package \Package{scrhack}, but before loading package \Package{floatrow}. \section{The \Package{listings} hack} \label{sec:scrhack.listings} Package \Package{listings} uses macros \Macro{float@listhead} to set the headings of a float listing, if defined, and \Macro{float@addtolists} to add informations to all float listings. These macros where proposed by the \KOMAScript{} author for some years. In theory those macros may be used by several class and package authors to deligate some parts of the creation of a float listing to the class. This would increase the compatiblity of packages and classes. But unfortunately some package authors, even the author of package \Package{float}, impemented the commands in such a way, that these packages may become incompatible to each other. Because of this \KOMAScript\ stopped support for \Macro{float@addtolists} and \Macro{float@listhead} with version 3. Instead of this \KOMAScript\ supports several improvements for package authors using \KOMAScript\ package \Package{tocbasic}. Package \Package{scrhack} redefines some macros of package \Package{listings} to not longer use \Macro{float@addtolists} and \Macro{float@listhead} but use the interface of package \Package{tocbasic}. This does not only improve the compatibility of \KOMAScript\ and package \Package{listings}, but also improves the compatibility of packages \Package{babel} and \Package{listings}. Note: A significant change with \Package{scrhack} is, that \KOMAScript{} options like \OptionValue{lists}{totoc} or \OptionValue{lists}{totocnumbered} does only change the behaviour of \Macro{listoflistings}, if they are set after loading package \Package{listings}. % \iffalse \begin{Declaration} \KOption{listings}{switch} \end{Declaration} % \fi You may switch off the \Package{listings} hack loading package \Package{scrhack} with option \OptionValue{listings}{false}. You may also switch off the \Package{listings} hack using \Macro{KOMAoptions}\PParameter{listings=false} or \Macro{KOMAoption}\PParameter{listings}\PParameter{false} somewhere after loading package \Package{scrhack}, but before loading package \Package{listings}. % \iffalse % % \fi % % \selectlanguage{ngerman} % \StopEventually{\PrintIndex\PrintChanges} % \changes{v3.03}{2009/03/12}{erste Version des Pakets} % % \section{Implementation of \Package{scrhack}} % % \changes{v3.04b}{2009/08/05}{Die Reihenfolge von Anweisungen und Optionen % grundlegend geändert, um das Paket \textsf{scrhack} unabhängiger von der % Reihenfolge beim Laden von Paketen zu machen.} % % \subsection{Optionen} % % \iffalse %<*package&option> % \fi % % Das Paket bedient sich \cs{KOMAoptions} etc. aus \textsf{scrkbase} (dieses % wird übrigens direkt per \texttt{scrkbase.dtx} geladen). % % Per Option kann gewählt werden, welche Manipulationen geladen werden % sollen. Alle diese Optionen können jedoch nur bis zum Laden des % entsprechenden Pakets oder dem Laden von \textsf{scrhack} gesetzt % werden (es zählt, was später kommt). Anschließend sind sie wirkungslos. % % \subsection{Verwendete Anweisungen} % % \iffalse % %<*package&body> % \fi % % \begin{macro}{\scr@ifexpected} % Wenn die im ersten Argument angegebene Anweisung nach Ausführung der im % zweiten Argument angegebenen Anweisungen unverändert ist, dann soll das % dritte Argument ausgeführt werden, sonst das vierte. % \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} % Wenn die Datei mit dem Namen des zweiten Arguments und der Endung des ersten % Arguments so geladen wurde, dass \LaTeX{} eine Versionsinfo dazu gespeichert % hat, dann soll zusätzlich der entsprechende Hack geladen werden. % \begin{macrocode} \newcommand*{\scr@hack@load}[2]{% \expandafter\ifx\csname ver@#2.#1\endcsname\relax \expandafter\@secondoftwo \else \expandafter\@firstoftwo \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} % % \iffalse % % \fi % % \subsection{Der \textsf{hyperref}-Hack} % % \textsf{hyperref} setzt den Anker zu der Stern-Variante einer Überschrift % hinter die Überschrift, während es bei der nicht Stern-Variante den Anker % auch dann vor die Überschrift setzt, wenn die Überschrift aufgrund von % \texttt{secnumdepth} nicht nummeriert wird. Der Hack setzt den Anker % einheitlich vor die Überschrift. % % \begin{option}{hyperref} % \changes{v3.12}{2013/03/05}{Signalisierung mit \cs{FamilyKeyStateProcessed}} % \begin{macrocode} %<*package&option> \KOMA@ifkey{hyperref}{@scrhack@hyperref}% \@scrhack@hyperreftrue % %<*package&body> % \end{macrocode} % \changes{v3.04b}{2009/11/09}{\textsf{hyperref}-Hack wird früher geladen} % Hier muss ein wenig trickreicher gearbeitet werden, weil \textsf{hyperref} % die Treiberdatei per \cs{AtEndOfPackage} lädt und der Hack erst danach % installiert werden darf. Mit \cs{AfterPackage*} alleine, würde der Hack aber % vor dem Laden der Treiberdatei installiert. Dafür können wir aber sicher % sein, dass ein innerhalb von \cs{AfterPackage*} aufgerufenes % \cs{AtEndOfPackage} garantiert nach dem Laden der Treiberdatei ausgeführt % wird. Das funktioniert auch noch, wenn \textsf{hyperref} bereits geladen % wurde. In dem Fall wird der Code einfach nach dem Ende von \textsf{scrhack} % statt nach dem Ende von \textsf{hyperref} ausgeführt. % \begin{macrocode} \AfterPackage*{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,}% }{% \AtEndOfPackage{% \KOMA@key[.scrhack.sty]{hyperref}{% \PackageWarning{scrhack}{option `hyperref=#1' ignored}% \FamilyKeyStateProcessed }% \if@scrhack@hyperref\scr@hack@load\@pkgextension{hyperref}\fi }% }% } % % \end{macrocode} % \end{option} % % % \begin{macro}{\@schapter} % \begin{macro}{\@spart} % \begin{macro}{\@ssect} % Eigentlich wird hier gar nicht \texttt{hyperref.sty} verändert, sondern % diverse Treiberdateien. Sobald das Paket \textsf{hyperref} geladen ist, ist % auch die passende Treiberdatei geladen und außerdem sind alle % Treiberdateien, die entsprechende Definitionen vornehmen, gleichermaßen % betroffen. Also kann der entsprechende Patch einfach erfolgen, wenn hyperref % geladen ist (was bereits von \cs{scr@hack@load} getestet wurde). Es muss % also nur noch sichergestellt werden, dass die umzudefinierenden Macros % 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}% }% } % % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % % % \subsection{Der \textsf{float}-Hack} % % Das \textsf{float}-Paket verwendet das Makro \cs{float@listhead} zum % Setzen der Überschriften. Dies wird seit \KOMAScript~3 nicht mehr empfohlen % und fliegt demnächst komplett aus der Unterstützung. Stattdessen wird % empfohlen, dass Pakete \textsf{tocbasic} unterstützen. Der Aufwand dafür ist % sehr gering und wird mit vielen neuen Möglichkeiten belohnt. % % Dieser Hack rüstet die \textsf{tocbasic}-Unterstützung für \textsf{float} % nach. % % \begin{option}{float} % \changes{v3.12}{2013/03/05}{Signalisierung mit \cs{FamilyKeyStateProcessed}} % \begin{macrocode} %<*package&option> \KOMA@ifkey{float}{@scrhack@float}% \@scrhack@floattrue % %<*package&body> \AfterPackage*{float}{% \KOMA@key[.scrhack.sty]{float}{% \PackageWarning{scrhack}{option `float' ignored}% \FamilyKeyStateProcessed }% \if@scrhack@float\scr@hack@load\@pkgextension{float}\fi } % % \end{macrocode} % \end{option} % % % \begin{macro}{\newfloat} % Über die Anweisung \cs{newfloat} wird eine neue Gleitumgebung % definiert. Hier muss die neue Erweiterung aus dem dritten Argument % \textsf{tocbasic} bekannt gemacht werden. % \begin{macro}{\listof} % Über die Anweisung \cs{listof} wird ein Verzeichnis für Gleitumgebungen % ausgegeben. Hier muss schlicht die entsprechende Anweisung von % \textsf{tocbasic} verwendet werden. % \begin{macro}{\float@addtolists} % Diese Anweisung wird nicht länger benötigt und daher auf die ursprüngliche % Definition zurückgesetzt. % \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}{% \@namedef{l@#1}{\@dottedtocline{1}{1.5em}{2.3em}}}{}% }{}% \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}% } % % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % % % \subsection{Der \textsf{floatrow}-Hack} % % Das \textsf{floatrow}-Paket verwendet das Makro \cs{float@listhead} zum % Setzen der Überschriften. Dies wird seit \KOMAScript~3 nicht mehr empfohlen % und fliegt demnächst komplett aus der Unterstützung. Stattdessen wird % empfohlen, dass Pakete \textsf{tocbasic} unterstützen. Der Aufwand dafür ist % sehr gering und wird mit vielen neuen Möglichkeiten belohnt. % % Dieser Hack rüstet die \textsf{tocbasic}-Unterstützung für \textsf{floatrow} % nach. % % \begin{option}{floatrow} % \changes{v3.12}{2013/03/05}{Signalisierung mit \cs{FamilyKeyStateProcessed}} % \begin{macrocode} %<*package&option> \KOMA@ifkey{floatrow}{@scrhack@floatrow}% \@scrhack@floatrowtrue % %<*package&body> \AfterPackage*{floatrow}{% \KOMA@key[.scrhack.sty]{floatrow}{% \PackageWarning{scrhack}{option `floatrow' ignored}% \FamilyKeyStateProcessed }% \if@scrhack@floatrow\scr@hack@load\@pkgextension{floatrow}\fi } % % \end{macrocode} % \end{option} % % % \begin{macro}{\DeclareNewFloatType} % Über die Anweisung \cs{DeclareNewFloatType} wird eine neue Gleitumgebung % definiert. Hier muss die neue Erweiterung aus dem dritten Argument % \textsf{tocbasic} bekannt gemacht werden. % \begin{macro}{\listof} % Über die Anweisung \cs{listof} wird ein Verzeichnis für Gleitumgebungen % ausgegeben. Hier muss schlicht die entsprechende Anweisung von % \textsf{tocbasic} verwendet werden. % \begin{macro}{\float@addtolists} % Diese Anweisung wird nicht länger benötigt und daher auf die ursprüngliche % Definition zurückgesetzt. % \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} % Eigentlich wäre es besser, wie im \textsf{float}-Hack einen Test % vorzuschalten, ob die Dateiendung bereits in Gebrauch ist. Aber das würde % voraussetzen, dass die Reihenfolge der Anweisungen geändert wird. Dazu % stecke ich aber im Code von \textsf{floatrow} zu wenig % drin. (\emph{\foreignlanguage{english}{Note: It would be better to first % test, if the new extension is already in use like done at the % \textsf{float} hack. But I don't know the \textsf{floatrow} code good % enough to make such a change!}}) % \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}% \@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 \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}{% \@namedef{l@#1}{\@dottedtocline{1}{1.5em}{2.3em}}}{}% }{}% \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}% } % % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % % % \subsection{Der \textsf{listings}-Hack} % % Das \textsf{listings}-Paket verwendet das Makro \cs{float@listhead} zum % Setzen der Überschriften. Dies wird seit \KOMAScript~3 nicht mehr empfohlen % und fliegt demnächst komplett aus der Unterstützung. Stattdessen wird % empfohlen, dass Pakete \textsf{tocbasic} unterstützen. Der Aufwand dafür ist % sehr gering und wird mit vielen neuen Möglichkeiten belohnt. % % Dieser Hack rüstet die \textsf{tocbasic}-Unterstützung für \textsf{listings} % nach. % % \begin{option}{listings} % \changes{v3.12}{2013/03/05}{Signalisierung mit \cs{FamilyKeyStateProcessed}} % \begin{macrocode} %<*package&option> \KOMA@ifkey{listings}{@scrhack@listings}% \@scrhack@listingstrue % %<*package&body> \AfterPackage*{listings}{% \KOMA@key[.scrhack.sty]{listings}{% \PackageWarning{scrhack}{option `listings' ignored}% \FamilyKeyStateProcessed }% \if@scrhack@listings\scr@hack@load\@pkgextension{listings}\fi } % % \end{macrocode} % \end{option} % % % \begin{macro}{\scr@do@hack@listings} % \begin{macro}{\lstlistoflistings} % Über dieses Macro wird das Verzeichnis der Listings gesetzt. Die gesamte % Funktionalität dafür kann \Package{tocbasic} überlassen werden. % \begin{macro}{\float@addtolists} % Diese Anweisung wird nicht länger benötigt und daher auf die ursprüngliche % Definition zurückgesetzt. Da \Package{listings} ihre Definition mit % \Macro{AtBeginDocument} verzögert, muss dies hier ebenfalls geschehen. % \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}% }% }% }% \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}% }% } % % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % % % \subsection{Optionen ausführen} % % Zum Schluss noch die Optionen ausführen. Im Paket wird diese Anweisung % allerdings vor den Anweisungen der Hacks und den Anweisungen aus dem % Abschnitt »Verwendete Anweisungen« stehen. % \begin{macrocode} %<*package&option> \KOMAProcessOptions\relax % % \end{macrocode} % % % \Finale % \endinput % % end of file `scrhack.dtx' %%% Local Variables: %%% mode: doctex %%% coding: iso-latin-1 %%% TeX-master: %%% End: