Opened 18 years ago

Closed 14 years ago

#2238 closed enhancement (fixed)

\xymatrix support in mathed

Reported by: Georg Baum Owned by: poenitz
Priority: normal Milestone:
Component: mathed Version: 1.4.0cvs
Severity: normal Keywords:
Cc: Juergen Spitzmueller, Vincent van Ravesteijn, Uwe Stöhr

Description (last modified by Uwe Stöhr)

LyX 1.3.x contains limited support for \xymatrix, e.g. things like

\xymatrix{A\ar[d]^f \\ B}

work. More advanced constructs like

\xymatrix{A\ar[d]^(0.2)f \\ B} 

and

\xymatrix@R=3cm{A\ar[d]^f \\ B} 

don't work. I don't know why this limited support was removed (OK, it is buggy,
but it is still better than nothing). We should read it for 1.4.1.

Attachments (2)

2238-2.diff (5.1 KB ) - added by Georg Baum 18 years ago.
patch that actually works
2238.diff (5.3 KB ) - added by Georg Baum 18 years ago.
partial fix

Download all attachments as: .zip

Change History (22)

comment:1 by Georg Baum, 18 years ago

Keywords: regression added
Milestone: 1.4.1

comment:2 by Georg Baum, 18 years ago

Keywords: patch added

comment:3 by Georg Baum, 18 years ago

Keywords: dataloss added

I forgot to say that current svn LyX will silently through away every row but
the first of an xymatrix, e.g. the B in the example above.

comment:4 by stacia@…, 18 years ago

Please readd the support for 1.4, even if it is broken. At least give us the option to turn it on and off. I found out a way to get linguistic information to preview using xymatrix (see #325 ) so it's now very important to me!

by Georg Baum, 18 years ago

Attachment: 2238.diff added

patch that actually works

comment:5 by Georg Baum, 18 years ago

attachments.isobsolete: 01

comment:6 by Juergen Spitzmueller, 18 years ago

Cc: j.spitzmueller@… added

I tested the patch intensely now, by trying the examples of H. Peter Gumm and
Stacia. Basically, everything works in 1.4 (with the patch) as well. However,
there are two issues I detected:

  1. The following thing is parsed differently when entered in 1.3 and 1.4 and

then C-M:
\xymatrix{

U \ar@/_{1pc}/[ddr]_\psi\ar@/{1pc}/[drr]\varphi

\ar@{.>}[dr]{(x,y)}

& X \times_Z Y \ar[d]q \ar[r]_p & X \ar[d]_f
& Y \ar[r]
g & Z }

In 1.4, the first cell is swallowed, thus the output is wrong. Note, however,
that a document from 1.3 with this construct loads fine.

  1. H. Peter Gumm's manual [1] does not compile in 1.4, as opposed to 1.3,

because of one construct. The error message is:
! Undefined control sequence.
<argument> \text

{{horizontal stretch}}

l.713 C\ar@{}[ur]|{\text{{horizontal stretch}}}}

The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., \hobx'), type I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

[1] http://www.mathematik.uni-marburg.de/~gumm/LyX/xypic/xypic.lyx

comment:7 by Juergen Spitzmueller, 18 years ago

I forgot to mention that the following

\xymatrix{\text{\Tree[.S [.N This ] [.V is ] [.NP [.Det a ] [.N test ] ] ] } }

is parsed correctly in 1.3 (if the appropriate package qtree.sty is installed
and loaded), while in 1.4, C-M pushes it into nowhere.

It looks like \text is broken.

comment:8 by Lars Gullik Bjønnes, 18 years ago

Milestone: 1.4.11.4.0

Let's aim on getting this into 1.4.0.

comment:9 by stacia@…, 18 years ago

Yay, looking forward to the support in 1.4. Anyway I have a question - or request I guess. Is there something you can do right now to display all the instant preview equations and trees in a document? I've found that if I have a document with lots of trees and so on and then go back to it, they'll all not show up until I click on them all individually. Is this a hidden feature somewhere or could it be added?

comment:10 by Georg Baum, 18 years ago

\text is not broken. It is the \Tree command that does not work (also in
unpatched 1.4). I'll get the following on the console if I select from \Tree to
the last bracket:

Line ~0: Math parse error: something strange in the parser

Tokens: [$,3] <#> \Tree[[,12][.,12]S[ ,10][[,12][.,12]N[ ,10]This[ ,10][],12]
[ ,10][[,12][.,12]V[ ,10]is[ ,10][],12][ ,10][[,12][.,12]NP[ ,10][[,12]
[.,12]Det[ ,10]a[ ,10][],12][ ,10][[,12][.,12]N[ ,10]test[ ,10][],12][ ,10]
[],12][ ,10][],12][$,3] pos: 1

I get something similar for your first example in comment 5. Both examples work
when loaded from a file, as you also found out.
The error message from H. P. Gumms manual is a lyx2lyx problem: The ams math
switch is off. I'll file another bug report.

Conclusion: The patch works as advertised, but you have found two independant
bugs that I will file separately.

comment:11 by Juergen Spitzmueller, 18 years ago

but the following doesn't work in 1.4, contrary to 1.3:
\text{test}
C-M

comment:12 by Georg Baum, 18 years ago

Right. I think that is has to do with the general C-m problem (#2315)

comment:13 by Georg Baum, 18 years ago

Keywords: dataloss removed
Milestone: 1.4.0

The biggest problems are now fixed, everything that is supported by 1.3 is now
supported by 1.4, too. I don't close the bug, because xymatrix is still not
fully supported, see last two examples in my first comment.

comment:14 by ps, 15 years ago

Priority: highnormal

comment:15 by Uwe Stöhr, 14 years ago

Cc: Juergen Spitzmueller Vincent van Ravesteijn Uwe Stöhr added; j.spitzmueller@… removed
Description: modified (diff)
Keywords: regression patch removed

The regression was fixed long ago, so this bug is now only about the following things that should be supported by LyX:

\xymatrix{A\ar[d]^(0.2)f \\ B} 


and

\xymatrix@R=3cm{A\ar[d]^f \\ B} 

The second one is supported since LyX 1.6.0.

Vincent, as you recently added some new \xymatrix features in r32518, do you think the first example can be supported too?

comment:16 by Uwe Stöhr, 14 years ago

Description: modified (diff)

comment:17 by Uwe Stöhr, 14 years ago

Type: defectenhancement

comment:18 by Vincent van Ravesteijn, 14 years ago

What is the problem with the first example then ? It works for me.

comment:19 by Uwe Stöhr, 14 years ago

What is the problem with the first example then ? It works for me.

When I insert this to an equation, I get this LaTeX-code:

\xymatrix{A\ar[d]^{(}0.2)f \\ B}

I'm not able to get rid of the braces to get the desired LaTeX-code. Can you please attach a LyX file where it works for you?

comment:20 by Vincent van Ravesteijn, 14 years ago

Well, I don't know anything about the xy stuff, so I just thought it was supposed to be like this. Anyway, the xypic manual explicitly reads:

"For labels placed to the left or to the right of the arrow this does not work. The corresponding xy-pic code such as e. g. \ar[r](.3)\phi or \ar[r]_(.3)\psi is not correctly interpreted by LyX's math editor. Two workarounds are suggested in the last section of this note."

It will be tough to rework the math editor to support this stuff. And when are we finished. There is probably so much more that can be done, but won't fit into our math editor. Besides, I think the need is no longer there with Inset previews.

comment:21 by Uwe Stöhr, 14 years ago

Resolution: fixed
Status: newclosed

It will be tough to rework the math editor to support this stuff.

Indeed, therefore wontfix for this case

The initial bug is already fixed. -> marking this as fixed

Note: See TracTickets for help on using tickets.