]> git.lyx.org Git - lyx.git/blobdiff - src/BufferParams.cpp
Transfer the setting of the current LyXView from workArea::focusInEvent() to GuiView...
[lyx.git] / src / BufferParams.cpp
index 785e54d2d5e432c86f7736ec3e8e27a3ed2f55ef..88115e5e2469d441c6d0aa91ae89f2c9922a9a2c 100644 (file)
@@ -439,6 +439,7 @@ Spacing const & BufferParams::spacing() const
        return pimpl_->spacing;
 }
 
+
 PDFOptions & BufferParams::pdfoptions()
 {
        return pimpl_->pdfoptions;
@@ -450,6 +451,7 @@ PDFOptions const & BufferParams::pdfoptions() const
        return pimpl_->pdfoptions;
 }
 
+
 VSpace const & BufferParams::getDefSkip() const
 {
        return pimpl_->defskip;
@@ -649,8 +651,7 @@ string const BufferParams::readToken(Lexer & lex, string const & token)
                lex >> float_placement;
 
        } else if (prefixIs(token, "\\pdf_") || token == "\\use_hyperref") {
-               string toktmp;
-               toktmp = pdfoptions().readToken(lex, token);
+               string toktmp = pdfoptions().readToken(lex, token);
                if (!toktmp.empty()) {
                        lyxerr << "PDFOptions::readToken(): Unknown token: " <<
                                toktmp << endl;
@@ -1119,6 +1120,34 @@ bool BufferParams::writeLaTeX(odocstream & os, LaTeXFeatures & features,
        // The optional packages;
        docstring lyxpreamble(from_ascii(features.getPackages()));
 
+       // We try to load babel late, in case it interferes
+       // with other packages. But some packages also need babel to be loaded
+       // before, e.g. jurabib has to be called after babel.
+       // So load babel after the optional packages but before the user-defined
+       // preamble. This allows the users to redefine babel commands, e.g. to
+       // translate the word "Index" to the German "Stichwortverzeichnis".
+       // For more infos why this place was chosen, see
+       // http://www.mail-archive.com/lyx-devel@lists.lyx.org/msg128425.html
+       // if you encounter problem, you can shift babel to its old place behind
+       // the user-defined preamble
+       if (use_babel && !features.isRequired("jurabib")) {
+               // FIXME UNICODE
+               lyxpreamble += from_utf8(babelCall(language_options.str())) + '\n';
+               lyxpreamble += from_utf8(features.getBabelOptions());
+       }
+
+       // PDF support.
+       // * Hyperref manual: "Make sure it comes last of your loaded
+       //   packages, to give it a fighting chance of not being over-written,
+       //   since its job is to redefine many LATEX commands."
+       // * Email from Heiko Oberdiek: "It is usually better to load babel
+       //   before hyperref. Then hyperref has a chance to detect babel.
+       // * Has to be loaded before the "LyX specific LaTeX commands" to
+       //   avoid errors with algorithm floats.
+       odocstringstream oss;
+       pdfoptions().writeLaTeX(oss);
+       lyxpreamble += oss.str();
+
        // this might be useful...
        lyxpreamble += "\n\\makeatletter\n";
 
@@ -1182,24 +1211,6 @@ bool BufferParams::writeLaTeX(odocstream & os, LaTeXFeatures & features,
        if (!bullets_def.empty())
                lyxpreamble += bullets_def + "}\n\n";
 
-       // We try to load babel late, in case it interferes
-       // with other packages.
-       // Jurabib has to be called after babel, though.
-       if (use_babel && !features.isRequired("jurabib")) {
-               // FIXME UNICODE
-               lyxpreamble += from_utf8(babelCall(language_options.str())) + '\n';
-               lyxpreamble += from_utf8(features.getBabelOptions());
-       }
-
-       // PDF support. Hypreref manual: "Make sure it comes last of your loaded
-       // packages, to give it a fighting chance of not being over-written,
-       // since its job is to redefine many LATEX commands."
-       // Has to be put into lyxpreamble (preserving line-counting for error
-       // parsing).
-       odocstringstream oss;
-       pdfoptions().writeLaTeX(oss);
-       lyxpreamble += oss.str();
-
        lyxpreamble += "\\makeatother\n\n";
 
        int const nlines =