]> git.lyx.org Git - lyx.git/blobdiff - src/BufferParams.cpp
Do not use \&@#^_~$ as lstinline delimiter, as suggested by Herbert
[lyx.git] / src / BufferParams.cpp
index 4d8b0b6ea660f7acbc6d03db0547d549aeabcb04..c958a2dc5854933468b0fd2dc1d149a525f1ee6c 100644 (file)
@@ -867,7 +867,7 @@ bool BufferParams::writeLaTeX(odocstream & os, LaTeXFeatures & features,
                                language_options << ',';
                        language_options << language->babel();
                }
-               if (lyxrc.language_global_options)
+               if (lyxrc.language_global_options && !language_options.str().empty())
                        clsoptions << language_options.str() << ',';
        }
 
@@ -1408,21 +1408,17 @@ string const BufferParams::dvips_options() const
 
 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}";
+       string lang_pack = lyxrc.language_package;
+       if (lang_pack != "\\usepackage{babel}")
+               return lang_pack;
        // 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}";
-               else
-                       tmp.clear();
-       }
-       return tmp;
+       // for the document language in the lib/languages file and if no
+       // other languages are used (lang_opts is then empty)
+       if (lang_opts.empty())
+               return string();
+       if (!lyxrc.language_global_options)
+               return "\\usepackage[" + lang_opts + "]{babel}";
+       return lang_pack;
 }