This question should really ask what is the best way to implement a version-specific package dependency. However, if I try to ask that, the system threatens to close my question.
In this answer, Martin Scharrer explains how to load a package conditional on its version by redefining \ProvidesPackage. However, that question is quite old so, since the solution is not exactly ideal, I hope it is worth asking whether there is any better option available at this time.
I would ideally like my package to do this:
- Test whether
otherpackageis older than version X. - If
otherpackageis older than version X, issue an error rather than continuing. - If
otherpackageis newer than version X, issue a warning and continue. - If
otherpackageis at version X, continue.
Obviously, the issuing of errors and warnings and stopping and so on is unproblematic. The problem is doing those things conditionally depending on the version of otherpackage.
A Minimal Working Non-Example would be
\ProvidesPackage{mypackage}[v0.1]
\RequirePackage{otherpackage}[2015/11/01]
\endinput
which obviously does no testing at all except that it will issue a warning if otherpackage is at version prior to 2015/11/01. That is, it will still continue in this case, and it will say nothing whatsoever if otherpackage is at a version later than 2015/11/01.
\ProvidesPackagein the answer I linked? – cfr Nov 08 '15 at 02:13