# Beamer overlays and XYpic

Let's suppose we have some really really trivial XY-pic drawing:

``````\xymatrix {
A & B \\
C & D
}
``````

What I want to achieve would be something like:

1. Only `B` and `D` are visible on slide 1
2. On slide 2, we get an arrow between `B` and `D`
3. On slide 3, `A` appears and there's an arrow between `D` and `A`

I can get the nodes to appear using the Beamer `\uncover` command, but the arrows seem to happily ignore that.

Is there some way to get arrows only (from or until) certain overlay slides?

-
If you are not to bound to `xypic` I would suggest to switch to TikZ. It is from the same author than `beamer` and both work very well together. –  Martin Scharrer May 11 '11 at 14:40
Try to use `\visible` or `\only` instead of `\uncover` for the arrows. –  Martin Scharrer May 11 '11 at 14:41
@Martin: `\only` should work, not sure about `\visible`. I would try it if I remembered how to draw arrows in xypic! –  Matthew Leingang May 11 '11 at 14:56
I have a strong dislike for TikZ as it seems that every time someone sends me a document that uses TikZ I happen to use some incompatible version of it and it all breaks down. –  andri May 11 '11 at 15:05

## 1 Answer

Now why didn't any of you commenters write an actual answer I could accept :)

But yes, `\only` works for arrows, so the following code

``````\xymatrix { \uncover<2->{A} & \only<3>{ \ar[l] } B }
``````

works as expected, creating the following overlays:

``````      B
A     B
A <-- B
``````
-
Probably because, as Matthew commented, none of them could remember how to do arrows in XY so they couldn't test their suggestions easily. (The moral being that your minimal working example was too minimal!) But it's great that you decoded them enough to figure out the answer yourself. –  Loop Space May 11 '11 at 20:01