commit 27e0bf54f5c9dad3c58182d3958856bdfb3fd06a
Author: Enrico Forestieri <for...@lyx.org>
Date:   Wed May 21 21:08:11 2014 +0200

    Add a required paragraph break.
    
    This is necessary, for example, if a standard paragraph is nested
    in an environment and the environment does not end immediately after.
    To be strictly correct, the layout of the following paragraph should
    be compared to the layout of the nesting environment, otherwise, if
    they are not the same, an empty line is nevertheless output. However,
    this is harmless because an "\end{layout}" tag immediately follows.

diff --git a/src/output_latex.cpp b/src/output_latex.cpp
index 1cf63fb..c862733 100644
--- a/src/output_latex.cpp
+++ b/src/output_latex.cpp
@@ -1048,9 +1048,11 @@ void TeXOnePar(Buffer const & buf,
                        // unchanged, or (case 2) the following is a
                        // non-environment paragraph whose depth is increased
                        // but whose alignment is unchanged, or (case 3) the
+                       // paragraph is not an environment and the next one is a
+                       // non-itemize-like env at lower depth, or (case 4) the
                        // paragraph is a command not followed by an environment
                        // and the alignment of the current and next paragraph
-                       // is unchanged, or (case 4) the current alignment is
+                       // is unchanged, or (case 5) the current alignment is
                        // changed and a standard paragraph follows.
                        DocumentClass const & tclass = bparams.documentClass();
                        if ((style == next_layout
@@ -1063,6 +1065,9 @@ void TeXOnePar(Buffer const & buf,
                            || (!next_layout.isEnvironment()
                                && nextpar->getDepth() > par.getDepth()
                                && nextpar->getAlign() == par.getAlign())
+                           || (!style.isEnvironment()
+                               && next_layout.latextype == LATEX_ENVIRONMENT
+                               && nextpar->getDepth() < par.getDepth())
                            || (style.isCommand()
                                && !next_layout.isEnvironment()
                                && style.align == par.getAlign()

Reply via email to