I want to slide a label so I use the tex code

\xymatrix{A\ar^(.25){f}[r] & B}

Using directly this code as latex in LyX works, but I want to do the same thing in equations environment in LyX, what LyX is doing is putting all the (.25){f} part as superscript

\xymatrix{A\ar^{(.25){f}}[r] & B} 

How can I avoid this problem without having to write raw latex in LyX?

1 Answer 1


I don't see how you could avoid those braces appearing in the LaTeX if you want to create the arrow directly in a math inset. You could avoid putting the whole xymatrix in TeX though by creating a macro and using that. In your preamble put:


Now in your equation inset you can use this like \myarr{0.25}{f}{r} (you'll have to type \{ in order to get the brace pairs).

Better still you could combine this with LyX's math macro feature. This won't solve the problem of not being able to enter \ar^(0.25) — you'll still need to type TeX explicitly for that — but it can make it look a bit prettier. With the above command already in your preamble, create a math macro \myrightar, and in the second box (labelled "TeX") enter \myarr{0.25}{#1}{r} (you'll need to type a backslash before #1 to get a parameter rather than literally a hash followed by a one). Now in the final box, labelled "LyX", you can enter whatever looks good and it won't affect the output. So you could put something like \xrightarrow and put #1 in the top box (don't forget the backslash), and even put something like \text{ } in the bottom box to make it visually disappear.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .