]> git.lyx.org Git - lyx.git/blobdiff - src/LaTeXFeatures.cpp
Finds formatted matches in the middle of paragraphs, when no regular expressions...
[lyx.git] / src / LaTeXFeatures.cpp
index 1bf3b2eddd737072900dfcc18fe920f946ffa786..08917b56649c5bfa03d954e70413ebd523c9965b 100644 (file)
@@ -257,14 +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{subref}\n"
+               "  {\\def\\RSsubtxt{section~}\\newref{sub}{name = \\RSsubtxt}}\n" 
+               "  {}\n"
                "\\RS@ifundefined{thmref}\n"
                "  {\\def\\RSthmtxt{theorem~}\\newref{thm}{name = \\RSthmtxt}}\n" 
                "  {}\n"
                "\\RS@ifundefined{lemref}\n"
                "  {\\def\\RSlemtxt{lemma~}\\newref{lem}{name = \\RSlemtxt}}\n" 
-               "  {}\n"
-               "\\makeatother\n");
+               "  {}\n");
 
 
 /////////////////////////////////////////////////////////////////////
@@ -284,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());
 }
 
 
@@ -555,7 +556,8 @@ char const * simplefeatures[] = {
        "pdfpages",
        "amscd",
        "slashed",
-       "multirow"
+       "multirow",
+       "tfrupee"
 };
 
 int const nb_simplefeatures = sizeof(simplefeatures) / sizeof(char const *);
@@ -921,7 +923,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}{"
@@ -946,22 +948,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();
+       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_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();
+       for (; it != end; ++it)
+               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