]> git.lyx.org Git - lyx.git/blobdiff - src/LaTeXFeatures.cpp
Ignore ligature breaks and hyphenations during simple search (fixes #1468).
[lyx.git] / src / LaTeXFeatures.cpp
index 10d9ecd935437223d3ed082eaf941e6680006996..c6516995c9b4d0cbb9742e32f1db6e2680890e0c 100644 (file)
@@ -257,11 +257,15 @@ static docstring const ogonek_def = from_ascii(
        "\\newcommand{\\ogonek}[1]{\\mathpalette\\doogonek{#1}}\n");
 
 static docstring const lyxref_def = from_ascii(
-               "\\makeatletter\n"
-               "\\RS@ifundefined{\thmref}\n"
+               "\\RS@ifundefined{subref}\n"
+               "  {\\def\\RSsubtxt{section~}\\newref{sub}{name = \\RSsubtxt}}\n" 
+               "  {}\n"
+               "\\RS@ifundefined{thmref}\n"
                "  {\\def\\RSthmtxt{theorem~}\\newref{thm}{name = \\RSthmtxt}}\n" 
                "  {}\n"
-               "\\makeatother\n");
+               "\\RS@ifundefined{lemref}\n"
+               "  {\\def\\RSlemtxt{lemma~}\\newref{lem}{name = \\RSlemtxt}}\n" 
+               "  {}\n");
 
 
 /////////////////////////////////////////////////////////////////////
@@ -281,10 +285,10 @@ LaTeXFeatures::LaTeXFeatures(Buffer const & b, BufferParams const & p,
 
 bool LaTeXFeatures::useBabel() const
 {
-       return lyxrc.language_use_babel ||
-               (bufferParams().language->lang() != lyxrc.default_language &&
+       return (lyxrc.language_package_selection != LyXRC::LP_NONE) &&
+               ((bufferParams().language->lang() != lyxrc.default_language &&
                 !bufferParams().language->babel().empty()) ||
-               this->hasLanguages();
+               this->hasLanguages());
 }
 
 
@@ -533,6 +537,7 @@ char const * simplefeatures[] = {
        "framed",
        "soul",
        "textcomp",
+       "subscript",
        "pmboxdraw",
        "bbding",
        "ifsym",
@@ -552,7 +557,8 @@ char const * simplefeatures[] = {
        "pdfpages",
        "amscd",
        "slashed",
-       "multirow"
+       "multirow",
+       "tfrupee"
 };
 
 int const nb_simplefeatures = sizeof(simplefeatures) / sizeof(char const *);
@@ -628,7 +634,7 @@ string const LaTeXFeatures::getPackages() const
        // FIXME: currently, we can only load packages and macros known
        // to LyX.
        // However, with the Require tag of layouts/custom insets,
-       // also inknown packages can be requested. They are silently
+       // also unknown packages can be requested. They are silently
        // swallowed now. We should change this eventually.
 
        //
@@ -762,8 +768,9 @@ string const LaTeXFeatures::getPackages() const
                packages << "\\PassOptionsToPackage{normalem}{ulem}\n"
                            "\\usepackage{ulem}\n";
 
-       if (mustProvide("mhchem") &&
-               params_.use_mhchem != BufferParams::package_off)
+       if (params_.use_mhchem == BufferParams::package_on ||
+           (mustProvide("mhchem") &&
+            params_.use_mhchem != BufferParams::package_off))
                packages << "\\PassOptionsToPackage{version=3}{mhchem}\n"
                            "\\usepackage{mhchem}\n";
 
@@ -918,7 +925,7 @@ docstring const LaTeXFeatures::getMacros() const
                macros << changetracking_dvipost_def;
        
        if (mustProvide("ct-xcolor-ulem")) {
-               int const prec = macros.precision(2);
+               streamsize const prec = macros.precision(2);
        
                RGBColor cadd = rgbFromHexName(lcolor.getX11Name(Color_addedtext));
                macros << "\\providecolor{lyxadded}{rgb}{"
@@ -943,22 +950,53 @@ docstring const LaTeXFeatures::getMacros() const
 }
 
 
-string const LaTeXFeatures::getBabelOptions() const
+string const LaTeXFeatures::getBabelPresettings() const
+{
+       ostringstream tmp;
+
+       LanguageList::const_iterator it  = UsedLanguages_.begin();
+       LanguageList::const_iterator end = UsedLanguages_.end();
+       for (; it != end; ++it)
+               if (!(*it)->babel_presettings().empty())
+                       tmp << (*it)->babel_presettings() << '\n';
+       if (!params_.language->babel_presettings().empty())
+               tmp << params_.language->babel_presettings() << '\n';
+
+       return tmp.str();
+}
+
+
+string const LaTeXFeatures::getBabelPostsettings() const
 {
        ostringstream tmp;
 
        LanguageList::const_iterator it  = UsedLanguages_.begin();
-       LanguageList::const_iterator end =  UsedLanguages_.end();
+       LanguageList::const_iterator end = UsedLanguages_.end();
        for (; it != end; ++it)
-               if (!(*it)->latex_options().empty())
-                       tmp << (*it)->latex_options() << '\n';
-       if (!params_.language->latex_options().empty())
-               tmp << params_.language->latex_options() << '\n';
+               if (!(*it)->babel_postsettings().empty())
+                       tmp << (*it)->babel_postsettings() << '\n';
+       if (!params_.language->babel_postsettings().empty())
+               tmp << params_.language->babel_postsettings() << '\n';
 
        return tmp.str();
 }
 
 
+bool LaTeXFeatures::needBabelLangOptions() const
+{
+       if (!lyxrc.language_global_options || params_.language->asBabelOptions())
+               return true;
+
+       LanguageList::const_iterator it  = UsedLanguages_.begin();
+       LanguageList::const_iterator end = UsedLanguages_.end();
+       for (; it != end; ++it)
+               if ((*it)->asBabelOptions())
+                       return true;
+
+       return false;
+}
+
+
 docstring const LaTeXFeatures::getTClassPreamble() const
 {
        // the text class specific preamble