commit 1eb43536da25a9617e3d471b3e24d0c4a239c21b
Author: Juergen Spitzmueller <[email protected]>
Date: Fri Jan 13 19:18:35 2017 +0100
Add an "Automatic" bibliography processor pref option
This is now set as default. It selects biber for Biblatex (with
fall-back to first bibtex8, then bibtex, if the former is not
installed), and bibtex for BibTeX-based engines.
With this, users do not normally need to care for the processor when
they switch cite engines.
---
lib/doc/UserGuide.lyx | 75 +++++++++++++++++++++++++++++++++-------
src/BufferParams.cpp | 16 +++++++-
src/BufferParams.h | 2 +-
src/LyXRC.cpp | 2 +-
src/frontends/qt4/GuiPrefs.cpp | 1 +
5 files changed, 79 insertions(+), 17 deletions(-)
diff --git a/lib/doc/UserGuide.lyx b/lib/doc/UserGuide.lyx
index 0a4d137..9774567 100644
--- a/lib/doc/UserGuide.lyx
+++ b/lib/doc/UserGuide.lyx
@@ -1,5 +1,5 @@
#LyX 2.3 created this file. For more info see http://www.lyx.org/
-\lyxformat 528
+\lyxformat 530
\begin_document
\begin_header
\save_transient_properties true
@@ -29322,7 +29322,7 @@ bibtex8 allows all characters that are possible to
encode in an 8-bit encoding
bibtex
\family default
, works with all bibliography packages
-\change_inserted -712698321 1483887200
+\change_inserted -712698321 1484330876
, although more complex
\family sans
Biblatex
@@ -29336,16 +29336,57 @@ Biblatex
\begin_layout Standard
-\change_inserted -712698321 1483887384
-In addition to these, you can set a specific processor for Japanese documents
- in
+\change_inserted -712698321 1484331301
+By default (with
+\begin_inset Quotes eld
+\end_inset
+
+Default
+\begin_inset Quotes erd
+\end_inset
+
+ bibliography processor set in
+\family sans
+Document\SpecialChar menuseparator
+Settings\SpecialChar menuseparator
+Bibliography
+\family default
+ and
+\begin_inset Quotes eld
+\end_inset
+
+Automatic
+\begin_inset Quotes erd
+\end_inset
+
+ bibliography processor in
\family sans
Tools\SpecialChar menuseparator
Preferences\SpecialChar menuseparator
Output\SpecialChar menuseparator
LaTeX
\family default
-.
+), \SpecialChar LyX
+ selects the most appropriate (available) processor for the current bibliogra
+phy approach (
+\family sans
+biber
+\family default
+ for Biblatex,
+\family sans
+bibtex
+\family default
+ for Bib\SpecialChar TeX
+-based bibliography styles).
+ This should suit most needs.
+\change_unchanged
+
+\end_layout
+
+\begin_layout Standard
+
+\change_inserted -712698321 1484331395
+In Japanese documents, a specific processor is used.
By default, this is
\family sans
pbibtex
@@ -29355,11 +29396,14 @@ pbibtex
bibtex
\family default
variant specifically aimed at Japanese.
- It is automatically used, instead of
+ You can adjust it in
\family sans
-bibtex
+Tools\SpecialChar menuseparator
+Preferences\SpecialChar menuseparator
+Output\SpecialChar menuseparator
+LaTeX
\family default
-, in Japanese documents.
+.
\change_unchanged
\end_layout
@@ -29369,11 +29413,16 @@ bibtex
\change_deleted -712698321 1483886683
Bib\SpecialChar TeX
-\change_inserted -712698321 1483887395
-The selected processor
+\change_inserted -712698321 1484331419
+Selected bibliography processors
\change_unchanged
- can be controlled with options that you can add below the specification
- of the variants.
+ can be controlled with options that you can add below the
+\change_deleted -712698321 1484331437
+specification of the variants
+\change_inserted -712698321 1484331439
+selection
+\change_unchanged
+.
Before adding options, it is strongly recommended that you read the manual
\change_inserted -712698321 1483886810
diff --git a/src/BufferParams.cpp b/src/BufferParams.cpp
index f6e7f50..46baa3b 100644
--- a/src/BufferParams.cpp
+++ b/src/BufferParams.cpp
@@ -3355,14 +3355,26 @@ vector<CitationStyle> BufferParams::citeStyles() const
}
-string const & BufferParams::bibtexCommand() const
+string const BufferParams::bibtexCommand() const
{
+ // Return document-specific setting if available
if (bibtex_command != "default")
return bibtex_command;
+ // For Japanese, return the specific program
else if (encoding().package() == Encoding::japanese)
return lyxrc.jbibtex_command;
- else
+ // Else return the processor set in prefs
+ else if (lyxrc.bibtex_command != "automatic")
return lyxrc.bibtex_command;
+ // Automatic means: find the most suitable for the current cite
framework
+ if (useBiblatex()) {
+ // For biblatex, we prefer biber and fall back to bibtex8 and,
as last resort, bibtex
+ if (lyxrc.bibtex_alternatives.find("biber") !=
lyxrc.bibtex_alternatives.end())
+ return "biber";
+ else if (lyxrc.bibtex_alternatives.find("bibtex8") !=
lyxrc.bibtex_alternatives.end())
+ return "bibtex8";
+ }
+ return "bibtex";
}
diff --git a/src/BufferParams.h b/src/BufferParams.h
index 1c64f3a..5083b68 100644
--- a/src/BufferParams.h
+++ b/src/BufferParams.h
@@ -463,7 +463,7 @@ public:
std::vector<CitationStyle> citeStyles() const;
/// Return the actual bibtex command (lyxrc or buffer param)
- std::string const & bibtexCommand() const;
+ std::string const bibtexCommand() const;
/// Are we using biblatex?
bool useBiblatex() const;
diff --git a/src/LyXRC.cpp b/src/LyXRC.cpp
index 587e1e7..32ba8fd 100644
--- a/src/LyXRC.cpp
+++ b/src/LyXRC.cpp
@@ -236,7 +236,7 @@ void LyXRC::setDefaults()
default_view_format = "pdf2";
default_otf_view_format = "pdf4";
chktex_command = "chktex -n1 -n3 -n6 -n9 -n22 -n25 -n30 -n38";
- bibtex_command = "bibtex";
+ bibtex_command = "automatic";
fontenc = "default";
index_command = "makeindex -c -q";
nomencl_command = "makeindex -s nomencl.ist";
diff --git a/src/frontends/qt4/GuiPrefs.cpp b/src/frontends/qt4/GuiPrefs.cpp
index ee43b4f..0ffe256 100644
--- a/src/frontends/qt4/GuiPrefs.cpp
+++ b/src/frontends/qt4/GuiPrefs.cpp
@@ -870,6 +870,7 @@ void PrefLatex::updateRC(LyXRC const & rc)
{
latexBibtexCO->clear();
+ latexBibtexCO->addItem(qt_("Automatic"), "automatic");
latexBibtexCO->addItem(qt_("Custom"), QString());
for (LyXRC::CommandSet::const_iterator it =
rc.bibtex_alternatives.begin();
it != rc.bibtex_alternatives.end(); ++it) {