# [Xy-pic] Typesetting row operations in matrices

Matthew Leingang leingang at math.harvard.edu
Mon Mar 27 16:13:25 CEST 2006

Dear Ross,

Thanks very much for the reply, and thanks for creating such a rich and
fascinating package!

This does get me exactly what I want...except I'm used to using square
brackets for matrices.  I noticed there's no support for a  \frm{[} bracket.
Maybe I'll be brave and vparse xyframe.tex.

--Matt

On 3/25/06 6:33 PM, "Ross Moore" <ross at ics.mq.edu.au> wrote:

>
> On 25/03/2006, at 7:21 AM, Matthew Leingang wrote:
>
>> Hello list,
>>
>> \xymatrix{1 & 1 & 1 & 1 & 0 \\ 0 & 1 & -1 & 0 & 0 \\ 0 & 0 & 0 & 1 & 0
>> \ar@/_3ex/[uu]_{-1}}
>>
>> Which is pretty close.  You can set the row and column separation
>> parameters
>> so the spacing is just like it is in LaTeX matrices.
>
> Try this:
>
> $> \begin{xy} > *!C\xybox{\xymatrix{ > 1 & 1 & 1 & 1 & 0 \\ 0 & 1 & -1 & 0 & 0 \\ 0 & 0 & 0 & 1 & 0 > }\POS="matrix" > ,"matrix"!L*\frm{(},"matrix"!R*\frm{)} > ,"3,5"+/r.5cm/,\ar@/_3ex/"1,5"+/r.5cm/_{-1}} > \end{xy} >$
>
>
> or
>
>
> \newcommand{\circled}[1]{\xybox{*+[Fo]{#1}}}
> $> \begin{xy} > *!C\xybox{\xymatrix{ > 1 & 1 & 1 & 1 & 0 \\ 0 & 1 & -1 & 0 & 0 \\ 0 & 0 & 0 & 1 & 0 > }\POS="matrix" > ,"matrix"!L*\frm{(},"matrix"!R*\frm{)} > ,"3,5"+/r.5cm/,\ar@/_3ex/"1,5"+/r.5cm/_{\circled{1}\,-\,\circled{3}}} > \end{xy} >$
>
>
>
>
>>
>> But usually matrices are delimited by something, like square
>> brackets or
>> parentheses.  I want the numbers part of the matrix to go inside the
>> delimiters but the curved arrows to go outside the delimiter on the
>> RHS.
>> Putting \left[...\right] about the above, predictably, puts the
>> delimiter
>> outside the arrows.  But unpredictably, this extends the delimiter
>> higher than the visible natural height of the matrix.  You get giant
>> delimiters with a normal-size matrix nestled at the bottom.
>
> The !C modifier fixes this, since it centers the object
> to have equal height/depth.
>
> But it's better to use Xy-pic itself to place the surrounding brackets.
>
>
>> I've also tried some hacks like using a regular matrix environment
>> with an
>> xymatrix next to it, containing no visible entries and just the
>> arrows.  But
>> the regular matrix's bottom gets vertically aligned with the
>> xymatrix's
>> middle.  The only way I know how to fix that is to move up the
>> xmymatrix,
>> creating monstrosities like
>>
>> \left[\begin{matrix}1 & 1 & 1 & 1 & 0 \\ 2 & 0 & 4 & 2 & 0 \\ 1 & 1
>> & 1 & 3
>> & 0 \end{matrix}\right]
>> \hspace{-1.5ex}{\raisebox{4.3ex}{\xymatrix{
>> {\mathstrut} \ar@/^3ex/[d]_{-2} \ar@/^4ex/[dd]^{-3} \\ {\mathstrut}\\
>> {\mathstrut} }}}
>
> The frills don't belong within the matrix itself.
>
> Xy-pic allows you to access all the matrix-cell positions
> from outside the \xymatrix construction, when it is
> given as part of a surrounding {xy} environment, or \xygraph .
>
> That gives you the freedom to do everything that you want,
> and a whole lot more.
>
>>
>> This does "work" but if the matrix environment changes the xymatrix
>> kludge
>> matrix has to change, too.  I'd be OK with that if I could get the
>> two-matrix approach to line up without entering in dimensions by hand.
>>
>> Does anybody have an elegant solution to this problem?
>
> See the above examples.
>
>
>>
>> TIA,
>> Matt
>
>
> Hope this helps,
>
> Ross Moore
>
>
>>
>> --
>> Matthew Leingang
>> Preceptor in Mathematics
>> Harvard University
>>
>> URL: http://www.math.harvard.edu/~leingang/
>> vCard: http://www.math.harvard.edu/~leingang/vCard.vcf
>>
>>
>>
>> _______________________________________________
>> xy-pic mailing list
>> http://tug.org/mailman/listinfo/xy-pic
>
> ------------------------------------------------------------------------
> Ross Moore                                         ross at maths.mq.edu.au
> Mathematics Department                             office: E7A-419
> Macquarie University                               tel: +61 +2 9850 8955
> Sydney, Australia  2109                            fax: +61 +2 9850 8114
> ------------------------------------------------------------------------
>

--
Matthew Leingang
Preceptor in Mathematics
Harvard University

URL: http://www.math.harvard.edu/~leingang/
vCard: http://www.math.harvard.edu/~leingang/vCard.vcf