]> git.lyx.org Git - lyx.git/blobdiff - src/BufferParams.cpp
tex2lyx: add strike-outs etc. to the TeX testfile
[lyx.git] / src / BufferParams.cpp
index c827ebd4fc030ef87f25c7eeaa6fbd523cd7a2b8..fd3c7e4411ab32693055fbb6d3320fc97d1ba60a 100644 (file)
@@ -365,6 +365,7 @@ BufferParams::BufferParams()
        use_esint = package_auto;
        use_mhchem = package_auto;
        use_mathdots = package_auto;
+       use_undertilde = package_auto;
        cite_engine_ = ENGINE_BASIC;
        use_bibtopic = false;
        use_indices = false;
@@ -686,6 +687,10 @@ string BufferParams::readToken(Lexer & lex, string const & token,
                int usemathdots;
                lex >> usemathdots;
                use_mathdots = packagetranslator().find(usemathdots);
+       } else if (token == "\\use_undertilde") {
+               int useundertilde;
+               lex >> useundertilde;
+               use_undertilde = packagetranslator().find(useundertilde);
        } else if (token == "\\cite_engine") {
                string engine;
                lex >> engine;
@@ -991,6 +996,7 @@ void BufferParams::writeFile(ostream & os) const
           << "\n\\use_esint " << use_esint
           << "\n\\use_mhchem " << use_mhchem
           << "\n\\use_mathdots " << use_mathdots
+          << "\n\\use_undertilde " << use_undertilde
           << "\n\\cite_engine " << citeenginetranslator().find(cite_engine_)
           << "\n\\use_bibtopic " << convert<string>(use_bibtopic)
           << "\n\\use_indices " << convert<string>(use_indices)
@@ -1119,6 +1125,7 @@ void BufferParams::validate(LaTeXFeatures & features) const
 
                switch (features.runparams().flavor) {
                case OutputParams::LATEX:
+               case OutputParams::DVILUATEX:
                        if (dvipost) {
                                features.require("ct-dvipost");
                                features.require("dvipost");
@@ -1162,6 +1169,8 @@ void BufferParams::validate(LaTeXFeatures & features) const
                features.require("mhchem");
        if (use_mathdots == package_on)
                features.require("mathdots");
+       if (use_undertilde == package_on)
+               features.require("undertilde");
 
        // Document-level line spacing
        if (spacing().getSpace() != Spacing::Single && !spacing().isDefault())
@@ -1215,7 +1224,7 @@ bool BufferParams::writeLaTeX(otexstream & os, LaTeXFeatures & features,
        // http://www.tug.org/texmf-dist/doc/latex/base/fixltx2e.pdf
        // !! To use the Fix-cm package, load it before \documentclass, and use the command
        // \RequirePackage to do so, rather than the normal \usepackage
-       // Do not to load any other package before the document class, unless you
+       // Do not try to load any other package before the document class, unless you
        // have a thorough understanding of the LATEX internals and know exactly what you
        // are doing!
        if (features.mustProvide("fix-cm"))
@@ -1373,7 +1382,7 @@ bool BufferParams::writeLaTeX(otexstream & os, LaTeXFeatures & features,
                          fonts_sans_scale, fonts_typewriter_scale,
                          useNonTeXFonts, features);
        if (!fonts.empty())
-               os << from_ascii(fonts);
+               os << from_utf8(fonts);
 
        if (fonts_default_family != "default")
                os << "\\renewcommand{\\familydefault}{\\"
@@ -1708,6 +1717,7 @@ bool BufferParams::writeLaTeX(otexstream & os, LaTeXFeatures & features,
 
        // Now insert the LyX specific LaTeX commands...
        docstring lyxpreamble;
+       features.resolveAlternatives();
 
        if (output_sync) {
                if (!output_sync_macro.empty())
@@ -2122,9 +2132,12 @@ vector<string> BufferParams::backends() const
        if (v.back() == "latex") {
                v.push_back("pdflatex");
                v.push_back("luatex");
+               v.push_back("dviluatex");
                v.push_back("xetex");
-       } else if (v.back() == "xetex")
+       } else if (v.back() == "xetex") {
                v.push_back("luatex");
+               v.push_back("dviluatex");
+       }
        v.push_back("xhtml");
        v.push_back("text");
        v.push_back("lyx");
@@ -2622,7 +2635,8 @@ void BufferParams::writeEncodingPreamble(otexstream & os,
                return;
        // LuaTeX neither, but with tex fonts, we need to load
        // the luainputenc package.
-       if (features.runparams().flavor == OutputParams::LUATEX) {
+       if (features.runparams().flavor == OutputParams::LUATEX
+               || features.runparams().flavor == OutputParams::DVILUATEX) {
                if (!useNonTeXFonts && inputenc != "default"
                    && ((inputenc == "auto" && language->encoding()->package() == Encoding::inputenc)
                        || (inputenc != "auto" && encoding().package() == Encoding::inputenc))) {