]> git.lyx.org Git - lyx.git/blobdiff - src/BufferParams.cpp
Update stats display if a stat is (un)selected
[lyx.git] / src / BufferParams.cpp
index e62d0100c8e6094f1b5424d653766ddda3ecf6c1..d25dd05bac2e55da31f0afe52be4446e7a0e0fb1 100644 (file)
@@ -2191,7 +2191,7 @@ bool BufferParams::writeLaTeX(otexstream & os, LaTeXFeatures & features,
                        os << from_utf8(output_sync_macro) +"\n";
                else if (features.runparams().flavor == Flavor::LaTeX)
                        os << "\\usepackage[active]{srcltx}\n";
-               else if (features.runparams().flavor == Flavor::PdfLaTeX)
+               else
                        os << "\\synctex=-1\n";
        }
 
@@ -3440,8 +3440,20 @@ void BufferParams::writeEncodingPreamble(otexstream & os,
                        if (features.isRequired("japanese")
                            || features.isProvided("inputenc"))
                                break;
-                       os << "\\usepackage[" << from_ascii(encoding().latexName());
-                       if (features.runparams().flavor == Flavor::LuaTeX
+                       string const doc_encoding = encoding().latexName();
+                       // The 2022 release of ucs.sty uses the default utf8
+                       // inputenc encoding with 'utf8x' inputenc if the ucs
+                       // package is not loaded before inputenc.
+                       // This breaks existing documents that use utf8x
+                       // and also makes utf8x redundant.
+                       // Thus we load ucs.sty in order to keep functionality
+                       // that would otherwise be silently dropped.
+                       if (doc_encoding == "utf8x"
+                           && features.isAvailable("ucs-2022/08/07")
+                           && !features.isProvided("ucs"))
+                               os << "\\usepackage{ucs}\n";
+                       os << "\\usepackage[" << from_ascii(doc_encoding);
+                       if (features.runparams().flavor == Flavor::LuaTeX
                            || features.runparams().flavor == Flavor::DviLuaTeX)
                                os << "]{luainputenc}\n";
                        else