]> git.lyx.org Git - lyx.git/blobdiff - src/LaTeXFeatures.C
changelogs
[lyx.git] / src / LaTeXFeatures.C
index bd891b5b764b2b3408df0bc77a06f6f6deac638e..9545af96f45f58e16d8b4eca2682a5f3a35a23ed 100644 (file)
@@ -27,7 +27,7 @@
 
 #include "support/filetools.h"
 
-#include "support/std_sstream.h"
+#include <sstream>
 
 using lyx::support::IsSGMLFilename;
 using lyx::support::MakeRelPath;
@@ -41,9 +41,11 @@ using std::ostream;
 using std::ostringstream;
 using std::set;
 
+namespace biblio = lyx::biblio;
 
-LaTeXFeatures::LaTeXFeatures(Buffer const & b, BufferParams const & p)
-       : buffer_(b), params_(p)
+
+LaTeXFeatures::LaTeXFeatures(Buffer const & b, BufferParams const & p, bool n)
+       : buffer_(&b), params_(p), nice_(n)
 {}
 
 
@@ -158,7 +160,6 @@ string LaTeXFeatures::getLanguages() const
             cit != UsedLanguages_.end();
             ++cit)
                languages << (*cit)->babel() << ',';
-
        return languages.str();
 }
 
@@ -191,7 +192,7 @@ char const * simplefeatures[] = {
        "wasy",
        "dvipost",
        "fancybox",
-       "calc"
+       "calc",
 };
 
 int const nb_simplefeatures = sizeof(simplefeatures) / sizeof(char const *);
@@ -298,7 +299,7 @@ string const LaTeXFeatures::getPackages() 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";
@@ -306,6 +307,17 @@ string const LaTeXFeatures::getPackages() const
                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")) {
+               packages << "\\usepackage[dot]{bibtopic}\n";
+       }
+
        return packages.str();
 }
 
@@ -357,8 +369,6 @@ string const LaTeXFeatures::getMacros() const
                macros << mathcircumflex_def << '\n';
 
        // other
-       if (isRequired("NeedLyXMinipageIndent"))
-               macros << minipageindent_def;
        if (isRequired("ParagraphLeftIndent"))
                macros << paragraphleftindent_def;
        if (isRequired("NeedLyXFootnoteCode"))
@@ -372,6 +382,9 @@ string const LaTeXFeatures::getMacros() const
        if (isRequired("lyxgreyedout"))
                macros << lyxgreyedout_def;
 
+       if (isRequired("lyxdot"))
+               macros << lyxdot_def << '\n';
+
        // floats
        getFloatDefinitions(macros);
 
@@ -409,6 +422,13 @@ string const LaTeXFeatures::getTClassPreamble() const
                tcpreamble << tclass[*cit]->preamble();
        }
 
+       CharStyles::iterator cs = tclass.charstyles().begin();
+       CharStyles::iterator csend = tclass.charstyles().end();
+       for (; cs != csend; ++cs) {
+               if (isRequired(cs->name))
+                       tcpreamble << cs->preamble;
+       }
+
        return tcpreamble.str();
 }
 
@@ -453,7 +473,13 @@ void LaTeXFeatures::showStruct() const {
 
 Buffer const & LaTeXFeatures::buffer() const
 {
-       return buffer_;
+       return *buffer_;
+}
+
+
+void LaTeXFeatures::setBuffer(Buffer const & buffer)
+{
+       buffer_ = &buffer;
 }