]> git.lyx.org Git - lyx.git/blobdiff - src/output_latex.cpp
Fix the rest of bug 5010.
[lyx.git] / src / output_latex.cpp
index da12b200128fe8a483b00a1f4e652887baa22ab4..3e4d299262d7e2213ee75f8dd5dd6dbdcb04ceed 100644 (file)
@@ -700,10 +700,10 @@ TeXOnePar(Buffer const & buf,
        // the inset, and we're using "auto" or "default" encoding, the encoding
        // should be set back to that local_font's encoding.
        if (nextpit == paragraphs.end() && runparams_in.local_font != 0
+           && runparams_in.encoding != runparams_in.local_font->language()->encoding()
            && (bparams.inputenc == "auto" || bparams.inputenc == "default")) {
                runparams_in.encoding = runparams_in.local_font->language()->encoding();
                os << setEncoding(runparams_in.encoding->iconvName());
-
        }
        // Otherwise, the current encoding should be set for the next paragraph.
        else
@@ -714,8 +714,12 @@ TeXOnePar(Buffer const & buf,
        // Note from JMarc: we will re-add a \n explicitely in
        // TeXEnvironment, because it is needed in this case
        if (nextpit != paragraphs.end()) {
-               os << '\n';
-               texrow.newline();
+               Layout const & next_layout = nextpit->layout();
+               // no blank lines before environments!
+               if (!next_layout.isEnvironment() || style == next_layout) {
+                       os << '\n';
+                       texrow.newline();
+               }
        }
 
        if (nextpit != paragraphs.end())
@@ -812,10 +816,7 @@ void latexParagraphs(Buffer const & buf,
                        was_title = false;
                }
 
-               if (layout.is_environment) {
-                       par = TeXOnePar(buf, text, par, os, texrow,
-                                       runparams, everypar);
-               } else if (layout.isEnvironment() ||
+               if (layout.isEnvironment() ||
                                        !par->params().leftIndent().zero()) {
                        par = TeXEnvironment(buf, text, par, os,
                                                                texrow, runparams);