]> git.lyx.org Git - lyx.git/blobdiff - src/LaTeXFeatures.cpp
Cmake build: Creating a define for a header file found
[lyx.git] / src / LaTeXFeatures.cpp
index 12db9f6c247b7b281115ae346caa55807bf2246f..562f9b1150c12d64c39b7001da9a77ee7f4b8fe0 100644 (file)
@@ -327,7 +327,7 @@ LaTeXFeatures::LaTeXFeatures(Buffer const & b, BufferParams const & p,
 {}
 
 
-LaTeXFeatures::LangPackage LaTeXFeatures::langPackage(bool englishbabel) const
+LaTeXFeatures::LangPackage LaTeXFeatures::langPackage() const
 {
        string const local_lp = bufferParams().lang_package;
 
@@ -347,9 +347,6 @@ LaTeXFeatures::LangPackage LaTeXFeatures::langPackage(bool englishbabel) const
         * If babel is selected (either directly or via the "auto"
         * mechanism), we really do only require it if we have
         * a language that needs it.
-        * English alone normally does not require babel (since it is
-        * the default language of LaTeX). However, in some cases we
-        * need to surpass this exception (see Font::validate).
         */
        bool const polyglossia_required =
                isRequired("polyglossia")
@@ -357,8 +354,7 @@ LaTeXFeatures::LangPackage LaTeXFeatures::langPackage(bool englishbabel) const
                && !isProvided("babel")
                && this->hasOnlyPolyglossiaLanguages();
        bool const babel_required = 
-               ((englishbabel || bufferParams().language->lang() != "english")
-                && !bufferParams().language->babel().empty())
+               !bufferParams().language->babel().empty()
                || !this->getBabelLanguages().empty();
 
        if (local_lp == "auto") {
@@ -720,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 *);
 
 }
@@ -850,6 +861,15 @@ string const LaTeXFeatures::getPackages() const
            params_.use_package("yhmath") != BufferParams::package_off)
                packages << "\\usepackage{yhmath}\n";
 
+       // stmaryrd must be loaded after amsmath
+       if (mustProvide("stmaryrd") &&
+           params_.use_package("stmaryrd") != BufferParams::package_off)
+               packages << "\\usepackage{stmaryrd}\n";
+
+       if (mustProvide("stackrel") &&
+           params_.use_package("stackrel") != BufferParams::package_off)
+               packages << "\\usepackage{stackrel}\n";
+
        if (mustProvide("undertilde") &&
                params_.use_package("undertilde") != BufferParams::package_off)
                packages << "\\usepackage{undertilde}\n";
@@ -889,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).
@@ -902,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";