mhelvens / latex-pkgloader

a LaTeX package for managing the options and loading order of other packages
LaTeX Project Public License v1.3c
33 stars 3 forks source link

Ordering rules for `cleveref` and various other packages #2

Closed liblit closed 9 years ago

liblit commented 9 years ago

The preference to load amsmath and caption before cleveref comes from inspecting cleveref.sty by hand, specifically looking for uses of \@ifpackageloaded. From this it is clear that cleveref has special support for both amsmath and caption, activated only if those other packages are already loaded. I claim that the implementation is more truthful than the documentation here.

I like your suggested reorganization of the many similar rules. I will make that change, which should then propagate into this existing pull request. I'll add the clarifying attribution for the existing rules too, per your request.

liblit commented 9 years ago

Actually, one clarification regarding caption: the special cleveref handling is only triggered if caption is from before August 19, 2011. Presumably caption released after that date no longer needs any special handling. So do you think we should keep this ordering constraint or drop it?

mhelvens commented 9 years ago

The preference to load amsmath and caption before cleveref comes from inspecting cleveref.sty by hand, specifically looking for uses of \@ifpackageloaded.

Is it possible that cleveref is cleaning up after itself here, i.e., that the special handling is not needed if amsmath/caption are loaded later? Not having looked at the relevant cleveref code, I can't be sure. But I can imagine a scenario where two packages each have special handling for each other. Adding both rules would then lead to a dependency cycle.

That said, if you are reasonably confident about these, please keep them in.

Actually, one clarification regarding caption: the special cleveref handling is only triggered if caption is from before August 19, 2011. Presumably caption released after that date no longer needs any special handling. So do you think we should keep this ordering constraint or drop it?

I'm thinking about a feature where a rule can be conditional on package date/version/options. But that's not implemented yet.

mhelvens commented 9 years ago

Thanks again! I've merged your changes, and I'll release a new version to CTAN soon(ish).

liblit commented 9 years ago

I definitely see what you're saying about whether cleveref is cleaning up after itself or really does need to be loaded later. It's hard to tell; my TeX-reading skills are not up to the task. I can say that when cleveref does its special work for some other package, it almost always prints in informational message '_otherpackage_' support loaded. The one exception is amsmath, for which cleveref triggers special handling silently. I don't know how much we should read into that, though; it might just be that the support loaded message was accidentally forgotten in the amsmath-handling code.

I'll definitely want to send you another pull request (since you already merged this one) that removes the caption ordering rule, per your comment above. Should I also remove the amsmath rule?

mhelvens commented 9 years ago

In fact, it seems to me that both rules are probably fine (for now), since the cleveref author is obviously aware of those other packages. So loading them first is at the very least 'not wrong'.

The recommended ruleset doesn't have a cycle in it yet, so let's keep it the way it is for the moment. In the future, we'll want to come up with some proper guidelines about which rules should be included.

liblit commented 9 years ago

OK, sounds good to me. We're done here!