]> git.lyx.org Git - lyx.git/blobdiff - src/LaTeXFeatures.C
remove redundant lyxerr.debugging checks; macro LYXERR already checks whether the...
[lyx.git] / src / LaTeXFeatures.C
index 67f84b996f94b6cdbb4c04a123abffffe15e1f06..42e2a00756f4bb15c4c784e2aa081835e27e1ee8 100644 (file)
@@ -30,8 +30,8 @@
 
 #include "support/docstream.h"
 #include "support/filetools.h"
-#include <sstream>
 
+#include "frontends/controllers/biblio.h"
 
 namespace lyx {
 
@@ -77,7 +77,7 @@ void LaTeXFeatures::require(string const & name)
 void LaTeXFeatures::getAvailable()
 {
        LyXLex lex(0, 0);
-       string real_file = libFileSearch("", "packages.lst");
+       support::FileName const real_file = libFileSearch("", "packages.lst");
 
        if (real_file.empty())
                return;
@@ -105,8 +105,6 @@ void LaTeXFeatures::getAvailable()
                                packages_.push_back(name);
                }
        }
-
-       return;
 }
 
 
@@ -155,7 +153,7 @@ bool LaTeXFeatures::isRequired(string const & name) const
 }
 
 
-bool LaTeXFeatures::isAvailable(string const & name) const
+bool LaTeXFeatures::isAvailable(string const & name)
 {
        if (packages_.empty())
                getAvailable();
@@ -163,7 +161,7 @@ bool LaTeXFeatures::isAvailable(string const & name) const
 }
 
 
-void LaTeXFeatures::addExternalPreamble(string const & preamble)
+void LaTeXFeatures::addPreambleSnippet(string const & preamble)
 {
        FeaturesList::const_iterator begin = preamble_snippets_.begin();
        FeaturesList::const_iterator end   = preamble_snippets_.end();
@@ -222,7 +220,11 @@ set<string> LaTeXFeatures::getEncodingSet(string const & doc_encoding) const
        LanguageList::const_iterator it  = UsedLanguages_.begin();
        LanguageList::const_iterator end = UsedLanguages_.end();
        for (; it != end; ++it)
-               if ((*it)->encoding()->latexName() != doc_encoding)
+               // thailatex does not use the inputenc package, but sets up
+               // babel directly for tis620-0 encoding, therefore we must
+               // not add tis620-0 to the encoding set.
+               if ((*it)->encoding()->latexName() != doc_encoding &&
+                   (*it)->encoding()->name() != "tis620-0")
                        encodings.insert((*it)->encoding()->latexName());
        return encodings;
 }
@@ -248,6 +250,7 @@ char const * simplefeatures[] = {
        "nicefrac",
        "tipa",
        "framed",
+       "textcomp",
 };
 
 int const nb_simplefeatures = sizeof(simplefeatures) / sizeof(char const *);
@@ -376,7 +379,7 @@ string const LaTeXFeatures::getPackages() const
        // natbib.sty
        if (isRequired("natbib") && ! tclass.provides(LyXTextClass::natbib)) {
                packages << "\\usepackage[";
-               if (params_.cite_engine == biblio::ENGINE_NATBIB_NUMERICAL) {
+               if (params_.getEngine() == biblio::ENGINE_NATBIB_NUMERICAL) {
                        packages << "numbers";
                } else {
                        packages << "authoryear";
@@ -534,14 +537,16 @@ docstring const LaTeXFeatures::getLyXSGMLEntities() const
 docstring const LaTeXFeatures::getIncludedFiles(string const & fname) const
 {
        odocstringstream sgmlpreamble;
-       string const basename = onlyPath(fname);
+       // FIXME UNICODE
+       docstring const basename(from_utf8(onlyPath(fname)));
 
        FileMap::const_iterator end = IncludedFiles_.end();
        for (FileMap::const_iterator fi = IncludedFiles_.begin();
             fi != end; ++fi)
+               // FIXME UNICODE
                sgmlpreamble << "\n<!ENTITY " << fi->first
                             << (isSGMLFilename(fi->second) ? " SYSTEM \"" : " \"")
-                            << from_ascii(makeRelPath(fi->second, basename)) << "\">";
+                            << makeRelPath(from_utf8(fi->second), basename) << "\">";
 
        return sgmlpreamble.str();
 }