2

Packages can specify that they need a specific version of LaTeX using \NeedsTeXFormat, which takes something like LaTeX2e, and an optional release-date which the latex-version used must be newer than.

Since packages cannot specify an exact release date or an "older-than" release date, can I download the newest release of the specified LaTeX-version (e.g. LaTeX2e) and have a guarantee that all packages that NeedTeXFormat LaTeX2e work with this?

In other words, do releases of LaTex-versions have backward compatibility?

Also, according to this answer here, when I compile a document with say pdflatex, it uses a file latex.ltx. Am I right in assuming that the latex-version and release date one can specify in \NeedsTeXFormat refers to the version and release date of the latex.ltx file?

  • 2
    Not all versions of all packages work with every version of LaTeX. Especially old versions of packages cannot always work with new versions of LaTeX. If needed, package latexrelease can be used to do a rollback of the LaTeX release. And also some packages allow a rollback using [=<version>] as optional argument to \usepackage after the package argument. BTW: Because of version dependencies it is often not a good idea to update only one package, instead of the whole distribution. But sometimes it is. ;-/ – cabohah Jul 31 '23 at 10:08
  • 3
    it depends a lot on the code of the package. LaTeX puts quite some value on compatibility and packages that use only official, documented interfaces are normally not a problem, but packages can also contain hacks which rely on internals or even redefine internals both of latex and other packages and that can break at updates. – Ulrike Fischer Jul 31 '23 at 10:32
  • If one uses \patchcmd (etoolbox package) to replace code that no longer exists, it may or may not generate an error depending on the arguments used. – John Kormylo Jul 31 '23 at 12:53
  • @UlrikeFischer That's a very good point which I didn't think of. If I want to take that into account, I need to install the exact release-date the package specifies, even if technically (just based on the meaning of the release-date option for \NeedsTeXFormat) a version later than the specified would still satisfy. – Marc Miller Jul 31 '23 at 14:49
  • 1
    @MarcMiller package author typically are not so exact regarding their requirement. And I wouldn't mix versions from different dates unless there is a real need to resolve a concrete problem. – Ulrike Fischer Jul 31 '23 at 14:53
  • @UlrikeFischer and others: Do you by any chance know how texlive /miktex handle this. Do they get shipped with the newest version of latex available and then hope packages work with that? I tried looking into this, but couldn't find any resources. Please let me know if this is better off as a separate question. – Marc Miller Jul 31 '23 at 18:24
  • 1
    Both texlive and miktex update latex within days (texlive is faster than miktex) when it gets to ctan. Neither texlive nor miktex check if it is compatible with other packages. But latex normally uploads first a latex-dev and packages which care can check if they will be problems. See https://tex.stackexchange.com/questions/506646/what-is-latex-dev – Ulrike Fischer Jul 31 '23 at 18:47

1 Answers1

5

There are literally thousands of packages on ctan many have not changed for decades and have worked with all latex releases over that time. Some sometimes need to adjust to a change in the format. It all depends.

Most packages using \NeedsTeXFormat do so as they use a new command not available in older formats, but they expect to work for later formats, and that is what the command checks, it does not check that a format with exactly that date is in use, just that a format no later than that date is in use.

David Carlisle
  • 757,742
  • Great, thanks for the answer. Since most packages use \NeedsTeXFormat because they need a command that is not available in earlier versions, taking the newest LaTeX-version that is released should always work for satisfying that, right? Also, is "that a format no later than that date is in use" a mistake? To my knowledge it's the opposite, meaning a format no earlier than the specified date should be used. – Marc Miller Jul 31 '23 at 14:42
  • there is no guarantee of "always", you are talking about packages written by hundreds of people over 40 years, there is always a chance that a change to latex breaks something, but usually if that happens the package gets fixed so a document using that package should be expected to work. @MarcMiller – David Carlisle Jul 31 '23 at 14:45
  • Yeah "always" was definitely not the right word to use. From my understanding, the release-date option for \NeedsTeXFormat means "This package needs latex in version or later to work". So if I use a version that is newer than , I satisfy that requirement but there is still a chance that something breaks, including for the reasons that @UlrikeFischer mentioned in her comment. Is my understanding correct? – Marc Miller Jul 31 '23 at 14:55
  • 1
    yes newer-or-equal. most packages don't use this at all, so if they do use it it is just a statement that the package will not work on old formats, whether they work in future is quite likely and an expectation, but in the hands of the gods – David Carlisle Jul 31 '23 at 15:03