# [texhax] Problem with beamer adding spaces

Michael Barr barr at math.mcgill.ca
Mon Sep 28 22:35:55 CEST 2015

The problem is illustrated with this file:

\documentclass{beamer}
\input diagxy
\begin{document}

\begin{frame}

$$\bfig \node 1(0,500)[A] \node 2(500,500)[B] \node 3(0,0)[C] \node 4(500,0)[D] \arrow [12;f] \arrow [13;g] \arrow [24;h] \arrow [34;k] \efig$$
\end{frame}

\begin{frame}
$$\bfig \node 1(0,500)[A] \node 2(500,500)[B] \node 3(0,0)[C] \node 4(500,0)[D] \uncover<2->{\arrow [12;f]} \uncover<3->{\arrow [13;g]} \uncover<4->{\arrow [24;h]} \uncover<5->{\arrow [34;k]} \efig$$
\end{frame}

\begin{frame}
$$\bfig \node 1(0,500)[A] \node 2(500,500)[B] \node 3(0,0)[C] \node 4(500,0)[D] \only<2->{\arrow [12;f]} \only<3->{\arrow [13;g]} \only<4->{\arrow [24;h]} \only<5->{\arrow [34;k]} \efig$$
\end{frame}

\end{document}

As you see if you tex it, the beamer command \uncover adds spaces.  Yes, you can work around it by adding % at the end of each line, but that is a nuisance.  The one using \only has its own minor problems that are unfixable.  That is caused by the fact that \only actually just throws its argument away and as an arrow and label are added, the picture shifts slightly since it grows higher and wider (only slightly in this example, but one could imagine an example in which the shift is larger).  What is odd is that spaces are invariably ignored in math modes and even blank lines are ignored in xy diagrams.  I tried replacing uncover, defined as follows:
\def\unc<#1>#2{\uncover<#1>#2\ignorespaces} but that just led to an incomprehensible error message.

Is this a bug?  Is there an easy fix?

Michael