I am using the lipics document class, which includes hyperref. I want to load the float package, which should be loaded before hyperref, without changing the document class. As suggested in this comment, I am trying to use the KOMA-Script called scrlfile (cf. page 199 of the documentation), in the following way


however it never loads the package.

What I am doing wrong?

  • 2
    Try \RequirePackage{scrfile}\BeforePackage{hyperref}{\usepackage{float}}\documentclass{lipics} ` Apr 7, 2012 at 16:49
  • There is something really odd. It rise an warning You have requested package `hyperref', but the package provides `float'. and the error Command \c@float@type already defined. However, if I do not put anything and try to use some commands from the package float (for example \floatstyle{boxed} \restylefloat{figure}) I get the undefined commands error. I am a bit lost. Apr 7, 2012 at 20:47

1 Answer 1


The problem here is that you need to call \BeforePackage{} and related commands before the package is actually loaded so that the hooks can work. This is what Marco's suggestion tries to do.

Unfortunately, you cannot load an additional package using \BeforePackage{} because, when lipics finally requests hyperref, loading float will call the \ProvidesPackage{float} declaration and LaTeX thinks that the wrong package is being provided.

I have found that it is best to use \AfterPackage or \AfterClass. Why not just load the float package right after the article documentclass that lipics uses?



If you really want to make \BeforePackage{} work, you can use the following hack

  \let\oldProvidesPackage\ProvidesPackage   % Save original definition
  \def\ProvidesPackage#1[#2]{               % Redefine (simply)        
    \oldProvidesPackage#1[#2]               % Call original \ProvidesPackage
    \let\ProvidesPackage\oldProvidesPackage % restore original definitions

    \RequirePackage{float}                  % Now load float

This temporarily redefines \ProvidesPackage to first call the original version (which will tell LaTeX that hyperref is being provided as expected), then to load float after restoring the old definitions.

  • The first solution, load float after article, worked! Thanks! Apr 8, 2012 at 15:04

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.