]> git.lyx.org Git - lyx.git/blobdiff - src/LaTeXFeatures.cpp
* src/frontends/GuiDocument.{cpp,h}:
[lyx.git] / src / LaTeXFeatures.cpp
index 887651d4c58b96206c18b9c8f1a971445aa55688..8340940ef9be365760302e0eb7ca4ebd3048dcb8 100644 (file)
@@ -510,6 +510,7 @@ char const * simplefeatures[] = {
          the `float' package. See the caption package documentation
          for explanation.*/
        "float",
+       "rotfloat",
        "wrapfig",
        "booktabs",
        "dvipost",
@@ -518,10 +519,8 @@ char const * simplefeatures[] = {
        "units",
        "tipa",
        "framed",
-       "pdfcolmk",
        "soul",
        "textcomp",
-       "xcolor",
        "pmboxdraw",
        "bbding",
        "ifsym",
@@ -533,7 +532,9 @@ char const * simplefeatures[] = {
        "covington",
        "csquotes",
        "enumitem",
-       "endnotes"
+       "endnotes",
+       "ifthen",
+       "amsthm"
 };
 
 int const nb_simplefeatures = sizeof(simplefeatures) / sizeof(char const *);
@@ -574,7 +575,7 @@ string const LaTeXFeatures::getPackages() const
             params_.use_esint == BufferParams::package_off)) {
                packages << "\\usepackage{amsmath}\n";
        }
-
+       
        // wasysym is a simple feature, but it must be after amsmath if both
        // are used
        // wasysym redefines some integrals (e.g. iint) from amsmath. That
@@ -587,14 +588,21 @@ string const LaTeXFeatures::getPackages() const
            (params_.use_esint != BufferParams::package_off || !isRequired("esint")))
                packages << "\\usepackage{wasysym}\n";
 
-       // color.sty
-       if (mustProvide("color")) {
+       // [x]color.sty
+       if (mustProvide("color") || mustProvide("xcolor")) {
+               string const package =
+                       (mustProvide("xcolor") ? "xcolor" : "color");
                if (params_.graphicsDriver == "default")
-                       packages << "\\usepackage{color}\n";
+                       packages << "\\usepackage{" << package << "}\n";
                else
                        packages << "\\usepackage["
                                 << params_.graphicsDriver
-                                << "]{color}\n";
+                                << "]{" << package << "}\n";
+       }
+
+       // pdfcolmk must be loaded after color
+       if (mustProvide("pdfcolmk")) {
+               packages << "\\usepackage{pdfcolmk}\n";
        }
 
        // makeidx.sty
@@ -634,11 +642,13 @@ string const LaTeXFeatures::getPackages() const
        }
 
        // setspace.sty
-       if ((params_.spacing().getSpace() != Spacing::Single
-            && !params_.spacing().isDefault())
-           || isRequired("setspace")) {
-               packages << "\\usepackage{setspace}\n";
+       if ((isRequired("setspace") 
+            || ((params_.spacing().getSpace() != Spacing::Single
+                 && !params_.spacing().isDefault())))
+           && !tclass.provides("SetSpace")) {
+                   packages << "\\usepackage{setspace}\n";
        }
+       bool const upcase = tclass.provides("SetSpace");
        switch (params_.spacing().getSpace()) {
        case Spacing::Default:
        case Spacing::Single:
@@ -646,13 +656,13 @@ string const LaTeXFeatures::getPackages() const
                //packages += "\\singlespacing\n";
                break;
        case Spacing::Onehalf:
-               packages << "\\onehalfspacing\n";
+               packages << (upcase ? "\\OnehalfSpacing\n" : "\\onehalfspacing\n");
                break;
        case Spacing::Double:
-               packages << "\\doublespacing\n";
+               packages << (upcase ? "\\DoubleSpacing\n" : "\\doublespacing\n");
                break;
        case Spacing::Other:
-               packages << "\\setstretch{"
+               packages << (upcase ? "\\setSingleSpace{" : "\\setstretch{")
                         << params_.spacing().getValue() << "}\n";
                break;
        }