diff options
Diffstat (limited to 'Master/texmf-dist/source/latex/koma-script/scrhack.dtx')
-rw-r--r-- | Master/texmf-dist/source/latex/koma-script/scrhack.dtx | 279 |
1 files changed, 209 insertions, 70 deletions
diff --git a/Master/texmf-dist/source/latex/koma-script/scrhack.dtx b/Master/texmf-dist/source/latex/koma-script/scrhack.dtx index b5403731117..19b1d458734 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{827} +% \CheckSum{881} % \iffalse meta-comment % ====================================================================== % scrhack.dtx -% Copyright (c) Markus Kohm, 2008-2016 +% Copyright (c) Markus Kohm, 2008-2017 % % 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-2016 +% Copyright (c) Markus Kohm, 2008-2017 % % Dieses Werk darf nach den Bedingungen der LaTeX Project Public Lizenz, % Version 1.3c, verteilt und/oder veraendert werden. @@ -62,7 +62,7 @@ % Right brace \} Tilde \~} % % \iffalse -%%% From File: $Id: scrhack.dtx 2451 2016-05-07 18:11:55Z kohm $ +%%% From File: $Id: scrhack.dtx 2615 2017-03-31 10:00:24Z kohm $ %<package&identify>%%% using: package,identify %<package&option>%%% using: package,option %<package&body>%%% using: package,body @@ -79,6 +79,7 @@ %<listings&identify>\ProvidesFile{listings.hak}[% %<setspace&identify>\ProvidesFile{setspace.hak}[% %<lscape&identify>\ProvidesFile{lscape.hak}[% +%<nomencl&identify>\ProvidesFile{nomencl.hak}[% %<*driver|manual|identify> %!KOMAScriptVersion package @@ -93,6 +94,7 @@ %<listings&identify> listings)% %<setspace&identify> setspace)% %<lscape&identify> lscape)% +%<nomencl&identify> nomencl)% %<*driver|manual|identify> ] %</driver|manual|identify> @@ -141,6 +143,11 @@ \from{scrhack.dtx}{hack,lscape,identify}% \from{scrhack.dtx}{hack,lscape,body}% }% + \file{nomencl.hak}{% + \from{scrkernel-version.dtx}{file,nomencl.hak}% + \from{scrhack.dtx}{hack,nomencl,identify}% + \from{scrhack.dtx}{hack,nomencl,body}% + }% } \@@input scrstrop.inc \else @@ -149,7 +156,7 @@ \endbatchfile %</dtx> %<*driver> -\documentclass[halfparskip-]{scrdoc} +\documentclass[parskip=half-]{scrdoc} \usepackage[latin1]{inputenc} \usepackage[english,ngerman]{babel} \usepackage[T1]{fontenc} @@ -209,37 +216,6 @@ individual packages. %</dtx> %\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} @@ -312,6 +288,37 @@ switch off the \Package{floatrow} hack using loading package \Package{scrhack}, but before loading package \Package{floatrow}. +\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{listings} hack} \label{sec:scrhack.listings} @@ -354,35 +361,6 @@ switch off the \Package{listings} hack using loading package \Package{scrhack}, but before loading package \Package{listings}. -\section{The \Package{setspace} hack} -\label{sec:scrhack.setspace} - -Package \Package{setspace} defines macros \Macro{onehalfspacing} and -\Macro{doublespacing} using \Macro{@ptsize} as an argument of -\Macro{ifcase}. But if \Macro{@ptsize} is not an integer but a real number, -this failes, because the digits from the decimal points are interpreted as -text of that case. Several solutions for this are thinkable. I've decides to -redefine \Macro{onehalfspacing} and \Macro{doublespacing}. The new definition -is more general and somehow more exact. - -% \iffalse -\begin{Declaration} - \KOption{setspace}{switch} -\end{Declaration} -% \fi -You can switch of the \Package{setspace} hack loading package -\Package{scrhack} with option \OptionValue{setspace}{false}. You may also -switch of the \Package{setspace} hack using -\Macro{KOMAoptions}\PParameter{setspace=false} or -\Macro{KOMAoption}\PParameter{setspace}\PParameter{false} somewhere after -loading package \Package{scrhack}, but before loading package -\Package{setspace}. - -Note: If you want to use \Package{setspace} with package option -\Option{onehalfspacing} or \Option{doublespacing} you have to load -\Package{scrhack} before \Package{setspace}. - - \section{The \Package{lscape} hack} \label{sec:scrhack.lscape} @@ -415,19 +393,74 @@ loading \Package{lscape} or if \Package{scrhack} is loaded after change of the option using \Macro{KOMAoption} or \Macro{KOMAoptions} will have the expected effect. +\section{The \Package{nomencl} hack} +\label{sec:scrhack.nomencl} + +Package \Package{nomencl} provides an option \Option{intoc} to add an +nomenclature entry into the table of contents. This option uses +\Macro{addcontentsline} to add the entry. Unfortunately this means that +\KOMAScript{} option \OptionValue{toc}{indentunnumbered} would be +ignored. A minimal solution would be to patch \Macro{thenomenclature} to use +\Macro{addxcontentsline} instead of \Macro{addcontentsline}. With this the +\Package{tocbasic} features for the entry will already be available. + +But if we already patch the package why not also register the extensions and +add running heads and make other \Package{tocbasic} features available. + +% \iffalse +\begin{Declaration} + \KOption{nomencl}{switch} +\end{Declaration} +% \fi +You may switch off the \Package{nomencl} hack loading package +\Package{scrhack} with option \OptionValue{nomencl}{false}. You may also +switch off the \Package{nomencl} hack using +\Macro{KOMAoptions}\PParameter{nomencl=false} or +\Macro{KOMAoption}\PParameter{nomenc}\PParameter{false} somewhere after loading +package \Package{scrhack}, but before loading package \Package{listings}. + + +\section{The \Package{setspace} hack} +\label{sec:scrhack.setspace} + +Package \Package{setspace} defines macros \Macro{onehalfspacing} and +\Macro{doublespacing} using \Macro{@ptsize} as an argument of +\Macro{ifcase}. But if \Macro{@ptsize} is not an integer but a real number, +this failes, because the digits from the decimal points are interpreted as +text of that case. Several solutions for this are thinkable. I've decides to +redefine \Macro{onehalfspacing} and \Macro{doublespacing}. The new definition +is more general and somehow more exact. + +% \iffalse +\begin{Declaration} + \KOption{setspace}{switch} +\end{Declaration} +% \fi +You can switch of the \Package{setspace} hack loading package +\Package{scrhack} with option \OptionValue{setspace}{false}. You may also +switch of the \Package{setspace} hack using +\Macro{KOMAoptions}\PParameter{setspace=false} or +\Macro{KOMAoption}\PParameter{setspace}\PParameter{false} somewhere after +loading package \Package{scrhack}, but before loading package +\Package{setspace}. + +Note: If you want to use \Package{setspace} with package option +\Option{onehalfspacing} or \Option{doublespacing} you have to load +\Package{scrhack} before \Package{setspace}. + % \iffalse %</manual|dtx> % \fi % % \selectlanguage{ngerman} % \StopEventually{\PrintIndex\PrintChanges} -% \changes{v3.03}{2009/03/12}{erste Version des Pakets} +% \changes{v3.03}{2009/03/12}{erste Version des Pakets}^^A % % \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.} +% Reihenfolge beim Laden von Paketen zu machen.}^^A % % \subsection{Optionen} % @@ -524,7 +557,7 @@ the expected effect. %</package&option> %<*package&body> % \end{macrocode} -% \changes{v3.04b}{2009/11/09}{\textsf{hyperref}-Hack wird früher geladen} +% \changes{v3.04b}{2009/11/09}{\textsf{hyperref}-Hack wird früher geladen}^^A % \changes{v3.17}{2015/03/09}{Neuere \textsf{hyperref}-Version deaktiviert % ggf. Option \texttt{hyperref}}^^A % \changes{v3.18}{2015/05/22}{Neuere \KOMAScript-Versionen deaktivieren @@ -1084,6 +1117,112 @@ the expected effect. % \end{macro} % \end{macro} % +% +% +% \subsection{Der \textsf{nomencl}-Hack} +% +% Das \textsf{nomencl}-Paket harmoniert eigentlich nur in einer Kleinigkeit +% bezüglich des Eintrags in das Inhaltsverzeichnis nicht sehr gut mit +% \KOMAScript-Klassen bzw. Paket \textsf{tocbasic}. Allerdings kann es von den +% Vorteilen von \textsf{tocbasic} auch in weiterer Hinsicht profitieren. +% +% Dieser Hack rüstet weitgehende \textsf{tocbasic}-Unterstützung für +% \textsf{nomencl} nach. Dafür wird Paket \textsf{xpatch} verwendet. +% +% \begin{option}{nomencl} +% \changes{v3.23}{2017/03/31}{neue Option für neuen Hack}^^A +% \begin{macrocode} +%<*package&option> +\RequirePackage{xpatch}% +\KOMA@ifkey{nomencl}{@scrhack@nomencl} +\KOMAExecuteOptions{nomencl=true} +%</package&option> +%<*package&body> +\AfterPackage*{nomencl}{% + \KOMA@key[.scrhack.sty]{nomencl}{% + \PackageWarning{scrhack}{option `nomencl' ignored}% + \FamilyKeyStateProcessed + }% + \if@scrhack@nomencl\scr@hack@load\@pkgextension{nomencl}\fi +} +%</package&body> +% \end{macrocode} +% \end{option}^^A nomencl +% +% \begin{macro}{\thenomenclature} +% \changes{v3.23}{2017/03/31}{Umgebung \texttt{thenomenclature} wird +% gepatcht}^^A +% Statt die Fallunterscheidung aus der Originaldefinition direkt hier +% nachzubilden, patchen wir diese komplett heraus und ersetzen sie durch eine +% neue Anweisung. +% \begin{macrocode} +%<*nomencl&body> +\RequirePackage{tocbasic} +\addtotoclist[nomencl]{nlo} +\addtotoclist[nomencl]{nls} +\xpatchcmd{\thenomenclature}{% + \@ifundefined{chapter}% + { + \section*{\nomname} + \if@intoc\addcontentsline{toc}{section}{\nomname}\fi% + }% + { + \chapter*{\nomname} + \if@intoc\addcontentsline{toc}{chapter}{\nomname}\fi% + }% +}{% + \scr@hack@nomencl@head +}{% + \PackageInfo{scrhack}{\string\thenomenclature\space successfully patched}% +}{% + \PackageWarning{scrhack}{cannot patch \string\thenomenclature.\MessageBreak + This could happen if you are using an unknown\MessageBreak + release of package `nomencl'% + }% +} +%</nomencl&body> +% \end{macrocode} +% \end{macro}^^A \thenomenclature +% +% \begin{macro}{\scr@hack@nomencl@head} +% \changes{v3.23}{2017/03/31}{Überschrift für \texttt{thenomenclature} unter +% Verwendung von \textsf{tocbasic}}^^A +% Im Gegensatz zu Gleitumgebungen benötigen wir hier keine Gruppe, weil +% \texttt{thenomenclature} bereits die Gruppe bereitstellt. +% \begin{macrocode} +%<*nomencl&body> +\newcommand*{\scr@hack@nomencl@head}{% + \providecommand*{\listofnlsname}{\nomname}% + \let\list@fname\listofnlsname + \def\@currext{nls}% + \tocbasic@listhead{\list@fname}% +} +%</nomencl&body> +% \end{macrocode} +% Es ist ggf. noch zu beachten, dass von den ganzen Haken, die +% \textsf{tocbasic} bereitstellt, für dieses Verzeichnis natürlich nur die +% Überschriftenhaken zum Einsatz kommen. Verzeichnishaken können zwar +% definiert werden, kommen aber nie zur Anwendung. +% \end{macro}^^A \scr@hack@nomencl@head +% +% \begin{macro}{\if@intoc} +% \changes{3.23}{2017/03/31}{Reaktion auf \cs{if@intoc}} +% Natürlich muss jetzt noch auf \textsf{nomencl}'s Option \texttt{intoc} +% reagiert werden, also entsprechend der Option das \textsf{tocbasic} +% Feature \texttt{totoc} passend gesetzt werden. Etwaige Änderungen des +% Features sind also erst nach dem Laden von \textsf{nomencl} und +% \textsf{scrhack} möglich. Spätere Änderungen von \cs{if@intoc} werden +% außerdem nicht berücksichtigt. +% \begin{macrocode} +%<*nomencl&body> +\if@intoc + \setuptoc{nls}{totoc} +\fi +%</nomencl&body> +% \end{macrocode} +% \end{macro} +% +% % \subsection{Der \textsf{setspace}-Hack} % % Das \textsf{setspace}-Paket verwendet \cs{@ptsize} auf ungünstige Art, indem @@ -1208,7 +1347,7 @@ the expected effect. % % % \subsection{Der \textsf{lscape}-Hack} -% \changes{v3.18a}{2015/07/07}{Neuer \textsf{lscape}-Hack} +% \changes{v3.18a}{2015/07/07}{Neuer \textsf{lscape}-Hack}^^A % % Das \textsf{lscape}-Paket setzt innerhalb der % \texttt{landscape}-Umgebung die Länge \cs{textheight} auf den Wert @@ -1281,7 +1420,7 @@ the expected effect. } % \end{macrocode} % \begin{Length}{\scrh@LT@textheight} -% \changes{v3.18a}{2015/08/11}{neue Länge (intern)} +% \changes{v3.18a}{2015/08/11}{neue Länge (intern)}^^A % \begin{macrocode} \newlength{\scrh@LT@textheight} %</lscape&body> |