]> git.lyx.org Git - lyx.git/blobdiff - src/BufferParams.cpp
Fix font of macro template name
[lyx.git] / src / BufferParams.cpp
index 46baa3b74ca94c74ff1a9fdfb93ddf5359ba1d87..2736c26977f78df08e9c7504803f5e13f674ce48 100644 (file)
@@ -849,13 +849,13 @@ string BufferParams::readToken(Lexer & lex, string const & token,
                biblio_style = lex.getString();
        } else if (token == "\\biblio_options") {
                lex.eatLine();
-               biblio_opts = lex.getString();
+               biblio_opts = trim(lex.getString());
        } else if (token == "\\biblatex_bibstyle") {
                lex.eatLine();
-               biblatex_bibstyle = lex.getString();
+               biblatex_bibstyle = trim(lex.getString());
        } else if (token == "\\biblatex_citestyle") {
                lex.eatLine();
-               biblatex_citestyle = lex.getString();
+               biblatex_citestyle = trim(lex.getString());
        } else if (token == "\\use_bibtopic") {
                lex >> use_bibtopic;
        } else if (token == "\\use_indices") {
@@ -3360,15 +3360,31 @@ 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 return the processor set in prefs
+
+       // If we have "default" in document settings, consult the prefs
+       // 1. Japanese (uses a specific processor)
+       if (encoding().package() == Encoding::japanese) {
+               if (lyxrc.jbibtex_command != "automatic")
+                       // Return the specified program, if "automatic" is not set
+                       return lyxrc.jbibtex_command;
+               else if (!useBiblatex()) {
+                       // With classic BibTeX, return pbibtex, jbibtex, bibtex
+                       if (lyxrc.jbibtex_alternatives.find("pbibtex") != lyxrc.jbibtex_alternatives.end())
+                               return "pbibtex";
+                       if (lyxrc.jbibtex_alternatives.find("jbibtex") != lyxrc.jbibtex_alternatives.end())
+                               return "jbibtex";
+                       return "bibtex";
+               }
+       }
+       // 2. All other languages
        else if (lyxrc.bibtex_command != "automatic")
+               // Return the specified program, if "automatic" is not set
                return lyxrc.bibtex_command;
-       // Automatic means: find the most suitable for the current cite framework
+
+       // 3. Automatic: 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
+               // For Biblatex, we prefer biber (also for Japanese)
+               // 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())