]> git.lyx.org Git - features.git/commitdiff
Add known citation packages to LaTeXFeatures:
authorJulien Rioux <jrioux@lyx.org>
Fri, 4 Jan 2013 22:57:40 +0000 (23:57 +0100)
committerJulien Rioux <jrioux@lyx.org>
Fri, 4 Jan 2013 23:08:55 +0000 (00:08 +0100)
  - achicago
  - apacite
  - apalike
  - astron
  - authordate
  - chicago
  - harvard
  - mslapa
  - named

This allows these citation packages can be Required by the document layout.
LyX handles the package ordering, loading any of these packages before natbib
when both are required by the document layout. For example, apacite can be
used with or without natbib.

The package achicago isn't compatible with natbib out-of-the-box,
but the following compatibility code makes it work:

\usepackage{achicago}
\let\achicagobib\thebibliography
\usepackage[authoryear]{natbib}
\let\thebibliography\achicagobib
\let\UnexpandableProtect\protect
\let\SCcite\astroncite

lib/chkconfig.ltx
src/LaTeX.cpp
src/LaTeXFeatures.cpp

index 5b9f9576de5150ee5bf35a0630b71ae9242f5efc..76ece71f00f01161190dc99772d4144195498114 100644 (file)
 
 %%% Packages
 \TestPackage{accents}
+\TestPackage{achicago}
 \TestPackage{algorithm}
 \TestPackage{amstext}
+\TestPackage{apacite}
+\TestPackage{apalike}
 \TestPackage[arabic.ldf]{arabi}
 \TestPackage{array}
+\TestPackage{astron}
+\TestPackage{authordate1-4}
 \TestPackage{babel}
 \TestPackage{bibtopic}
 \TestPackage{bidi}
 \TestPackage{CJKutf8}
 \TestPackage{calc}
 \TestPackage{cancel}
+\TestPackage{chicago}
 \TestPackage{color} % this one should be there if graphics.sty is there.
 \TestPackage{covington}
 \TestPackage{csquotes}
 \TestPackage{esint}
 \TestPackage{eso-pic}
 \TestPackage{fontspec}
+\TestPackage{harvard}
 \TestPackage{hhline}
 \TestPackage{ifthen}
 \TestPackage{iftex}
 \TestPackage{mathtools}
 \TestPackage{mhchem}
 \TestPackage[mongolian.ldf]{mongolian}
+\TestPackage{mslapa}
 \TestPackage{multirow}
+\TestPackage{named}
 \TestPackage{natbib}
 \TestPackage{nicefrac}
 \TestPackage{nomencl}
index c9d32478d1ef108b2b5a54e57c5a2c2e9ed71142..a6244863ffc1f1cf985d95faf1b4c41e37f60e42 100644 (file)
@@ -184,7 +184,7 @@ int LaTeX::run(TeXErrors & terr)
 
        bool had_depfile = depfile.exists();
        bool run_bibtex = false;
-       FileName const aux_file(changeExtension(file.absFileName(), "aux"));
+       FileName const aux_file(changeExtension(file.absFileName(), ".aux"));
 
        if (had_depfile) {
                LYXERR(Debug::DEPEND, "Dependency file exists");
@@ -694,6 +694,10 @@ int LaTeX::scanLogFile(TeXErrors & terr)
                                   && contains(token, "on page")
                                   && contains(token, "undefined")) {
                                retval |= UNDEF_CIT;
+                       } else if (contains(token, "Citation")
+                                  && contains(token, "on input line")
+                                  && contains(token, "undefined")) {
+                               retval |= UNDEF_CIT;
                        }
                } else if (prefixIs(token, "Package")) {
                        // Package warnings
index 6b23fc537b4f69d497235965e6d6df51d5d403a4..562f9b1150c12d64c39b7001da9a77ee7f4b8fe0 100644 (file)
@@ -716,6 +716,21 @@ char const * simplefeatures[] = {
        "tfrupee"
 };
 
+char const * bibliofeatures[] = {
+       // Known bibliography packages (will be loaded before natbib)
+       "achicago",
+       "apacite",
+       "apalike",
+       "astron",
+       "authordate1-4",
+       "chicago",
+       "harvard",
+       "mslapa",
+       "named"
+};
+
+int const nb_bibliofeatures = sizeof(bibliofeatures) / sizeof(char const *);
+
 int const nb_simplefeatures = sizeof(simplefeatures) / sizeof(char const *);
 
 }
@@ -894,6 +909,17 @@ string const LaTeXFeatures::getPackages() const
            params_.use_package("esint") != BufferParams::package_off)
                packages << "\\usepackage{esint}\n";
 
+       // Known bibliography packages (simple \usepackage{package})
+       for (int i = 0; i < nb_bibliofeatures; ++i) {
+               if (mustProvide(bibliofeatures[i]))
+                       packages << "\\usepackage{"
+                                << bibliofeatures[i] << "}\n";
+       }
+
+       // Compatibility between achicago and natbib
+       if (mustProvide("achicago") && mustProvide("natbib"))
+               packages << "\\let\\achicagobib\\thebibliography\n";
+
        // natbib.sty
        // Some classes load natbib themselves, but still allow (or even require)
        // plain numeric citations (ReVTeX is such a case, see bug 5182).
@@ -907,6 +933,13 @@ string const LaTeXFeatures::getPackages() const
                packages << "]{natbib}\n";
        }
 
+       // Compatibility between achicago and natbib
+       if (mustProvide("achicago") && mustProvide("natbib")) {
+               packages << "\\let\\thebibliography\\achicagobib\n";
+               packages << "\\let\\SCcite\\astroncite\n";
+               packages << "\\let\\UnexpandableProtect\\protect\n";
+       }
+
        // jurabib -- we need version 0.6 at least.
        if (mustProvide("jurabib"))
                packages << "\\usepackage{jurabib}[2004/01/25]\n";