]> git.lyx.org Git - lyx.git/blobdiff - src/BufferParams.cpp
Fix compilation on win
[lyx.git] / src / BufferParams.cpp
index 929489139c49c3ee16222b8f383dd1ac84102353..2dd4817e3e541fae1db1aedee68ac0a8683c1ab3 100644 (file)
@@ -355,6 +355,8 @@ BufferParams::BufferParams()
        inputenc = "auto";
        graphicsDriver = "default";
        defaultOutputFormat = "default";
+       bibtex_command = "default";
+       index_command = "default";
        sides = OneSide;
        columns = 1;
        listings_params = string();
@@ -531,6 +533,12 @@ string BufferParams::readToken(Lexer & lex, string const & token,
                readGraphicsDriver(lex);
        } else if (token == "\\default_output_format") {
                lex >> defaultOutputFormat;
+       } else if (token == "\\bibtex_command") {
+               lex.eatLine();
+               bibtex_command = lex.getString();
+       } else if (token == "\\index_command") {
+               lex.eatLine();
+               index_command = lex.getString();
        } else if (token == "\\font_roman") {
                lex.eatLine();
                fontsRoman = lex.getString();
@@ -813,6 +821,8 @@ void BufferParams::writeFile(ostream & os) const
        }
        os << "\n\\graphics " << graphicsDriver << '\n';
        os << "\\default_output_format " << defaultOutputFormat << '\n';
+       os << "\\bibtex_command " << bibtex_command << '\n';
+       os << "\\index_command " << index_command << '\n';
 
        if (!float_placement.empty()) {
                os << "\\float_placement " << float_placement << '\n';
@@ -1176,7 +1186,7 @@ bool BufferParams::writeLaTeX(odocstream & os, LaTeXFeatures & features,
        // this one is not per buffer
        // for arabic_arabi and farsi we also need to load the LAE and
        // LFE encoding
-       // XeteX works without fontenc
+       // XeTeX works without fontenc
        if (lyxrc.fontenc != "default" && language->lang() != "japanese"
            && !useXetex) {
                if (language->lang() == "arabic_arabi"
@@ -1435,7 +1445,7 @@ bool BufferParams::writeLaTeX(odocstream & os, LaTeXFeatures & features,
                lyxpreamble += oss.str();
        }
        
-       // Will be surrounded by \makeatletter and \makeatother when needed
+       // Will be surrounded by \makeatletter and \makeatother when not empty
        docstring atlyxpreamble;
 
        // Some macros LyX will need
@@ -1454,7 +1464,7 @@ bool BufferParams::writeLaTeX(odocstream & os, LaTeXFeatures & features,
                        + tmppreamble + '\n';
 
        /* the user-defined preamble */
-       if (!preamble.empty())
+       if (!containsOnly(preamble, " \n\t"))
                // FIXME UNICODE
                atlyxpreamble += "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% "
                        "User specified LaTeX commands.\n"
@@ -1511,11 +1521,9 @@ bool BufferParams::writeLaTeX(odocstream & os, LaTeXFeatures & features,
        if (!bullets_def.empty())
                atlyxpreamble += bullets_def + "}\n\n";
 
-       if (atlyxpreamble.find(from_ascii("@")) != docstring::npos)
+       if (!atlyxpreamble.empty())
                lyxpreamble += "\n\\makeatletter\n"
                        + atlyxpreamble + "\\makeatother\n\n";
-       else
-               lyxpreamble += '\n' + atlyxpreamble;
 
        // We try to load babel late, in case it interferes with other packages.
        // Jurabib and Hyperref have to be called after babel, though.