]> git.lyx.org Git - lyx.git/blobdiff - src/LaTeXFeatures.cpp
adjust
[lyx.git] / src / LaTeXFeatures.cpp
index 06f65e566b6ea0303b322bdfe946fdc61b372402..25be2c1866f151e24906f6dc61875d846780519a 100644 (file)
 #include "Floating.h"
 #include "FloatList.h"
 #include "Language.h"
+#include "Layout.h"
 #include "Lexer.h"
 #include "LyXRC.h"
 
 #include "support/docstream.h"
 #include "support/filetools.h"
 
-#include "frontends/controllers/frontend_helpers.h"
-
 using std::endl;
 using std::find;
 using std::string;
@@ -187,6 +186,20 @@ static string const changetracking_none_def =
        "\\newcommand{\\lyxadded}[3]{#3}\n"
        "\\newcommand{\\lyxdeleted}[3]{}\n";
 
+static string const textgreek_def =
+       "\\DeclareRobustCommand{\\greektext}{%\n"
+       " \\fontencoding{LGR}\\selectfont\n"
+       " \\def\\encodingdefault{LGR}}\n"
+       "\\DeclareRobustCommand{\\textgreek}[1]{\\leavevmode{\\greektext #1}}\n"
+       "\\DeclareFontEncoding{LGR}{}{}\n";
+
+static string const textcyr_def =
+       "\\DeclareRobustCommand{\\cyrtext}{%\n"
+       " \\fontencoding{T2A}\\selectfont\n"
+       " \\def\\encodingdefault{T2A}}\n"
+       "\\DeclareRobustCommand{\\textcyr}[1]{\\leavevmode{\\cyrtext #1}}\n"
+       "\\DeclareFontEncoding{T2A}{}{}\n";
+
 
 /////////////////////////////////////////////////////////////////////
 //
@@ -397,15 +410,19 @@ char const * simplefeatures[] = {
        "latexsym",
        "pifont",
        "subfigure",
-       "floatflt",
        "varioref",
        "prettyref",
+       /*For a successful cooperation of the `wrapfig' package with the
+         `float' package you should load the `wrapfig' package *after*
+         the `float' package. See the caption package documentation
+         for explanation.*/
        "float",
+       "wrapfig",
        "booktabs",
        "dvipost",
        "fancybox",
        "calc",
-       "nicefrac",
+       "units",
        "tipa",
        "framed",
        "pdfcolmk",
@@ -419,6 +436,7 @@ char const * simplefeatures[] = {
        "txfonts",
        "mathrsfs",
        "ascii",
+       "url",
 };
 
 int const nb_simplefeatures = sizeof(simplefeatures) / sizeof(char const *);
@@ -547,11 +565,6 @@ string const LaTeXFeatures::getPackages() const
            params_.use_esint != BufferParams::package_off)
                packages << "\\usepackage{esint}\n";
 
-       // url.sty
-       if (mustProvide("url"))
-               packages << "\\IfFileExists{url.sty}{\\usepackage{url}}\n"
-                           "                      {\\newcommand{\\url}{\\texttt}}\n";
-
        // natbib.sty
        if (mustProvide("natbib")) {
                packages << "\\usepackage[";
@@ -619,6 +632,12 @@ string const LaTeXFeatures::getMacros() const
        if (mustProvide("lyxarrow"))
                macros << lyxarrow_def << '\n';
 
+       if (mustProvide("textgreek"))
+               macros << textgreek_def << '\n';
+
+       if (mustProvide("textcyr"))
+               macros << textcyr_def << '\n';
+
        // quotes.
        if (mustProvide("quotesinglbase"))
                macros << quotesinglbase_def << '\n';
@@ -719,11 +738,13 @@ docstring const LaTeXFeatures::getTClassPreamble() const
                tcpreamble << tclass[*cit]->preamble();
        }
 
-       CharStyles::iterator cs = tclass.charstyles().begin();
-       CharStyles::iterator csend = tclass.charstyles().end();
-       for (; cs != csend; ++cs) {
-               if (isRequired(cs->name))
-                       tcpreamble << cs->preamble;
+       InsetLayouts const & insetlayouts = tclass.insetlayouts();
+       InsetLayouts::const_iterator cit2 = insetlayouts.begin();
+       InsetLayouts::const_iterator end2 = insetlayouts.end();
+       for (; cit2 != end2; ++cit2) {
+               if (isRequired(to_utf8(cit2->first))) {
+                       tcpreamble << from_utf8(cit2->second.preamble);
+               }
        }
 
        return tcpreamble.str();