[Tex/LaTex] Using “float” package for option “H” but KOMA doesn’t like it


I used the float package for the possibility "H" in figure and table environments to have those things exactly there in the text where I want it to have and not what LaTeX thinks it will be better…:-)

Now, I want to use the report class from KOMA script but there I have this problem/message you can read there: KOMA warning about ToC

Class scrreprt Warning: \float@addtolists detected!
(scrreprt)              Implementation of \float@addtolist became
(scrreprt)              deprecated in KOMA-Script v3.01 2008/11/14 and
(scrreprt)              has been replaced by several more flexible
(scrreprt)              features of package `tocbasic`.
(scrreprt)              Since Version 3.12 support for deprecated
(scrreprt)              \float@addtolist interface has been
(scrreprt)              restricted to only some of the KOMA-Script
(scrreprt)              features and been removed from others.
(scrreprt)              Loading of package `scrhack' may help to
(scrreprt)              avoid this warning, if you are using a
(scrreprt)              a package that still implements the
(scrreprt)              deprecated \float@addtolist interface .

How can I use this "H"-option with listings and normal pictures/tables in KOMA?


Best Answer

You can load the scrhack package (from the KOMA author) - which makes the float package compatible with the KOMA classes. This is already mentioned in the warning message that you show in your question (saw this after writing the answer).

From The Documentation

Some packages from other authors may have problems with KOMA-Script. In my opinion some packages could be improved. [...] This means, scrhack redefines macros of packages from other authors!

Packages that are hacked in scrhack

  1. hyperref (, old versions of, see Readme below)
  2. float
  3. floatrow (never heard of it)
  4. listings
  5. setspace
  6. lscape

From the Readme (2021/06/25 v3.34)

scrhack - patch some isues with other packages
Maintainer:     Markus Kohm
E-Mail:         komascript at gmx info
Abstract:       scrhack is a LaTeX package of the KOMA-Script bundle. It
                patches other packages to make them work better and adds new
                features to improve their interaction with KOMA-Script. One
                main feature is to make them work with tocbasic instead of
                KOMA-Script's deprecated float list interface. Currently,
                patches for float.sty, floatrow.sty, (old versions of)
                hyperref, listings, and setspace are available.
Requires:       scrkbase - internal KOMA-Script package with basics
                tocbasic - features for helper files and float environments
                xpatch - extending etoolbox patching commands
License:        LPPL 1.3c or later
State:          Author maintained
Version:        2021/06/25 v3.34