I am trying to use xy package to draw some diagrams. So I use the command \usepackage{xy} and I type a sample as follows:

    A &*+[F]{\sum_{i=n}^m {i^2}} \\
  & {\bullet} & D \ar[ul] }

But this fails with the error undefined control sequence \xymatrix

I don't understand why. Someone can help me?

  • Welcome to TeX.SX. A tip: If you indent lines by 4 spaces, then they're marked as a code sample. You can also highlight the code and click the "code" button ({}) or select your code and hit Ctrl+K. Usually, we don't put a greeting or a "thank you" in our posts. While this might seem strange at first, it is not a sign of lack of politeness, but rather part of our trying to keep everything very concise. Upvoting is the preferred way here to say "thank you" to users who helped you. Feb 18, 2013 at 14:45

1 Answer 1


You need to load the package xy with the all option:

Sample output



A &*+[F]{\sum_{i=n}^m {i^2}} \\
& {\bullet} & D \ar[ul] }

To quote from the documentation:

With LATEX 2e, used by most users, XY-pic is loaded with \usepackage[all]{xy} in the preamble of the document; this also automatically loads an appropriate "backend driver" for generating graphics in either PDF or PostScript format, when possible (by checking for document class options like pdftex, dvipdfm, or dvips), to ensure the highest output quality (and usually results in smaller files).

  • By chance, I want to push the diagram in the center, so how can I do this?
    – mapping
    Feb 18, 2013 at 15:54
  • You can put it inside a display math environment, e.g. \begin{displaymath} \xymatrix... \end{displaymath}. A number version would be given by an equation environment. The amsmath package provides several more environments that can be used. Feb 18, 2013 at 16:47

You must log in to answer this question.

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