[Tex/LaTex] way to uncover arrows in an xymatrix

beameroverlaysxy-pic

Is there a way to uncover arrows in an xymatrix? Usually when I have problems with \uncover I use multiple frames, but I would like to be able to do this on a single frame.

Here is a sample: I would like the first slide to read "B", and then uncover "A →". The following code doesn't cover the "→".

\documentclass{beamer}
\usepackage[all]{xy}

\begin{document}

\begin{frame}[plain]

\xymatrix{
\uncover<2->{A \ar[r]}& B
}

\end{frame}

\end{document}


(I don't know anything about how xy parses its stuff so the xy bit is pure conjecture. However, I do know a bit about how beamer works its magic so that bit is less speculative.)

I think that Ryan's first comment is either true or close enough as to be a reasonable working assumption. This means that on the slide where you don't want the arrow to appear then you have to ensure that the \ar[r] code does not appear at all. The correct beamer code for this is the \only command as that throws away its argument without processing it (on the requisite slides).

However, you don't want the whole A \ar[r] thrown away because the A affects the spacing. You want the A to be there but just not shown. This is what \uncover does. It typesets its material, but using the background colour for the font so that it isn't shown. So you want \uncover for the A and \only for the \ar[r]. Thus:

\documentclass{beamer}
%\url{http://tex.stackexchange.com/q/39578/86}
\usepackage[all]{xy}

\begin{document}

\begin{frame}[plain]

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

\end{frame}

\end{document}


I agree that it would be nice if this could be done automatically somehow, but I don't know enough (anything!) about the internals of xy so can't suggest how it might be done.