]> git.lyx.org Git - features.git/blobdiff - src/BufferParams.cpp
Load hyperref with a suitable driver
[features.git] / src / BufferParams.cpp
index 2f7058a9e4403faf3cbcd0341381f6760ad69671..f0be844870c8f079659574683f242380a36e2f13 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"))
@@ -2322,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";
@@ -2674,9 +2678,8 @@ OutputParams::FLAVOR BufferParams::getOutputFlavor(string const & format) const
                if (find(backs.begin(), backs.end(), dformat) == backs.end()) {
                        // Get shortest path to format
                        Graph::EdgePath path;
-                       for (vector<string>::const_iterator it = backs.begin();
-                           it != backs.end(); ++it) {
-                               Graph::EdgePath p = theConverters().getPath(*it, dformat);
+                       for (auto const & bvar : backs) {
+                               Graph::EdgePath p = theConverters().getPath(bvar, dformat);
                                if (!p.empty() && (path.empty() || p.size() < path.size())) {
                                        path = p;
                                }
@@ -3191,21 +3194,21 @@ void BufferParams::writeEncodingPreamble(otexstream & os,
                        language->encoding()->package();
 
                // Create list of inputenc options:
-               set<string> encodings;
+               set<string> encoding_set;
                // luainputenc fails with more than one encoding
                if (!features.runparams().isFullUnicode()) // if we reach this point, this means LuaTeX with TeX fonts
                        // list all input encodings used in the document
-                       encodings = features.getEncodingSet(doc_encoding);
+                       encoding_set = features.getEncodingSet(doc_encoding);
 
                // If the "japanese" package (i.e. pLaTeX) is used,
                // inputenc must be omitted.
                // see http://www.mail-archive.com/lyx-devel@lists.lyx.org/msg129680.html
-               if ((!encodings.empty() || package == Encoding::inputenc)
+               if ((!encoding_set.empty() || package == Encoding::inputenc)
                    && !features.isRequired("japanese")
                    && !features.isProvided("inputenc")) {
                        os << "\\usepackage[";
-                       set<string>::const_iterator it = encodings.begin();
-                       set<string>::const_iterator const end = encodings.end();
+                       set<string>::const_iterator it = encoding_set.begin();
+                       set<string>::const_iterator const end = encoding_set.end();
                        if (it != end) {
                                os << from_ascii(*it);
                                ++it;
@@ -3213,7 +3216,7 @@ void BufferParams::writeEncodingPreamble(otexstream & os,
                        for (; it != end; ++it)
                                os << ',' << from_ascii(*it);
                        if (package == Encoding::inputenc) {
-                               if (!encodings.empty())
+                               if (!encoding_set.empty())
                                        os << ',';
                                os << from_ascii(doc_encoding);
                        }
@@ -3422,6 +3425,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())