3

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?

Wishes, Mike

  • 2
    it seems, that KOMA bundle like to tell you that use of [H] is desperate action of the last resort ... never ever use it! If [!ht] doesn't positioning figure/table in desired place, means, that there is not enough room for it and that use of [H] will give ugly result ... (with no image on desired place) . – Zarko Mar 18 '17 at 11:19
  • 3
    The easiest solution is not to use float. If you want a non-floating table just use \begin{center}\captionof{table}{bla bla} ... \end{center}. No need for the H option… – cgnieder Mar 18 '17 at 11:19
  • 1
    Do what Clemens said, it is the most convenient solution. – Johannes_B Mar 18 '17 at 12:08
  • I have a different opinion (just an opinion -- please don't fight about it). I use the proposed solution (see below) for many years now and I am very happy with it. I do not always use the KOMA classes and when I copy and paste code from different documents then I find it convenient not to have to distinguish between KOMA classes and other classes. – Dr. Manuel Kuehner Mar 18 '17 at 14:22
  • 1
    @Dr.ManuelKuehner no need to use H in any class: the easiest definition of \captionof is \providecommand\captionof[1]{\def\@captype{#1}\caption} and {center} is always available. KOMA-Script's definition (and the one from the caption package) are more flexible but that's what \providecommand is for, anyway) – cgnieder Mar 18 '17 at 14:27
8

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
  2. float
  3. floatrow (never heard of it)
  4. listings
  5. setspace
  6. lscape

Links to the Documentation

| improve this answer | |
  • 2
    The hyperref hack is for very old hyperref versions only. If you are using a current hyperref release, this hack is disabled automatically. – Schweinebacke Mar 20 '17 at 18:56
  • @Schweinebacke Thanks for the additional information. – Dr. Manuel Kuehner Mar 20 '17 at 21:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.