tex2lyx: parse \xymatrix

LyX's \xymatrix support relies on math therefore put it into math and parse its content

fixes bug #10638
This commit is contained in:
Uwe Stöhr 2018-03-09 04:53:33 +01:00
parent 848462a139
commit 1174279967
2 changed files with 13 additions and 1 deletions

View File

@ -705,7 +705,6 @@ $$
\vspace{} \vspace{}
\vspace*{} \vspace*{}
\whiledo{}{} \whiledo{}{}
\xymatrix{} % this is basically an array => the contents would be parsed badly (bug 8396)
% LaTeX environments. % LaTeX environments.
% They have always one extra "argument": % They have always one extra "argument":

View File

@ -3267,6 +3267,19 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer,
continue; 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") { if (t.cs() == "includegraphics") {
bool const clip = p.next_token().asInput() == "*"; bool const clip = p.next_token().asInput() == "*";
if (clip) if (clip)