5

This must have been asked somewhere here before, but I cannot seem to find it.

I am using \left( and \right) around an xymatrix, but the parenthesis are far too big; enter image description here

with the following code;

 \begin{equation*}
            \left(\xymatrix{ A \ar[r] \ar[d]    & B  \ar[d] \\
                      X     \ar[r]_f    &   Y}\right)
        \end{equation*} 
6

This is caused because the \xymatrix{ } sets the first line of the matrix on the baseline, the lower line goes beyond the baseline resulting in a large depth. The \left and \right macros are always centered on the baseline, and therefore are extended upwards as far the matrix goes down. Use the \vcenter macro to push the matrix up.

\documentclass{article}

\usepackage{amsmath}
\usepackage{xypic}

\begin{document}
\begin{equation*}
    \left(
    \vcenter{\xymatrix{ A \ar[r] \ar[d] & B \ar[d] \\ X \ar[r]_f & Y}}
    \right)
\end{equation*} 
\end{document}
  • Great, two birds with one stone. – BBischof Jul 11 '11 at 16:55
  • small nitpicking: \valign isn't a macro, it's a primitive. – morbusg Jul 11 '11 at 17:03
  • @morbusg: I'm actually using \vcenter not \valign, but both are indeed primitives ;-) – Martin Scharrer Jul 11 '11 at 17:53
  • 2
    A "pure LaTeX" solution is to enclose \xymatrix in a gathered environment. Using \vcenter in other cases can lead to surprises and head scratching; for example, TeX is not in math mode inside a \vcenter. Here it doesn't matter, since \xymatrix can be used in text mode and, most importantly, it builds a box. – egreg Jul 11 '11 at 18:10
  • :-O facepalm – morbusg Jul 11 '11 at 18:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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