commit c690e8880b0f889a6b123c8d762a1f0e4da54707
Author: Uwe Stöhr <uwesto...@lyx.org>
Date:   Fri Mar 9 04:53:33 2018 +0100

    tex2lyx: parse \xymatrix
    
    LyX's \xymatrix support relies on math therefore put it into math and parse 
its content
    
    fixes bug #10638
    
    (cherry picked from commit 1174279967c4ee369d9de1438f18b7e5c748b127)
---
 lib/syntax.default   |    1 -
 src/tex2lyx/text.cpp |   13 +++++++++++++
 status.23x           |    2 ++
 3 files changed, 15 insertions(+), 1 deletions(-)

diff --git a/lib/syntax.default b/lib/syntax.default
index d9596b6..550b6f1 100644
--- a/lib/syntax.default
+++ b/lib/syntax.default
@@ -705,7 +705,6 @@ $$
 \vspace{}
 \vspace*{}
 \whiledo{}{}
-\xymatrix{} % this is basically an array => the contents would be parsed badly 
(bug 8396)
 
 % LaTeX environments.
 % They have always one extra "argument":
diff --git a/src/tex2lyx/text.cpp b/src/tex2lyx/text.cpp
index 333bdd6..47f5b13 100644
--- a/src/tex2lyx/text.cpp
+++ b/src/tex2lyx/text.cpp
@@ -3407,6 +3407,19 @@ void parse_text(Parser & p, ostream & os, unsigned 
flags, bool outer,
                        continue;
                }
 
+               if (t.cs() == "xymatrix") {
+                       // we must open a new math because LyX's xy support is 
in math
+                       context.check_layout(os);
+                       begin_inset(os, "Formula ");
+                       os << '$';
+                       os << "\\" << t.cs() << '{';
+                       parse_math(p, os, FLAG_ITEM, MATH_MODE);
+                       os << '}' << '$';
+                       end_inset(os);
+                       preamble.registerAutomaticallyLoadedPackage("xy");
+                       continue;
+               }
+
                if (t.cs() == "includegraphics") {
                        bool const clip = p.next_token().asInput() == "*";
                        if (clip)
diff --git a/status.23x b/status.23x
index 9141412..869cdee 100644
--- a/status.23x
+++ b/status.23x
@@ -163,6 +163,8 @@ What's new
 
 - Fix import of package options with comments (bug 5737).
 
+- Fix import of xymatrix (bug 10638).
+
 
 * ADVANCED FIND AND REPLACE
 

Reply via email to