]> git.lyx.org Git - lyx.git/blobdiff - src/BufferParams.cpp
Disambiguate dialog buttons
[lyx.git] / src / BufferParams.cpp
index 444cb5cf42276c7588cc3bba55005f03fc1928e1..6d519f27f8c41674c21b91f0c7cec03b53d89393 100644 (file)
@@ -394,7 +394,7 @@ BufferParams::BufferParams()
        papersize = PAPER_DEFAULT;
        orientation = ORIENTATION_PORTRAIT;
        use_geometry = false;
-       biblio_style = "plain";
+       biblio_style = string();
        use_bibtopic = false;
        multibib = string();
        use_indices = false;
@@ -2094,8 +2094,8 @@ bool BufferParams::writeLaTeX(otexstream & os, LaTeXFeatures & features,
                OutputParams tmp_params = features.runparams();
                pdfoptions().writeLaTeX(tmp_params, os,
                                        features.isProvided("hyperref"));
-               // correctly break URLs with hyperref and dvi output
-               if (features.runparams().flavor == OutputParams::LATEX
+               // correctly break URLs with hyperref and dvi/ps output
+               if (features.runparams().hyperref_driver == "dvips"
                    && features.isAvailable("breakurl"))
                        os << "\\usepackage{breakurl}\n";
        } else if (features.isRequired("nameref"))
@@ -2264,16 +2264,16 @@ bool BufferParams::writeLaTeX(otexstream & os, LaTeXFeatures & features,
        if (!listings_params.empty()
            || features.mustProvide("listings")
            || features.mustProvide("minted")) {
-               if (features.mustProvide("listings"))
-                       os << "\\usepackage{listings}\n";
-               else
+               if (use_minted)
                        os << "\\usepackage{minted}\n";
+               else
+                       os << "\\usepackage{listings}\n";
        }
        if (!listings_params.empty()) {
-               if (features.mustProvide("listings"))
-                       os << "\\lstset{";
-               else
+               if (use_minted)
                        os << "\\setminted{";
+               else
+                       os << "\\lstset{";
                // do not test validity because listings_params is
                // supposed to be valid
                string par =
@@ -2286,7 +2286,8 @@ bool BufferParams::writeLaTeX(otexstream & os, LaTeXFeatures & features,
        // (the rest is obsoleted by the new TU encoding).
        // It needs to be loaded at least after amsmath, amssymb,
        // esint and the other packages that provide special glyphs
-       if (features.mustProvide("tipa") && useNonTeXFonts) {
+       if (features.mustProvide("tipa") && useNonTeXFonts
+           && !features.isProvided("xunicode")) {
                // The package officially only supports XeTeX, but also works
                // with LuaTeX. Thus we work around its XeTeX test.
                if (features.runparams().flavor != OutputParams::XETEX) {
@@ -2321,7 +2322,11 @@ bool BufferParams::writeLaTeX(otexstream & os, LaTeXFeatures & features,
        }
 
        // ... but before biblatex (see #7065)
-       if (features.mustProvide("biblatex")) {
+       if (features.mustProvide("biblatex")
+           && !features.isProvided("biblatex-natbib")
+           && !features.isProvided("natbib-internal")
+           && !features.isProvided("natbib")
+           && !features.isProvided("jurabib")) {
                string delim = "";
                string opts;
                os << "\\usepackage";
@@ -2621,8 +2626,16 @@ vector<string> BufferParams::backends() const
                        v.push_back("luatex");
                        v.push_back("dviluatex");
                }
-       } else
-               v.push_back(buffmt);
+       } else {
+               string rbuffmt = buffmt;
+               // If we use an OutputFormat in Japanese docs,
+               // we need special format in order to get the path
+               // via pLaTeX (#8823)
+               if (documentClass().hasOutputFormat()
+                   && encoding().package() == Encoding::japanese)
+                       rbuffmt += "-ja";
+               v.push_back(rbuffmt);
+       }
 
        v.push_back("xhtml");
        v.push_back("text");
@@ -2687,14 +2700,15 @@ string BufferParams::getDefaultOutputFormat() const
        if (!default_output_format.empty()
            && default_output_format != "default")
                return default_output_format;
-       if (isDocBook()
-           || encoding().package() == Encoding::japanese) {
+       if (isDocBook()) {
                FormatList const & formats = exportableFormats(true);
                if (formats.empty())
                        return string();
                // return the first we find
                return formats.front()->name();
        }
+       if (encoding().package() == Encoding::japanese)
+               return lyxrc.default_platex_view_format;
        if (useNonTeXFonts)
                return lyxrc.default_otf_view_format;
        return lyxrc.default_view_format;
@@ -3412,6 +3426,9 @@ bool BufferParams::addCiteEngine(vector<string> const & engine)
 
 string const & BufferParams::defaultBiblioStyle() const
 {
+       if (!biblio_style.empty())
+               return biblio_style;
+
        map<string, string> const & bs = documentClass().defaultBiblioStyle();
        auto cit = bs.find(theCiteEnginesList.getTypeAsString(citeEngineType()));
        if (cit != bs.end())