Limit nomencl backwards support to case when old package is really used

This is only needed for very old versions of the nomencl package
(before March 2005)

No need to output compatibility code with newer versions

Furthermore, this breaks the use of the glossary package which also
has .glo extension (#12968)
This commit is contained in:
Juergen Spitzmueller 2023-11-08 16:17:58 +01:00
parent 412d202fc3
commit f74cc0ec92
3 changed files with 23 additions and 14 deletions

View File

@ -369,7 +369,7 @@
\TestPackage{named}
\TestPackage{natbib}
\TestPackage{nicefrac}
\TestPackage{nomencl}
\TestPackageAddVersion{nomencl}
\TestPackage{paralist}
\TestPackage{parskip}
\TestPackage{pdflscape}

View File

@ -25,6 +25,7 @@
#include "DepTable.h"
#include "Encoding.h"
#include "Language.h"
#include "LaTeXFeatures.h"
#include "support/debug.h"
#include "support/docstring.h"
@ -160,12 +161,14 @@ void LaTeX::removeAuxiliaryFiles() const
ind.removeFile();
// nomencl file
FileName const nls(changeExtension(file.absFileName(), ".nls"));
nls.removeFile();
// nomencl file (old version of the package)
FileName const gls(changeExtension(file.absFileName(), ".gls"));
gls.removeFile();
if (LaTeXFeatures::isAvailableAtLeastFrom("nomencl", 2005, 3, 31)) {
FileName const nls(changeExtension(file.absFileName(), ".nls"));
nls.removeFile();
} else if (LaTeXFeatures::isAvailable("nomencl")) {
// nomencl file (old version of the package up to v. 4.0)
FileName const gls(changeExtension(file.absFileName(), ".gls"));
gls.removeFile();
}
// endnotes file
FileName const ent(changeExtension(file.absFileName(), ".ent"));
@ -315,8 +318,12 @@ int LaTeX::run(TeXErrors & terr)
// the extra checks here (to trigger a rerun). Cf. discussions in #8905.
// FIXME: Sort out the real problem in DepTable.
bool const run_nomencl = head.haschanged(nlofile) || (nlofile.exists() && nlofile.isFileEmpty());
FileName const glofile(changeExtension(file.absFileName(), ".glo"));
bool const run_nomencl_glo = head.haschanged(glofile);
bool run_nomencl_glo = false;
if (!LaTeXFeatures::isAvailableAtLeastFrom("nomencl", 2005, 3, 31)) {
// nomencl package up to v4.0
FileName const glofile(changeExtension(file.absFileName(), ".glo"));
run_nomencl_glo = head.haschanged(glofile);
}
// 1
// At this point we must run the bibliography processor if needed.

View File

@ -1529,14 +1529,16 @@ string const LaTeXFeatures::getPackages() const
"\\usepackage{ulem}\n";
if (mustProvide("nomencl")) {
packages << "\\usepackage{nomencl}\n";
// Make it work with the new and old version of the package,
// but don't use the compatibility option since it is
// incompatible to other packages.
packages << "\\usepackage{nomencl}\n"
"% the following is useful when we have the old nomencl.sty package\n"
"\\providecommand{\\printnomenclature}{\\printglossary}\n"
"\\providecommand{\\makenomenclature}{\\makeglossary}\n"
"\\makenomenclature\n";
if (!LaTeXFeatures::isAvailableAtLeastFrom("nomencl", 2005, 3, 31)) {
packages << "% Needed with nomencl < v4.1\n"
"\\providecommand{\\printnomenclature}{\\printglossary}\n"
"\\providecommand{\\makenomenclature}{\\makeglossary}\n";
}
packages << "\\makenomenclature\n";
}
// fixltx2e provides subscript