commit 30cb99503f21c123976f968d61484632d93353e4
Author: Juergen Spitzmueller <sp...@lyx.org>
Date:   Tue Mar 6 17:54:32 2018 +0100

    tex2lyx: support alignment pseudo-environments.
    
    Fixes: #7857
    (cherry picked from commit 7a22ce7c09f54ca70f30dde05c3f77c478195e45)
---
 src/tex2lyx/text.cpp |   14 ++++++++++----
 status.23x           |    3 +++
 2 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/src/tex2lyx/text.cpp b/src/tex2lyx/text.cpp
index 5fd4f0a..914b42c 100644
--- a/src/tex2lyx/text.cpp
+++ b/src/tex2lyx/text.cpp
@@ -1896,12 +1896,18 @@ void parse_environment(Parser & p, ostream & os, bool 
outer,
        // Alignment and spacing settings
        // FIXME (bug xxxx): These settings can span multiple paragraphs and
        //                                       therefore are totally broken!
-       // Note that \centering, raggedright, and raggedleft cannot be handled, 
as
+       // Note that \centering, \raggedright, and \raggedleft cannot be 
handled, as
        // they are commands not environments. They are furthermore switches 
that
        // can be ended by another switches, but also by commands like 
\footnote or
        // \parbox. So the only safe way is to leave them untouched.
+       // However, we support the pseudo-environments
+       // \begin{centering} ... \end{centering}
+       // \begin{raggedright} ... \end{raggedright}
+       // \begin{raggedleft} ... \end{raggedleft}
+       // since they are used by LyX in floats (for spacing reasons)
        else if (name == "center" || name == "centering" ||
-                name == "flushleft" || name == "flushright" ||
+                name == "flushleft" || name == "raggedright" ||
+                name == "flushright" || name == "raggedleft" ||
                 name == "singlespace" || name == "onehalfspace" ||
                 name == "doublespace" || name == "spacing") {
                eat_whitespace(p, os, parent_context, false);
@@ -1910,9 +1916,9 @@ void parse_environment(Parser & p, ostream & os, bool 
outer,
                        parent_context.check_end_layout(os);
                        parent_context.new_paragraph(os);
                }
-               if (name == "flushleft")
+               if (name == "flushleft" || name == "raggedright")
                        parent_context.add_extra_stuff("\\align left\n");
-               else if (name == "flushright")
+               else if (name == "flushright" || name == "raggedleft")
                        parent_context.add_extra_stuff("\\align right\n");
                else if (name == "center" || name == "centering")
                        parent_context.add_extra_stuff("\\align center\n");
diff --git a/status.23x b/status.23x
index 715c252..ed12ee8 100644
--- a/status.23x
+++ b/status.23x
@@ -107,6 +107,9 @@ What's new
 
 - Add support for biblatex.
 
+- Add support for alignment pseudo-environments as used inside floats
+  (bug 7857).
+
 
 * ADVANCED FIND AND REPLACE
 

Reply via email to