TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

As denoted in XY-pic's user guide, "Each label is placed perpendicular to the arrow at the point halfway between the centers of the base and target objects." In order to center the label at the middle of the arrow instead, one must insert - after the ^ or _. The difference is quite clear in the following example:

$$\xymatrix{A\times B\times C \ar[r]^f & D}$$

$$\xymatrix{A\times B\times C \ar[r]^-f & D}$$

In the first xy-matrix (default centering), the function label $f$ will be shoved back to the left of the arrow, completely obscured. In the second xy-matrix (alternative centering), the function label $f$ is appropriately, or more naturally, placed in the middle of the arrow.

After using XY-matrix for a while, I've found that I insert the command - more often than I omit it. My question is the following:

Is there a way to set this alternative centering feature as the default label position?

Being rather TeX-nologically inexperienced, I couldn't find any documentation on a solution.

share|improve this question
Sorry, I don't think it's possible (and desirable, either). Don't use $$...$$ in LaTeX, see tex.stackexchange.com/questions/503/why-is-preferable-to – egreg Sep 6 '12 at 14:44
Possibility aside, why wouldn't it be desirable? I've found more issue with the default centering position than appending everything with -. And as far as $$...$$ is concerned, I would agree with Harrold's comment of the accepted answer; I'm perfectly fine with the convenience of using $$...$$ while aware of its (very rare) mishaps. I don't see why one should be forced to use one code over another. – Dustin Tran Sep 6 '12 at 15:04
I believe that alignment of labels across rows and columns is more important than placement at the center of the arrow, which sometimes is needed (when the objects to connect are big). Regarding $$, we can talk again when some submission of yours will be rejected because not conforming with the journal style that uses left aligned equations. :) – egreg Sep 6 '12 at 15:11
I don't think it's a matter of importance moreso than which issue comes up more often. And in my documents at least, I've found that unequal-sized source and target objects occur far more often than the need to align labels in a tabled-commutative diagram, where - would otherwise misalign them. And about the $$...$$ issue, it's certainly not hard to replace them should the need arise; as I said, it's simply more convenient for me, with syntax highlighting and when live-TeXing seminars or lectures. Regardless, I'm still crossing my fingers for a solution! – Dustin Tran Sep 6 '12 at 15:29

There is no setting for setting the default of an arrow label by default with the - option that I know of.

This might be a feature request for the Xy-pic developers.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.