X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FLaTeXFeatures.cpp;h=8340940ef9be365760302e0eb7ca4ebd3048dcb8;hb=1acedf11da79f509da706bc8d6d2f491c9676087;hp=be4d36a258d5ae69ff5d5d9e29507bab82d2970a;hpb=c03c537a8a411adf66a368dfbb5a43fc874e6167;p=lyx.git diff --git a/src/LaTeXFeatures.cpp b/src/LaTeXFeatures.cpp index be4d36a258..8340940ef9 100644 --- a/src/LaTeXFeatures.cpp +++ b/src/LaTeXFeatures.cpp @@ -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", @@ -530,6 +529,12 @@ char const * simplefeatures[] = { "mathrsfs", "ascii", "url", + "covington", + "csquotes", + "enumitem", + "endnotes", + "ifthen", + "amsthm" }; int const nb_simplefeatures = sizeof(simplefeatures) / sizeof(char const *); @@ -542,6 +547,12 @@ string const LaTeXFeatures::getPackages() const ostringstream packages; TextClass const & tclass = params_.getTextClass(); + // FIXME: currently, we can only load packages and macros known + // to LyX. + // However, with the Require tag of layouts/custom insets, + // also inknown packages can be requested. They are silently + // swallowed now. We should change this eventually. + // // These are all the 'simple' includes. i.e // packages which we just \usepackage{package} @@ -564,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 @@ -577,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 @@ -624,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: @@ -636,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; } @@ -832,15 +852,6 @@ docstring const LaTeXFeatures::getTClassPreamble() const tcpreamble << tclass[*cit]->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(); }