]> git.lyx.org Git - features.git/commitdiff
tex2lyx: parse \xymatrix
authorUwe Stöhr <uwestoehr@lyx.org>
Fri, 9 Mar 2018 03:53:33 +0000 (04:53 +0100)
committerRichard Heck <rgheck@lyx.org>
Sat, 7 Apr 2018 04:19:10 +0000 (00:19 -0400)
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
src/tex2lyx/text.cpp
status.23x

index d9596b6f86ce9ce9ff2690f1ae7b4d6d0ffa1e61..550b6f16b7361a4cbee7429441c9c9677e4dbc82 100644 (file)
@@ -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":
index 333bdd61be383768b29438f962c28612ba35b43e..47f5b13e6b9b74a8db28abed60518872bf79aa1a 100644 (file)
@@ -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)
index 9141412d9209cb7a621e9521a4791bfe0696980f..869cdee493d95f31419c34eebcfebfe92ddbd96b 100644 (file)
@@ -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