diff options
author | Karl Berry <karl@freefriends.org> | 2010-02-17 01:13:08 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2010-02-17 01:13:08 +0000 |
commit | fc452419467f73cbbe9e7748ac266442487b75c4 (patch) | |
tree | 9f2cc4858705479715feb886723ffd6361cbfc29 /Master/texmf-dist/source/latex/koma-script/scrhack.dtx | |
parent | 5323eaeeb7b140b77a69f88dba6a5ef38f12f60e (diff) |
koma-script update (16feb10)
git-svn-id: svn://tug.org/texlive/trunk@17067 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 | 244 |
1 files changed, 136 insertions, 108 deletions
diff --git a/Master/texmf-dist/source/latex/koma-script/scrhack.dtx b/Master/texmf-dist/source/latex/koma-script/scrhack.dtx index ea90841debd..4d50704b722 100644 --- a/Master/texmf-dist/source/latex/koma-script/scrhack.dtx +++ b/Master/texmf-dist/source/latex/koma-script/scrhack.dtx @@ -1,8 +1,8 @@ -% \CheckSum{472} +% \CheckSum{489} % \iffalse meta-comment % ====================================================================== % scrhack.dtx -% Copyright (c) Markus Kohm, 2009 +% Copyright (c) Markus Kohm, 2008-2010 % % This file is part of the LaTeX2e KOMA-Script bundle. % @@ -23,7 +23,7 @@ % of TeX would generate the implementation documentation. % ---------------------------------------------------------------------- % scrhack.dtx -% Copyright (c) Markus Kohm, 2008-2009 +% Copyright (c) Markus Kohm, 2008-2010 % % Dieses Werk darf nach den Bedingungen der LaTeX Project Public Lizenz, % Version 1.3c, verteilt und/oder veraendert werden. @@ -72,7 +72,7 @@ \ProvidesFile{scrhack.dtx} %</dtx> %<*dtx|manual> - [2009/04/12 v3.03b KOMA-Script (hacking other packages)] + [2010/01/26 v3.04d KOMA-Script (hacking other packages)] %</dtx|manual> %<package&identify>\ProvidesPackage{scrhack} %<hyperref&identify>\ProvidesFile{hyperref.hak} @@ -146,32 +146,33 @@ individual packages. \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. +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}, while execution of -\Macro{begin}\PParameter{document}. With this redefinitions the anchor of not -numbered headings will be set always before the headings, too. +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 of the \Package{hyperref} hack loading package +You may switch off the \Package{hyperref} hack loading package \Package{scrhack} with option \OptionValue{hyperref}{false}. You may also -switch of the \Package{hyperref} hack using +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 -\Macro{begin}\PParameter{document}. +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} @@ -182,8 +183,8 @@ 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 +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 @@ -207,8 +208,8 @@ change the behaviour of float listings, that are already defined using \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 +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}. @@ -222,7 +223,7 @@ 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 +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. @@ -247,9 +248,9 @@ package \Package{listings}. \KOption{listings}{switch} \end{Declaration} % \fi -You may switch of the \Package{listings} hack loading package +You may switch off the \Package{listings} hack loading package \Package{scrhack} with option \OptionValue{listings}{false}. You may also -switch of the \Package{listings} hack using +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 @@ -265,17 +266,77 @@ loading package \Package{scrhack}, but before loading package % % \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}. +% 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 gesetzt werden. Anschließend sind sie wirkungslos. +% 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&option> +%<*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 +%</package&body> +% \fi % % \subsection{Der \textsf{hyperref}-Hack} % @@ -287,21 +348,41 @@ loading package \Package{scrhack}, but before loading package % % \begin{option}{hyperref} % \begin{macrocode} +%<*package&option> \KOMA@ifkey{hyperref}{@scrhack@hyperref}% \@scrhack@hyperreftrue -\AtBeginDocument{% - \KOMA@key[.scrhack.sty]{hyperref}{% - \PackageWarning{scrhack}{option `hyperref=#1' ignored}% +%</package&option> +%<*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}% + }% + \if@scrhack@hyperref\scr@hack@load\@pkgextension{hyperref}\fi + }% }% - \if@scrhack@hyperref\scr@hack@load\@pkgextension{hyperref}\fi } +%</package&body> % \end{macrocode} % \end{option} % -% \iffalse -%</package&option> -%<*hyperref&body> -% \fi % % \begin{macro}{\@schapter} % \begin{macro}{\@spart} @@ -315,6 +396,7 @@ loading package \Package{scrhack}, but before loading package % 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}% @@ -417,15 +499,12 @@ loading package \Package{scrhack}, but before loading package Maybe you are using a unsupported hyperref version}% }% } +%</hyperref&body> % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % -% \iffalse -%</hyperref&body> -%<*package&option> -% \fi % % \subsection{Der \textsf{float}-Hack} % @@ -440,21 +519,21 @@ loading package \Package{scrhack}, but before loading package % % \begin{option}{float} % \begin{macrocode} +%<*package&option> \KOMA@ifkey{float}{@scrhack@float}% \@scrhack@floattrue +%</package&option> +%<*package&body> \AfterPackage*{float}{% \KOMA@key[.scrhack.sty]{float}{% \PackageWarning{scrhack}{option `float' ignored}% }% \if@scrhack@float\scr@hack@load\@pkgextension{float}\fi } +%</package&body> % \end{macrocode} % \end{option} % -% \iffalse -%</package&option> -%<*float&body> -% \fi % % \begin{macro}{\newfloat} % Über die Anweisung \cs{newfloat} wird eine neue Gleitumgebung @@ -468,6 +547,7 @@ loading package \Package{scrhack}, but before loading package % 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 @@ -555,16 +635,12 @@ loading package \Package{scrhack}, but before loading package definition found!\MessageBreak Maybe you are using a unsupported float version}% } +%</float&body> % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % -% \iffalse -%</float&body> -%<*package&option> -% \fi -% % % \subsection{Der \textsf{listings}-Hack} % @@ -579,21 +655,21 @@ loading package \Package{scrhack}, but before loading package % % \begin{option}{listings} % \begin{macrocode} +%<*package&option> \KOMA@ifkey{listings}{@scrhack@listings}% \@scrhack@listingstrue +%</package&option> +%<*package&body> \AfterPackage*{listings}{% \KOMA@key[.scrhack.sty]{listings}{% \PackageWarning{scrhack}{option `listings' ignored}% }% \if@scrhack@listings\scr@hack@load\@pkgextension{listings}\fi } +%</package&body> % \end{macrocode} % \end{option} % -% \iffalse -%</package&option> -%<*listings&body> -% \fi % % \begin{macro}{\scr@do@hack@listings} % \begin{macro}{\lstlistoflistings} @@ -604,6 +680,7 @@ loading package \Package{scrhack}, but before loading package % 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}% @@ -667,73 +744,24 @@ loading package \Package{scrhack}, but before loading package Maybe you are using a unsupported listings version}% }% } +%</listings&body> % \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. +% 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} -% -% \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 % @@ -743,5 +771,5 @@ loading package \Package{scrhack}, but before loading package %%% Local Variables: %%% mode: doctex %%% coding: iso-latin-1 -%%% TeX-master: t +%%% TeX-master: %%% End: |