#include "Floating.h"
#include "FloatList.h"
#include "language.h"
+#include "lyxlex.h"
#include "lyx_sty.h"
#include "lyxrc.h"
#include "support/filetools.h"
-#include "support/std_sstream.h"
+#include <sstream>
using lyx::support::IsSGMLFilename;
+using lyx::support::LibFileSearch;
using lyx::support::MakeRelPath;
using lyx::support::OnlyPath;
using std::ostringstream;
using std::set;
+namespace biblio = lyx::biblio;
+
+
+LaTeXFeatures::PackagesList LaTeXFeatures::packages_;
+
LaTeXFeatures::LaTeXFeatures(Buffer const & b, BufferParams const & p, bool n)
: buffer_(&b), params_(p), nice_(n)
}
+void LaTeXFeatures::getAvailable()
+{
+ LyXLex lex(0, 0);
+ string real_file = LibFileSearch("", "packages.lst");
+
+ if (real_file.empty())
+ return;
+
+ lex.setFile(real_file);
+
+ if (!lex.isOK())
+ return;
+
+ // Make sure that we are clean
+ packages_.clear();
+
+ bool finished = false;
+ // Parse config-file
+ while (lex.isOK() && !finished) {
+ switch (lex.lex()) {
+ case LyXLex::LEX_FEOF:
+ finished = true;
+ break;
+ default:
+ string const name = lex.getString();
+ PackagesList::const_iterator begin = packages_.begin();
+ PackagesList::const_iterator end = packages_.end();
+ if (find(begin, end, name) == end)
+ packages_.push_back(name);
+ }
+ }
+
+ return;
+}
+
+
void LaTeXFeatures::useLayout(string const & layoutname)
{
// Some code to avoid loops in dependency definition
}
+bool LaTeXFeatures::isAvailable(string const & name) const
+{
+ if (packages_.empty())
+ getAvailable();
+ return find(packages_.begin(), packages_.end(), name) != packages_.end();
+}
+
+
void LaTeXFeatures::addExternalPreamble(string const & preamble)
{
FeaturesList::const_iterator begin = preamble_snippets_.begin();
cit != UsedLanguages_.end();
++cit)
languages << (*cit)->babel() << ',';
-
return languages.str();
}
"varioref",
"prettyref",
"float",
- "wasy",
+ "wasysym",
"dvipost",
"fancybox",
"calc",
- "jurabib"
};
int const nb_simplefeatures = sizeof(simplefeatures) / sizeof(char const *);
// natbib.sty
if (isRequired("natbib") && ! tclass.provides(LyXTextClass::natbib)) {
packages << "\\usepackage[";
- if (params_.use_numerical_citations) {
+ if (params_.cite_engine == biblio::ENGINE_NATBIB_NUMERICAL) {
packages << "numbers";
} else {
packages << "authoryear";
packages << "]{natbib}\n";
}
+ // jurabib -- we need version 0.6 at least.
+ if (isRequired("jurabib")) {
+ packages << "\\usepackage{jurabib}[2004/01/25]\n";
+ }
+
// bibtopic -- the dot provides the aux file naming which
// LyX can detect.
if (isRequired("bibtopic")) {
if (isRequired("lyxgreyedout"))
macros << lyxgreyedout_def;
+ if (isRequired("lyxdot"))
+ macros << lyxdot_def << '\n';
+
// floats
getFloatDefinitions(macros);