TransWikia.com

Hyperref is loaded by the class, and I need to load packages that are supposed to be loaded before

TeX - LaTeX Asked by Alejandro DC on March 29, 2021

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

usepackage{float}
floatstyle{boxed}
restylefloat{figure}

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?

4 Answers

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.

Correct answer by Sveinung on March 29, 2021

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.

Answered by Stephan Lehmke on March 29, 2021

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:

IfFileExists{jobname-packages-loaded-before-hyperref.sty}{%
  RequirePackage{jobname-packages-loaded-before-hyperref}
}{}

% For all sorts of hyperlinks in the PDF output.
RequirePackage[pdfcreator={pdfLaTeX with hyperref},
  plainpages=false,
  pdfpagelabels,
  hypertexnames=true,
  colorlinks=false]{hyperref}

IfFileExists{jobname-packages-loaded-after-hyperref.sty}{%
  RequirePackage{jobname-packages-loaded-after-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.

Answered by Mike Renfro on March 29, 2021

In my case, I added:

RequirePackage{fooPackage}
PassOptionsToPackage{bookmarks=false}{hyperref}

BEFORE documentclass, which fixed the issue I was having without modifying the class.

Answered by Zach Boyd on March 29, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP