Xy-pic User's Guide: Next: 4 Availability and Further . Up: 3 More Entries. Previous: 3.5 Naming for later .

## 3.6 Grouping objects

Sometimes you wish to frame or otherwise treat a rectangle of objects as a single object. This is possible with the last two target position forms that we will mention:

t`.`s | merge t with simple s
`{`t`}` | make t simple

The first will enlarge t to also `cover' the `simple' s (simple means that it cannot have changes etc. attached unless encapsulated in `{}`s). Here is an example where we merge and frame:

>     \xymatrix{ 1,1 & 1,2 & 1,3 & 1,4 & 1,5 \\
>                2,1 & 2,2 & 2,3 & 2,4 & 2,5
>      \save "1,2"."2,4"*[F.]\frm{}
>       \ar"1,1" \ar"2,1" \ar"1,5" \ar"2,5"
>      \restore }

will typeset

As you can see, the center of the merged object is the same as the one of the target before the ``.`'.

Finally a more advanced example where we create two merged objects with center in their `real' center, name them and then connect to them. It also shows how macros can be used inside diagrams: they should always expand to `commands' like `\ar`..., etc.:

can be typeset by

>     \def\g#1{\save.[dr]!C="g#1"*[F]\frm{}\restore}%
>     \xymatrix{
>     \g1 A\ar[r]&B\ar[d]&\g2 A'\ar[r]&B'\ar[d]\\
>         C\ar[u]&D\ar[l]&    C'\ar[u]&D'\ar[l]
>       \ar @{.>}  "g1" ;"1,4"
>       \ar @{-->} "2,1";"g2" }

Then we can make arrows from/to the two frames by using the two new targets `"g1"` and `"g2"` as shown.

Xy-pic User's Guide: Next: 4 Availability and Further . Up: 3 More Entries. Previous: 3.5 Naming for later .