X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FBufferParams.cpp;h=15de3388d682a3e6bd4d66395585f1a9f6787cb1;hb=854e7151e3c84773fb5afda141678f5dc05277db;hp=22e84778fe0313f3fc5c6e257e6dc217bb868895;hpb=e30f3d76d2bee0011ceaeb5f0cc221156458cbad;p=lyx.git diff --git a/src/BufferParams.cpp b/src/BufferParams.cpp index 22e84778fe..15de3388d6 100644 --- a/src/BufferParams.cpp +++ b/src/BufferParams.cpp @@ -459,6 +459,7 @@ BufferParams::BufferParams() html_css_as_file = false; display_pixel_ratio = 1.0; + shell_escape = false; output_sync = false; use_refstyle = true; use_minted = false; @@ -2049,13 +2050,12 @@ bool BufferParams::writeLaTeX(otexstream & os, LaTeXFeatures & features, // http://www.mail-archive.com/lyx-devel@lists.lyx.org/msg144349.html os << from_ascii(features.getColorOptions()); - // If we use hyperref, jurabib, japanese, varioref or vietnamese, + // If we use hyperref, jurabib, japanese or varioref, // we have to call babel before if (use_babel && (features.isRequired("jurabib") || features.isRequired("hyperref") || features.isRequired("varioref") - || features.isRequired("vietnamese") || features.isRequired("japanese"))) { os << features.getBabelPresettings(); // FIXME UNICODE @@ -2251,8 +2251,7 @@ bool BufferParams::writeLaTeX(otexstream & os, LaTeXFeatures & features, // called after babel, though. if (use_babel && !features.isRequired("jurabib") && !features.isRequired("hyperref") - && !features.isRequired("varioref") - && !features.isRequired("vietnamese") + && !features.isRequired("varioref") && !features.isRequired("japanese")) { os << features.getBabelPresettings(); // FIXME UNICODE @@ -2287,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) { @@ -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"; @@ -2622,8 +2626,16 @@ vector 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"); @@ -2666,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::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; } @@ -2688,14 +2699,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; @@ -3182,21 +3194,21 @@ void BufferParams::writeEncodingPreamble(otexstream & os, language->encoding()->package(); // Create list of inputenc options: - set encodings; + set 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::const_iterator it = encodings.begin(); - set::const_iterator const end = encodings.end(); + set::const_iterator it = encoding_set.begin(); + set::const_iterator const end = encoding_set.end(); if (it != end) { os << from_ascii(*it); ++it; @@ -3204,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); }