X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FLaTeXFeatures.C;h=5380932443a7eb72ba229aa3c208eed49ee40e90;hb=fe390e9da1538e20eabbc98977d845295f8e563d;hp=c6e65beb99fa6434055c5752ebb3c4aad0858a7f;hpb=6a1167adab9c33e0800cf1e7b314344a21cf93fe;p=lyx.git diff --git a/src/LaTeXFeatures.C b/src/LaTeXFeatures.C index c6e65beb99..5380932443 100644 --- a/src/LaTeXFeatures.C +++ b/src/LaTeXFeatures.C @@ -10,10 +10,6 @@ #include -#ifdef __GNUG__ -#pragma implementation -#endif - #include "LaTeXFeatures.h" #include "debug.h" #include "lyx_sty.h" @@ -23,10 +19,13 @@ #include "language.h" #include "encoding.h" #include "LString.h" +#include "Lsstream.h" #include "support/filetools.h" #include "support/lstrings.h" +using namespace lyx::support; + using lyx::textclass_type; using std::endl; @@ -41,6 +40,14 @@ LaTeXFeatures::LaTeXFeatures(BufferParams const & p) {} +bool LaTeXFeatures::useBabel() const +{ + return lyxrc.language_use_babel || + bufferParams().language->lang() != lyxrc.default_language || + this->hasLanguages(); +} + + void LaTeXFeatures::require(string const & name) { if (isRequired(name)) @@ -91,10 +98,7 @@ void LaTeXFeatures::useLayout(string const & layoutname) bool LaTeXFeatures::isRequired(string const & name) const { - FeaturesList::const_iterator i = find(features.begin(), - features.end(), - name); - return i != features.end(); + return find(features.begin(), features.end(), name) != features.end(); } @@ -129,7 +133,7 @@ void LaTeXFeatures::includeFile(string const & key, string const & name) } -bool LaTeXFeatures::hasLanguages() +bool LaTeXFeatures::hasLanguages() const { return !UsedLanguages.empty(); } @@ -149,7 +153,7 @@ string LaTeXFeatures::getLanguages() const } -set LaTeXFeatures::getEncodingSet(string const & doc_encoding) +set LaTeXFeatures::getEncodingSet(string const & doc_encoding) const { set encodings; for (LanguageList::const_iterator it = @@ -174,19 +178,20 @@ char const * simplefeatures[] = { "varioref", "prettyref", "float", - "wasy" + "wasy", + "dvipost" }; -const int nb_simplefeatures = sizeof(simplefeatures) / sizeof(char const *); +int const nb_simplefeatures = sizeof(simplefeatures) / sizeof(char const *); } + string const LaTeXFeatures::getPackages() const { ostringstream packages; LyXTextClass const & tclass = params.getLyXTextClass(); - // // These are all the 'simple' includes. i.e // packages which we just \usepackage{package} @@ -203,17 +208,19 @@ string const LaTeXFeatures::getPackages() const // if (isRequired("amsmath") - && ! tclass.provides(LyXTextClass::amsmath)) { + && !tclass.provides(LyXTextClass::amsmath) + && params.use_amsmath != BufferParams::AMS_OFF) { packages << "\\usepackage{amsmath}\n"; } // color.sty if (isRequired("color")) { if (params.graphicsDriver == "default") - packages << "\\usepackage{color}\n"; + packages << "\\usepackage[usenames]{color}\n"; else packages << "\\usepackage[" << params.graphicsDriver + << ",usenames" << "]{color}\n"; } @@ -268,7 +275,7 @@ string const LaTeXFeatures::getPackages() const } // amssymb.sty - if (isRequired("amssymb") || params.use_amsmath) + if (isRequired("amssymb") || params.use_amsmath == BufferParams::AMS_ON) packages << "\\usepackage{amssymb}\n"; // url.sty if (isRequired("url") && ! tclass.provides(LyXTextClass::url)) @@ -473,10 +480,10 @@ void LaTeXFeatures::getFloatDefinitions(ostream & os) const string const name = fl.name(); os << "\\floatstyle{" << style << "}\n" << "\\newfloat{" << type << "}{" << placement - << "}{" << ext << "}"; + << "}{" << ext << '}'; if (!within.empty()) - os << "[" << within << "]"; - os << "\n" + os << '[' << within << ']'; + os << '\n' << "\\floatname{" << type << "}{" << name << "}\n";