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.

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*} 
share|improve this question
    
See also tex.stackexchange.com/q/1023/484 which was asked with this scenario, among others, in mind. –  Charles Staats May 2 '12 at 21:00

1 Answer 1

up vote 4 down vote accepted

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}
share|improve this answer
    
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

 
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.