TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am using the lipics documentclass, which loads hyperref. Since I want my figures boxed, I added the following


The problem: I receive warnings of the kind

name{figure.1} has been referenced but does not exist,replaced by a fixed one

which use to happen when I load the float package after hyperref.

The question: is there any correct way to do this without redefining the class?

share|improve this question
Have a look at this question: which-packages-should-be-loaded-after-hyperref-instead-of-before. As @BrentLongborough once put it brilliantly, the best place for loading hyperref package is after \end{document} :D – percusse Apr 5 '12 at 12:41
Thanks for all the answers. So, as I understood, the answer to my question is "No", since I must modify the class in order to avoid such a warning. – Alejandro DC Apr 5 '12 at 16:30
up vote 3 down vote accepted

In the KOMA-Script-bundle, Markus Kohm’s replacement for the standard LaTeX-classes and much more, he includes a package called scrlfile, that is designed to execute actions both before and after the loading of files. May be that package can solve your problems. It can be used on a stand alone basis.

If you do not read German, the author has started the work on improving the English manual. He describes scrlfile on pages 248ff. You will find KOMA-Script at CTAN and BerliOS.

Links to the new, improved, English manual you will find here.

share|improve this answer
Love this solution! But for some reason I cannot make it work. I uploaded the package scrlfile and put the following commands \BeforePackage{hyperref}{\usepackage{float} \floatstyle{boxed} \restylefloat{figure}} But they are never executed (the figures are not boxed). Any insight? – Alejandro DC Apr 6 '12 at 20:23
@AlejandroDíaz-Caro No, I have never used the program. I suggest you ask the author, Markus Kohm, at komascript.de. Even if the site is in German, you can ask questions and get replies in English. – Sveinung Apr 7 '12 at 7:27
@AlejandroDíaz-Caro: Your comment is actually a new question, so I suggest you copy it to a new question to tex.stackexchange.com – Sveinung Apr 7 '12 at 14:08
Thanks. I just raised a new question about this issue. – Alejandro DC Apr 7 '12 at 16:45
Instead of using \BeforePackage{hyperref} to load float, just load it \AfterClass{article}}. This is not the "right" way, but works. (I don't yet understand how to fix \BeforePackage as that seems like the "right" way that does not work:-) See my answer. – mforbes Apr 7 '12 at 22:32

Short version: yes, you'll have to redefine the class, or at least patch their hyperref inclusion.

I ran into a similar problem with my hyperref-using thesis class (which was originally a package). When it was a package, I could have students load packages before or after my thesis package, and hyperref would then be in the right order. Once I made a class, though, all my packages would be loaded first in the \documentclass line, which made it impossible for anyone to work around hyperref. Rather than abandon hyperref entirely, I added the following to the class:


% For all sorts of hyperlinks in the PDF output.
\RequirePackage[pdfcreator={pdfLaTeX with hyperref},


and now my students just have to put all their extra \usepackage or \RequirePackage entries in one of two .sty files. Examples: before package, after package, and class.

share|improve this answer

It is well-known (and should be to class authors) that hyperref needs to be loaded as late as possible. Hence, the class should really be changed not to load hyperref.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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