diff --git a/src/BufferParams.cpp b/src/BufferParams.cpp index 2f7058a9e4..b709b16a54 100644 --- a/src/BufferParams.cpp +++ b/src/BufferParams.cpp @@ -2322,7 +2322,11 @@ bool BufferParams::writeLaTeX(otexstream & os, LaTeXFeatures & features, } // ... but before biblatex (see #7065) - if (features.mustProvide("biblatex")) { + if (features.mustProvide("biblatex") + && !features.isProvided("biblatex-natbib") + && !features.isProvided("natbib-internal") + && !features.isProvided("natbib") + && !features.isProvided("jurabib")) { string delim = ""; string opts; os << "\\usepackage"; diff --git a/src/LaTeXFeatures.cpp b/src/LaTeXFeatures.cpp index d4b0018b73..850af10169 100644 --- a/src/LaTeXFeatures.cpp +++ b/src/LaTeXFeatures.cpp @@ -1232,7 +1232,11 @@ string const LaTeXFeatures::getPackages() const // Some classes load natbib themselves, but still allow (or even require) // plain numeric citations (ReVTeX is such a case, see bug 5182). // This special case is indicated by the "natbib-internal" key. - if (mustProvide("natbib") && !isProvided("natbib-internal")) { + if (mustProvide("natbib") + && !isProvided("natbib-internal") + && !isProvided("biblatex") + && !isProvided("biblatex-natbib") + && !isProvided("jurabib")) { packages << "\\usepackage["; if (params_.citeEngineType() == ENGINE_TYPE_NUMERICAL) packages << "numbers"; @@ -1251,7 +1255,11 @@ string const LaTeXFeatures::getPackages() const } // jurabib -- we need version 0.6 at least. - if (mustProvide("jurabib")) { + if (mustProvide("jurabib") + && !isProvided("natbib-internal") + && !isProvided("natbib") + && !isProvided("biblatex") + && !isProvided("biblatex-natbib")) { packages << "\\usepackage"; if (!params_.biblio_opts.empty()) packages << '[' << params_.biblio_opts << ']'; diff --git a/src/frontends/qt4/GuiDocument.cpp b/src/frontends/qt4/GuiDocument.cpp index b67f7979f6..524ea399b0 100644 --- a/src/frontends/qt4/GuiDocument.cpp +++ b/src/frontends/qt4/GuiDocument.cpp @@ -2445,6 +2445,28 @@ void GuiDocument::biblioChanged() } +void GuiDocument::checkPossibleCiteEngines() +{ + // Check if the class provides a specific engine, + // and if so, enforce this. + string force_engine; + if (documentClass().provides("natbib") + || documentClass().provides("natbib-internal")) + force_engine = "natbib"; + else if (documentClass().provides("jurabib")) + force_engine = "jurabib"; + else if (documentClass().provides("biblatex")) + force_engine = "biblatex"; + else if (documentClass().provides("biblatex-natbib")) + force_engine = "biblatex-natbib"; + + if (!force_engine.empty()) + biblioModule->citeEngineCO->setCurrentIndex( + biblioModule->citeEngineCO->findData(toqstr(force_engine))); + biblioModule->citeEngineCO->setEnabled(force_engine.empty()); +} + + void GuiDocument::rescanBibFiles() { if (isBiblatex()) @@ -3326,6 +3348,8 @@ void GuiDocument::paramsToDialog() updateEngineType(documentClass().opt_enginetype(), bp_.citeEngineType()); + checkPossibleCiteEngines(); + biblioModule->citeStyleCO->setCurrentIndex( biblioModule->citeStyleCO->findData(bp_.citeEngineType())); diff --git a/src/frontends/qt4/GuiDocument.h b/src/frontends/qt4/GuiDocument.h index be1b7e489f..1fe1dc74a1 100644 --- a/src/frontends/qt4/GuiDocument.h +++ b/src/frontends/qt4/GuiDocument.h @@ -296,6 +296,8 @@ private: /// bool isBiblatex() const; /// + void checkPossibleCiteEngines(); + /// BufferParams bp_; /// List of names of available modules std::list moduleNames_;