Jean-Marc Lasgouttes schrieb:
I propose the following to both correct and simplify your code.
This won't work. Attached is my proposal.
regards Uwe
Index: src/BufferParams.cpp
===================================================================
--- src/BufferParams.cpp (révision 18240)
+++ src/BufferParams.cpp (copie de travail)
@@ -1378,21 +1378,18 @@ string const BufferParams::dvips_options
string const BufferParams::babelCall(string const & lang_opts) const
{
- string tmp = lyxrc.language_package;
- if (!lyxrc.language_global_options && tmp == "\\usepackage{babel}")
- tmp = string("\\usepackage[") + lang_opts + "]{babel}";
- // suppress the babel call when there is no babel language defined
- // in the lib/languages file
- if (lyxrc.language_global_options && tmp == "\\usepackage{babel}" &&
- language->babel().empty() ) {
- // if the armscii8 or a CJK encoding is used, babel has to be called
- // for foreign languages
- if (!lang_opts.empty())
- tmp = string("\\usepackage[") + lang_opts + "]{babel}";
+ string tmp = lyxrc.language_package;
+ if (tmp == "\\usepackage{babel}") {
+ if (!lyxrc.language_global_options && !language->babel().empty())
+ tmp = string("\\usepackage[") + lang_opts + "]{babel}";
+ if (lyxrc.language_global_options && !language->babel().empty())
+ return tmp;
+ // suppress the babel call when there is no babel language defined
+ // in the lib/languages file
+ if (language->babel().empty()) {
+ if (lang_opts.empty())
+ tmp.clear();
+ // call babel anyway if other document languages are used
+ // to handle the \foreignlanguage commands
+ else
+ tmp = string("\\usepackage[") + lang_opts + "]{babel}";
+ }
+ }