diff --git a/lib/chkconfig.ltx b/lib/chkconfig.ltx index 156fd06176..bde9d59e4b 100644 --- a/lib/chkconfig.ltx +++ b/lib/chkconfig.ltx @@ -369,7 +369,7 @@ \TestPackage{named} \TestPackage{natbib} \TestPackage{nicefrac} -\TestPackage{nomencl} +\TestPackageAddVersion{nomencl} \TestPackage{paralist} \TestPackage{parskip} \TestPackage{pdflscape} diff --git a/src/LaTeX.cpp b/src/LaTeX.cpp index 3afe312d30..84141d8341 100644 --- a/src/LaTeX.cpp +++ b/src/LaTeX.cpp @@ -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. diff --git a/src/LaTeXFeatures.cpp b/src/LaTeXFeatures.cpp index 3d7a09b35e..20abc00c6c 100644 --- a/src/LaTeXFeatures.cpp +++ b/src/LaTeXFeatures.cpp @@ -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