]> git.lyx.org Git - lyx.git/blobdiff - src/BufferParams.cpp
compil fix.
[lyx.git] / src / BufferParams.cpp
index 2f1886b5e4f4569b7ecf682afeeb832c74d83ad6..8d6c4d770be0c175b5dbec22f09bc84aa95ed32e 100644 (file)
@@ -903,7 +903,7 @@ bool BufferParams::writeLaTeX(odocstream & os, LaTeXFeatures & features,
                // when Vietnamese is used, babel must directly be loaded with the
                // language options, not in the class options, see
                // http://www.mail-archive.com/lyx-devel@lists.lyx.org/msg129417.html
-               int viet = language_options.str().find("vietnam");
+               size_t viet = language_options.str().find("vietnam");
                // viet = string::npos when not found
                if (lyxrc.language_global_options && !language_options.str().empty()
                        && viet == string::npos)
@@ -1148,10 +1148,16 @@ bool BufferParams::writeLaTeX(odocstream & os, LaTeXFeatures & features,
        }
 
        // When the language "japanese-plain" is used, the package "japanese" must
-       // be loaded behind babel (it provides babel support for Japanese)
-       // see http://www.mail-archive.com/lyx-devel@lists.lyx.org/msg129680.html
-       if (language->lang() == "japanese-plain")
+       // be loaded behind babel (it provides babel support for Japanese) but before
+       // hyperref, see
+       // http://www.mail-archive.com/lyx-devel@lists.lyx.org/msg129680.html
+       if (language->lang() == "japanese-plain" &&
+               !getTextClass().provides("japanese")) {
+               //load babel in case it was not loaded due to an empty language list
+               if (language_options.str().empty())
+                       lyxpreamble += "\\usepackage{babel}\n";
                lyxpreamble += "\\usepackage{japanese}\n";
+       }
 
        // PDF support.
        // * Hyperref manual: "Make sure it comes last of your loaded
@@ -1162,7 +1168,8 @@ bool BufferParams::writeLaTeX(odocstream & os, LaTeXFeatures & features,
        // * Has to be loaded before the "LyX specific LaTeX commands" to
        //   avoid errors with algorithm floats.
        odocstringstream oss;
-       pdfoptions().writeLaTeX(oss);
+       // use hyperref explicitely when it is required
+       pdfoptions().writeLaTeX(oss, features.isRequired("hyperref"));
        lyxpreamble += oss.str();
 
        // this might be useful...
@@ -1563,14 +1570,12 @@ string const BufferParams::babelCall(string const & lang_opts) const
        // suppress the babel call when there is no babel language defined
        // for the document language in the lib/languages file and if no
        // other languages are used (lang_opts is then empty)
-       // exception is the language "japanese-plain" where babel is needed anyway
-       // see http://www.mail-archive.com/lyx-devel@lists.lyx.org/msg129680.html
-       if (lang_opts.empty() && language->lang() != "japanese-plain")
+       if (lang_opts.empty())
                return string();
        // when Vietnamese is used, babel must directly be loaded with the
        // language options, see
        // http://www.mail-archive.com/lyx-devel@lists.lyx.org/msg129417.html
-       int viet = lang_opts.find("vietnam");
+       size_t viet = lang_opts.find("vietnam");
        // viet = string::npos when not found
        if (!lyxrc.language_global_options || viet != string::npos)
                return "\\usepackage[" + lang_opts + "]{babel}";