]> git.lyx.org Git - lyx.git/blobdiff - src/LaTeXFeatures.C
Fix small bug in reading \set_color in lyxrc
[lyx.git] / src / LaTeXFeatures.C
index 61dd8a821c805cd042ae91892a89d603fc88b45e..c7172bfa5577ea7c6d09f4bd6c8f9bfd8e5bc766 100644 (file)
@@ -29,6 +29,7 @@ LaTeXFeatures::LaTeXFeatures(BufferParams const & p, int n)
        : layout(n, false), params(p)
 {
        // packages
+       array = false;
        color = false;
        graphics = false;
        setspace = false;
@@ -73,7 +74,9 @@ LaTeXFeatures::LaTeXFeatures(BufferParams const & p, int n)
 }
 
 void LaTeXFeatures::require(string const & name) {
-       if (name == "color") {
+       if (name == "array") {
+               array = true;
+       } else if (name == "color") {
                color = true;
        } else if (name == "graphics") {
 #ifdef USE_GRAPHICX
@@ -126,6 +129,10 @@ string LaTeXFeatures::getPackages()
        LyXTextClass const & tclass =
                textclasslist.TextClass(params.textclass);
 
+       // array-package
+       if (array)
+               packages += "\\usepackage{array}\n";
+
        // color.sty
        if (color) {
                if (params.graphicsDriver == "default")
@@ -245,6 +252,13 @@ string LaTeXFeatures::getPackages()
        if (prettyref)
                packages += "\\usepackage{prettyref}\n";
 
+       // float.sty
+       // This is not correct and needs fixing.
+       // We don't need float.sty if we only use unchanged
+       // table and figure floats. (Lgb)
+       if (!usedFloats.empty())
+               packages += "\\usepackage{float}\n";
+       
        packages += externalPreambles;
 
        return packages;
@@ -298,6 +312,12 @@ string LaTeXFeatures::getMacros()
         if (NeedLyXFootnoteCode) 
                macros += floatingfootnote_def;
 
+       // floats
+       // Here we will output the code to create the needed float styles.
+       // We will try to do this as minimal as possible.
+       // \floatstyle{ruled}
+       // \newfloat{algorithm}{htbp}{loa}
+       // \floatname{algorithm}{Algorithm}
        return macros;
 }
 
@@ -319,6 +339,17 @@ string LaTeXFeatures::getTClassPreamble()
 }      
 
 
+string LaTeXFeatures::getIncludedFiles()
+{
+       string sgmlpreamble;
+
+       for(FileMap::const_iterator fi=IncludedFiles.begin(); fi != IncludedFiles.end(); ++fi)
+               sgmlpreamble += "\n<!entity " + fi->first + " system \"" + fi->second + "\">";
+
+       return sgmlpreamble;
+}
+
+
 void LaTeXFeatures::showStruct() {
        lyxerr << "LyX needs the following commands when LaTeXing:"
               << "\n***** Packages:" << getPackages()