]> git.lyx.org Git - lyx.git/blobdiff - src/LaTeXFeatures.cpp
Fix a copy-paste error introduced in b754fb02
[lyx.git] / src / LaTeXFeatures.cpp
index a0e55981c02dd013171453260ee7454bfc7d1fdf..f1d315cae84e3341ebea09efdff2715cce1b9aeb 100644 (file)
@@ -576,6 +576,7 @@ char const * simplefeatures[] = {
        "mathrsfs",
        "mathabx",
        "mathtools",
+       "cancel",
        "ascii",
        "url",
        "covington",
@@ -769,7 +770,7 @@ string const LaTeXFeatures::getPackages() const
        // This special case is indicated by the "natbib-internal" key.
        if (mustProvide("natbib") && !tclass.provides("natbib-internal")) {
                packages << "\\usepackage[";
-               if (params_.citeEngine() == ENGINE_NATBIB_NUMERICAL)
+               if (params_.citeEngineType() == ENGINE_TYPE_NUMERICAL)
                        packages << "numbers";
                else
                        packages << "authoryear";
@@ -799,9 +800,8 @@ string const LaTeXFeatures::getPackages() const
                packages << "\\PassOptionsToPackage{normalem}{ulem}\n"
                            "\\usepackage{ulem}\n";
 
-       if (params_.use_package("mhchem") == BufferParams::package_on ||
-           (mustProvide("mhchem") &&
-            params_.use_package("mhchem") != BufferParams::package_off))
+       if (mustProvide("mhchem") &&
+           params_.use_package("mhchem") != BufferParams::package_off)
                packages << "\\PassOptionsToPackage{version=3}{mhchem}\n"
                            "\\usepackage{mhchem}\n";
 
@@ -1156,6 +1156,15 @@ docstring const getFloatI18nPreamble(docstring const & type,
                        docstring const & name, Language const * lang,
                        Encoding const & enc, bool const polyglossia)
 {
+       // Check whether name can be encoded in the buffer encoding
+       bool encodable = true;
+       for (size_t i = 0; i < name.size(); ++i) {
+               if (!enc.encodable(name[i])) {
+                       encodable = false;
+                       break;
+               }
+       }
+
        docstring const language = polyglossia ? from_ascii(lang->polyglossia())
                                               : from_ascii(lang->babel());
        docstring const langenc = from_ascii(lang->encoding()->iconvName());
@@ -1163,7 +1172,7 @@ docstring const getFloatI18nPreamble(docstring const & type,
        docstring const bufenc = from_ascii(enc.iconvName());
        docstring const s1 = docstring(1, 0xF0000);
        docstring const s2 = docstring(1, 0xF0001);
-       docstring const translated = (langenc == bufenc) ? name
+       docstring const translated = encodable ? name
                : from_ascii("\\inputencoding{") + texenc + from_ascii("}")
                        + s1 + langenc + s2 + name + s1 + bufenc + s2;