diff options
author | Karl Berry <karl@freefriends.org> | 2009-03-31 00:25:41 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2009-03-31 00:25:41 +0000 |
commit | d9a28f240927d595970990e323f189f3ed45bdaf (patch) | |
tree | 7ccf4eea17aed62ba6dcc4639b67832a863782b4 /Master/texmf-dist/source/latex/koma-script/scrhack.dtx | |
parent | 088ae35fa451f7492dec5997ba5f8d53df17f47e (diff) |
koma-script update (30mar09)
git-svn-id: svn://tug.org/texlive/trunk@12579 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/koma-script/scrhack.dtx')
-rw-r--r-- | Master/texmf-dist/source/latex/koma-script/scrhack.dtx | 747 |
1 files changed, 747 insertions, 0 deletions
diff --git a/Master/texmf-dist/source/latex/koma-script/scrhack.dtx b/Master/texmf-dist/source/latex/koma-script/scrhack.dtx new file mode 100644 index 00000000000..2e5c250b15b --- /dev/null +++ b/Master/texmf-dist/source/latex/koma-script/scrhack.dtx @@ -0,0 +1,747 @@ +% \CheckSum{472} +% \iffalse meta-comment +% ====================================================================== +% scrhack.dtx +% Copyright (c) Markus Kohm, 2009 +% +% 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-2009 +% +% 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: scrhack.dtx +%<package&identify>%%% using: package,identify +%<package&option>%%% using: package,option +%<package&body>%%% using: package,body +%<package&identity>\NeedsTeXFormat{LaTeX2e}[1995/06/01] +%<manual>\ProvidesFile{scrhack.tex} +%<*dtx> +\ProvidesFile{scrhack.dtx} +%</dtx> +%<*dtx|manual> + [2009/03/17 v3.03 KOMA-Script (hacking other packages)] +%</dtx|manual> +%<package&identify>\ProvidesPackage{scrhack} +%<hyperref&identify>\ProvidesFile{hyperref.hck} +%<float&identify>\ProvidesFile{float.hck} +%<listings&identify>\ProvidesFile{listings.hck} +%<identify> [\KOMAScriptVersion\space +%<package&identify> package (hacking other packages)] +%<hack&identify> hacking package +%<hyperref&identify> hyperref] +%<float&identify> float] +%<listings&identify> listings] +%<*dtx> +\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} +%</dtx> +% \fi +% +% +% \selectlanguage{english} +% +% \newcommand*{\Package}[1]{\textsf{\mbox{#1}}} +% \let\File\Package +% \let\Macro\cs +% \let\PName\meta +% \let\Parameter\marg +% \newcommand*{\PParameter}[1]{\texttt{\{#1\}}} +% \newcommand*{\counter}[1]{\texttt{\mbox{#1}}} +% \newcommand*{\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} +%</manual> +% \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 +%</dtx> +%\fi + +\section{The \Package{hyperref} hack} +\label{sec:scrhack.hyperref} + +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}, while execution of +\Macro{begin}\PParameter{document}. 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 of the \Package{hyperref} hack loading package +\Package{scrhack} with option \OptionValue{hyperref}{false}. You may also +switch of 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 +\Macro{begin}\PParameter{document}. + +\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 +unfortunaltly some package authors, even the author of package +\Package{float}, impemented 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}. + +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 float listings, that are already defined using +\Macro{newfloat} \emph{before} using such an option! + +% \iffalse +\begin{Declaration} + \KOption{float}{switch} +\end{Declaration} +% \fi +You may switch of the \Package{float} hack loading package \Package{scrhack} +with option \OptionValue{float}{false}. You may also switch of 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{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 unfortunaltly 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 of the \Package{listings} hack loading package +\Package{scrhack} with option \OptionValue{listings}{false}. You may also +switch of 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 +%</manual|dtx> +% \fi +% +% \selectlanguage{ngerman} +% \StopEventually{\PrintIndex\PrintChanges} +% \changes{v3.03}{2009/03/12}{erste Version des Pakets} +% +% \section{Implementation of \Package{scrhack}} +% +% \subsection{Optionen} +% +% \iffalse +%<*package&option> +% \fi +% +% Das Paket bedient sich \cs{KOMAoptions} etc. aus \textsf{scrkbase}. +% +% Per Option kann gewählt werden, welche Manipulationen geladen werden +% sollen. Alle diese Optionen können jedoch nur bis zum Laden des +% entsprechenden Pakets gesetzt werden. Anschließend sind sie wirkungslos. +% +% \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} +% \begin{macrocode} +\KOMA@ifkey{hyperref}{@scrhack@hyperref}% +\@scrhack@hyperreftrue +\AtBeginDocument{% + \KOMA@key[.scrhack.sty]{hyperref}{% + \PackageWarning{scrhack}{option `hyperref=#1' ignored}% + }% + \if@scrhack@hyperref\scr@hack@load\@pkgextension{hyperref}\fi +} +% \end{macrocode} +% \end{option} +% +% \iffalse +%</package&option> +%<*hyperref&body> +% \fi +% +% \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} +\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} +% +% \iffalse +%</hyperref&body> +%<*package&option> +% \fi +% +% \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} +% \begin{macrocode} +\KOMA@ifkey{float}{@scrhack@float}% +\@scrhack@floattrue +\AfterPackage*{float}{% + \KOMA@key[.scrhack.sty]{float}{% + \PackageWarning{scrhack}{option `float' ignored}% + }% + \if@scrhack@float\scr@hack@load\@pkgextension{float}\fi +} +% \end{macrocode} +% \end{option} +% +% \iffalse +%</package&option> +%<*float&body> +% \fi +% +% \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} +\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} +% +% \iffalse +%</float&body> +%<*package&option> +% \fi +% +% +% \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} +% \begin{macrocode} +\KOMA@ifkey{listings}{@scrhack@listings}% +\@scrhack@listingstrue +\AfterPackage*{listings}{% + \KOMA@key[.scrhack.sty]{listings}{% + \PackageWarning{scrhack}{option `listings' ignored}% + }% + \if@scrhack@listings\scr@hack@load\@pkgextension{listings}\fi +} +% \end{macrocode} +% \end{option} +% +% \iffalse +%</package&option> +%<*listings&body> +% \fi +% +% \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} +\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} +% +% \iffalse +%</listings&body> +%<*package&option> +% \fi +% +% \subsection{Optionen ausführen} +% +% Zum Schluss noch die Optionen ausführen. +% \begin{macrocode} +\KOMAProcessOptions\relax +% \end{macrocode} +% +% \iffalse +%</package&option> +% \fi +% +% \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}% + \makeatletter\input{#2.hak}\makeatother}% + {\PackageInfo{scrhack}{ignorring #2 hack}}% +} +% \end{macrocode} +% \end{macro} +% +% \iffalse +%</package&body> +% \fi +% +% \Finale +% +\endinput +% +% end of file `scrhack.dtx' +%%% Local Variables: +%%% mode: doctex +%%% coding: iso-latin-1 +%%% TeX-master: t +%%% End: |