Take the 2-minute tour ×
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.

The xymatrix diagram does not seem to vertically align when grouped in an equation environment. For example, this code produces the following image (which seems to place the xymatrix 2.5em lower than it should be). How can I remedy this without using \raisebox{2.5em}?

\[\boxed{
\begin{array}{ccc}
A & B & C \\
A & B & C \\
A & B & C \\
A & B & C \\
A & B & C \\
\end{array}
}
\quad 
\boxed{
\begin{array}{ccc}
A & B & C \\
A & B & C \\
A & B & C \\
A & B & C \\
A & B & C \\
\end{array}
}
\qquad\boxed{
\xymatrix@-1pc{
A & B & C \\
A & B & C \\
A & B & C \\
}}
\]

Example diagram

share|improve this question

1 Answer 1

up vote 4 down vote accepted

Use \vcenter to vertically center within math mode. For some strange reason is seems to require (at least sometimes) an inner \vbox. As in:

\documentclass{article}
\usepackage[all]{xy}
\begin{document}
 \begin{equation}
  x\,
   \vcenter{\vbox{
   \xymatrix@-1pc{
   A & B & C \\
   A & B & C \\
   A & B & C \\
   }
   }}
 \end{equation}
\end{document}

As an aside, your example doesn't compile for me because I don't know where the \boxed command is from. You should give a complete LaTeX (or TeX) file in your questions.

share|improve this answer
    
Also \vcenter{\hbox{...}} could be used. –  Stefan Kottwitz Apr 8 '11 at 19:08
    
@Stefan: Thanks; I've just been copying that along for years since I first read it somewhere. I don't really get why it's necessary. –  Ryan Reich Apr 8 '11 at 19:14
    
Oh, sorry. I think it's defined in the amsmath package –  Alex Apr 8 '11 at 19:20
    
With amsmath there's an easier way: \begin{gathered}\xymatrix{...}\end{gathered} –  egreg Apr 8 '11 at 19:35
    
I tried gathered, and it didn't work for me. –  Alex Apr 9 '11 at 12:26

Your Answer

 
discard

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.