1

There is extensive documentation that hyperref must be loaded towards the end. In particular, the following is the correct loading order for these specific packages:

\usepackage{float}
\usepackage{hyperref}
\usepackage{algorithm}

Now, I have a slight complication. I am using the minted package with the option newfloat=true, i.e. using the newfloat package.

Does the loading order recommendation remain the same?, i.e.

\usepackage[newfloat=true]{minted}  % <-- Replacement for the float package?
\usepackage{hyperref}
\usepackage{algorithm}

or should I also additionally load the float package? (This doesn't sound right to me.)

1

The load order advice is a bit confusing in this regard. It is, however, sufficient to load float, before newfloat is loaded, since newfloat is compatible with it.

While no longer mentioned in the current newfloat manual, an older version discussed newfloat's implementation details. Section 5.10.1 outlines the compatibility of newfloat with float, stating in part:

If the float package is used we fill up \float@exts with our file extensions, too. Since this list will be used for inserting chapters gaps we only add the ones which are configured for chapters gaps on.

newfloat may not replace float from the perspective of the algorithm package, so it is likely best to load it as well.

Therefore, you can simply do the following:

\usepackage{float}
\usepackage[newfloat=true]{minted}
\usepackage{hyperref}
\usepackage{algorithm}
  • 1
    I wonder why the package author removed this compatibility clause in the newer version of the manual. Worst case (shudder) this is not true anymore. I guess it is out of the scope of this answer anyway. Maybe other experts (I think newfloat author is a strong contributor here) may take notice and answer this in the future. Thank you for your sustained efforts in providing a helpful and concise answer. – Krishna Jun 8 '18 at 21:05
  • 1
    @Krishna I was wondering that as well. But I think all of that is still current. It appears merely that all implementation details were removed from the current manual. All of section 5, dedicated to discussing support of other packages, is no longer present. My pleasure—glad that I was able to help! – Coby Viner Jun 8 '18 at 21:07
  • 1
    Since most users are not interested in the implementation, I process the file newfloat.dtx with \OnlyDescription to get newfloat.pdf which is uploaded to CTAN. But everyone is free to process newfloat.dtx without it to get the documentation including the implementation part. So nothing has been removed in the manual (at least not in the source code of it), and the compatibility clause is still true. BTW: The process of "the author may take notice" could be speed-up by inserting @AxelSommerfeldt in the answer/comment, or by sending me an e-mail ;-) My e-mail address could be find in the README. – Axel Sommerfeldt Sep 2 at 5:30

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.