mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 05:16:21 +00:00
Consider class-provided citation engines
Do not attempt to load, nor allow to set, a different engine in this case. Fixes: #11022
This commit is contained in:
parent
84658d37e2
commit
2f6ada6644
@ -2322,7 +2322,11 @@ bool BufferParams::writeLaTeX(otexstream & os, LaTeXFeatures & features,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ... but before biblatex (see #7065)
|
// ... 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 delim = "";
|
||||||
string opts;
|
string opts;
|
||||||
os << "\\usepackage";
|
os << "\\usepackage";
|
||||||
|
@ -1231,7 +1231,11 @@ string const LaTeXFeatures::getPackages() const
|
|||||||
// Some classes load natbib themselves, but still allow (or even require)
|
// Some classes load natbib themselves, but still allow (or even require)
|
||||||
// plain numeric citations (ReVTeX is such a case, see bug 5182).
|
// plain numeric citations (ReVTeX is such a case, see bug 5182).
|
||||||
// This special case is indicated by the "natbib-internal" key.
|
// 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[";
|
packages << "\\usepackage[";
|
||||||
if (params_.citeEngineType() == ENGINE_TYPE_NUMERICAL)
|
if (params_.citeEngineType() == ENGINE_TYPE_NUMERICAL)
|
||||||
packages << "numbers";
|
packages << "numbers";
|
||||||
@ -1250,7 +1254,11 @@ string const LaTeXFeatures::getPackages() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
// jurabib -- we need version 0.6 at least.
|
// 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";
|
packages << "\\usepackage";
|
||||||
if (!params_.biblio_opts.empty())
|
if (!params_.biblio_opts.empty())
|
||||||
packages << '[' << params_.biblio_opts << ']';
|
packages << '[' << params_.biblio_opts << ']';
|
||||||
|
@ -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()
|
void GuiDocument::rescanBibFiles()
|
||||||
{
|
{
|
||||||
if (isBiblatex())
|
if (isBiblatex())
|
||||||
@ -3326,6 +3348,8 @@ void GuiDocument::paramsToDialog()
|
|||||||
updateEngineType(documentClass().opt_enginetype(),
|
updateEngineType(documentClass().opt_enginetype(),
|
||||||
bp_.citeEngineType());
|
bp_.citeEngineType());
|
||||||
|
|
||||||
|
checkPossibleCiteEngines();
|
||||||
|
|
||||||
biblioModule->citeStyleCO->setCurrentIndex(
|
biblioModule->citeStyleCO->setCurrentIndex(
|
||||||
biblioModule->citeStyleCO->findData(bp_.citeEngineType()));
|
biblioModule->citeStyleCO->findData(bp_.citeEngineType()));
|
||||||
|
|
||||||
|
@ -296,6 +296,8 @@ private:
|
|||||||
///
|
///
|
||||||
bool isBiblatex() const;
|
bool isBiblatex() const;
|
||||||
///
|
///
|
||||||
|
void checkPossibleCiteEngines();
|
||||||
|
///
|
||||||
BufferParams bp_;
|
BufferParams bp_;
|
||||||
/// List of names of available modules
|
/// List of names of available modules
|
||||||
std::list<modInfoStruct> moduleNames_;
|
std::list<modInfoStruct> moduleNames_;
|
||||||
|
Loading…
Reference in New Issue
Block a user