]> git.lyx.org Git - lyx.git/blobdiff - src/LaTeXFeatures.cpp
restore comment about boost::shared_ptr and dtor.
[lyx.git] / src / LaTeXFeatures.cpp
index 7bd0944d3e6156c95e28626c0123c1234a45a0af..8e0b42e63b97ede8311b09ed519aaa9812820fc4 100644 (file)
@@ -382,7 +382,7 @@ void LaTeXFeatures::useLayout(docstring const & layoutname)
                    != usedLayouts_.end())
                        return;
 
-               Layout const & layout = *tclass[layoutname];
+               Layout const & layout = tclass[layoutname];
                require(layout.requires());
 
                if (!layout.depends_on().empty()) {
@@ -433,9 +433,12 @@ void LaTeXFeatures::addPreambleSnippet(string const & preamble)
 }
 
 
-void LaTeXFeatures::useFloat(string const & name)
+void LaTeXFeatures::useFloat(string const & name, bool subfloat)
 {
-       usedFloats_.insert(name);
+       if (!usedFloats_[name])
+               usedFloats_[name] = subfloat;
+       if (subfloat)
+               require("subfig");
        // We only need float.sty if we use non builtin floats, or if we
        // use the "H" modifier. This includes modified table and
        // figure floats. (Lgb)
@@ -510,7 +513,7 @@ char const * simplefeatures[] = {
        "rotating",
        "latexsym",
        "pifont",
-       "subfigure",
+       "subfig",
        "varioref",
        "prettyref",
        /*For a successful cooperation of the `wrapfig' package with the
@@ -544,7 +547,8 @@ char const * simplefeatures[] = {
        "endnotes",
        "ifthen",
        "amsthm",
-       "listings"
+       "listings",
+       "bm"
 };
 
 int const nb_simplefeatures = sizeof(simplefeatures) / sizeof(char const *);
@@ -836,7 +840,7 @@ docstring const LaTeXFeatures::getTClassPreamble() const
        list<docstring>::const_iterator cit = usedLayouts_.begin();
        list<docstring>::const_iterator end = usedLayouts_.end();
        for (; cit != end; ++cit) {
-               tcpreamble << tclass[*cit]->preamble();
+               tcpreamble << tclass[*cit].preamble();
        }
 
        return tcpreamble.str();
@@ -914,7 +918,7 @@ void LaTeXFeatures::getFloatDefinitions(ostream & os) const
        UsedFloats::const_iterator end = usedFloats_.end();
        // ostringstream floats;
        for (; cit != end; ++cit) {
-               Floating const & fl = floats.getType((*cit));
+               Floating const & fl = floats.getType((cit->first));
 
                // For builtin floats we do nothing.
                if (fl.builtin()) continue;
@@ -959,6 +963,8 @@ void LaTeXFeatures::getFloatDefinitions(ostream & os) const
                        // used several times, when the same style is still in
                        // effect. (Lgb)
                }
+               if (cit->second)
+                       os << "\n\\newsubfloat{" << fl.type() << "}\n";
        }
 }