Closed FrankMittelbach closed 1 year ago
Hi Karl, this is causing more and more issues and questions out there, because other packages load either amsmath or lineno internally and are now producing suprising ordering issues. If you would change to using hooks all this would go away. For compatibility with old installations you could simply check if hook commands are already defined and if not don't do any updates ie auto-support amsmath only with installations that are 2020 or later. If you need assistance setting it up we can probably help but hooks are actually quite simple to use.
Related: "conflict between lineno and amsmath packages in TeXLive 2022? Some environments (like \gather) are already defined", title of post https://tug.org/pipermail/texhax/2023-January/025962.html.
In that thread on texhax I suggest (see https://tug.org/pipermail/texhax/2023-January/025967.html)
How about asking TeXLive to revert lineno to the previous version (which it seems does not have this conflict with amsmath). Perhaps overall this would make the best of what there is.
Fixed in version 5.1, which should appear on CTAN soon.
lineno
now patches amsmath
with \AddToHook
, so that the packages can be loaded in any order.\AddToHook
is unavailable), lineno
will only try to patch amsmath
if it is already loaded, otherwise it will print a warning. This will still allow the packages to be loaded in any order, except that amsmath
will not be patched if it is loaded after lineno
, and hence line numbers won't work correctly in amsmath
math environments.
With the new version lineno supports the amsmath environments (thanks for that!) but unfortunately it introduces an order dependency.
It might be better (and in fact much simpler) to make use LaTeX's hook system and make the alterations automatically after amsmath got loaded, via
In this case the changes happen only after the environments got defined in amsmath and not at all if amsmath is not loaded ever.