% ======================================================================
% scrhack.tex
% Copyright (c) Markus Kohm, 2001-2015
%
% 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.
% ----------------------------------------------------------------------
% scrhack.tex
% Copyright (c) Markus Kohm, 2001-2015
%
% 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.
% ======================================================================
%
% Chapter about scrhack of the KOMA-Script guide
% Maintained by Markus Kohm
%
% ----------------------------------------------------------------------------
%
% Kapitel ueber scrhack in der KOMA-Script-Anleitung
% Verwaltet von Markus Kohm
%
% ============================================================================

\KOMAProvidesFile{scrhack.tex}
                 [$Date: 2015-04-16 10:41:14 +0200 (Thu, 16 Apr 2015) $
                  KOMA-Script guide (chapter: scrhack)]
\translator{Markus Kohm}

% Date of the translated German file: 2015-04-16
\chapter{Hacks for Third-Party Packages by Package \Package{scrhack}}
\labelbase{scrhack}

\BeginIndex{Package}{scrhack}
Some packages from other authors could 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 can prevent \Package{scrhack} from redefining macros of
individual packages.

\section{State of Development Note}
\label{scr:scrhack.draft}

Though this package is part of \KOMAScript{} for long time and though it has
been used by lot of users, there's one problem with it. While redefinition of
macros of foreign packages, it depend on the exact definition an usage of
those macros. This means additionally, that it depends on dedicated releases
of those packages. If a unknown release of such a package will be used,
\Package{scrhack} eventually could not do the needed patch. Contrary, in
extreme cases the patch can cause errors and fault.

So \Package{scrhack} has to be continuously modified to fit new releases of
foreign packages and will never be finished. Because of this \Package{scrhack}
will stay in beta state forever. Though the usage will generally be a
benefit, the correct function could not be guaranteed forever.

\LoadCommon{0}

\section{Usage of \Package{tocbasic}}
\seclabel{improvement}

In the early days of \KOMAScript{} users asked for handling lists of floats,
that will be generated using package
\Package{float}\IndexPackage{float}\important{\Package{float}}, like list of
figures and list of tables, that are generated by \KOMAScript{} itself. At
that time the \KOMAScript{} author contacted the author of \Package{float}, to
submit a proposal of an interface with support for such an extention. A
somehow modified version of that interface has been implemented with commands
\Macro{float@listhead}\IndexCmd[indexmain]{float@listhead} and
\Macro{float@addtolists}\IndexCmd[indexmain]{float@addtolists}.

Sometimes later it has appeared, that those two commands were not flexible
enough to support all of the comprehensive features supported by
\KOMAScript. Unfortunately the author of \Package{float} has finalized the
development already, so nobody should expect furthor changes of this package.

Other package authors have also inherited these commands. Thereby it appeared,
that the implementation in some packages, even in package \Package{float},
will need a certain package loading order, though all these packages are not
related to each other. Wrong loading order could result in an error or break the
functionality of the commands.

To clear all this disadvantages and problems, \KOMAScript{} officially does not
support this old interface any more. Instead \KOMAScript{} warns, if the old
interface is used. At the same time package
\Package{tocbasic}\IndexPackage{tocbasic}\important{\Package{tocbasic}} (see
\autoref{cha:tocbasic}) has been designed and implemented as a central
interface for management of table of contents, lists of floats and similar
lists. Usage of this package provides much more advantages and features than
the two old commands, that has been alluded above.

Though the effort using that package is very small, the authors of most of the
packages, that are using the old interface, have not done so currently. Because
of this \Package{scrhack} contains appropriate modifications of packages
\Package{float}\IndexPackage{float}\important{\Package{float},
  \Package{floatrow}, \Package{listings}},
\Package{floatrow}\IndexPackage{floatrow}, and
\Package{listings}\IndexPackage{listings}. Loading \Package{scrhack} is enough
to make these packages recognize not only setting of \KOMAScript{} option
\Option{listof}\IndexOption{listof~=\PName{setting}}, but also language
switching of package \Package{babel}\IndexPackage{babel}. More information
about the features provided by the changeover to package \Package{tocbasic}
can be found in \autoref{sec:tocbasic.toc}.

If the modification for any of the packages is not wanted or causes problems,
then is can be deactivated selectively with option
\OptionValue{float}{false}\IndexOption[indexmain]{float~=\PValue{false}},
\OptionValue{floatrow}{false}\IndexOption[indexmain]{floatrow~=\PValue{false}},
or
\OptionValue{listings}{false}\IndexOption[indexmain]{listings~=\PValue{false}}.
Please note\textnote{Attention!} that changing these options after loading the
corresponding package would not do it!


\section{Incorrect Expectations to \Macro{@ptsize}}
\seclabel{ptsize}

Some packages always expect that the class-internal macro
\Macro{@ptsize}\IndexCmd{@ptsize} is not only defined but also expands to an
integer. For compatibility, \KOMAScript{} defines \Macro{@ptsize} even if the
basic font size is neither 10\Unit{pt} nor 11\Unit{pt} nor
12\Unit{pt}. \KOMAScript{} also provides non-integer font sizes. So
\Macro{@ptsize} can expand to an non-integer number, too.

Package \Package{setspace}\IndexPackage[indexmain]{setspace} is one of the
packages that fail with non-integer number expansion of
\Macro{@ptsize}. Additionally the line stretching of that package always
depends on the basic font size even if setting is made in the context of
another font size. Package \Package{scrhack} solves both problems by
redefining \Macro{onehalfspacing} and \Macro{doublespacing} using always the
current font size while setting the stretch.

If the modification for the package is not wanted or causes problems,
then is can be deactivated selectively with option
\OptionValue{setspace}{false}\IndexOption[indexmain]{setspace~=\PValue{false}}.
Please note\textnote{Attention!} that changing these option after loading
\Package{setspace} would not do it! If you use \Package{setspace} with
either option \Option{onehalfspacing} or \Option{doublespacing} you have to
load \Package{scrhack} before it.


\section{Special Case \Package{hyperref}}
\seclabel{hyperref}

Before version~6.79h package \Package{hyperref} set the link anchors after
instead of before the heading of star version commands like \Macro{part*},
\Macro{chapter*}, and so on. In the meantime this problem have been solved at
the \KOMAScript{} author's suggestion. But because the \KOMAScript{} author
was not patient enough to wait more than a year for the change of
\Package{hyperref}, a corresponding patch has been added to
\Package{scrhack}. This can be deactivated by
\OptionValue{hyperref}{false}. Nevertheless, it is recommended to use the
current \Package{hyperref} release. In this case \Package{scrhack} does
automatically deactivate the not longer needed patch.%
%
\EndIndex{Package}{scrhack}

\endinput

%%% Local Variables: 
%%% mode: latex
%%% mode: flyspell
%%% ispell-local-dictionary: "english"
%%% coding: us-ascii
%%% TeX-master: "../guide"
%%% End: 
