Using beamer \visible command inside a table, without adding vertical space

When using the beamer \visible command inside a tabular environment, beamer adds an extra vertical space before the text. For example, in the following code, beamer adds an empty line before the word World in the second row. Can this be avoided?

\documentclass{beamer}
\begin{document}
\begin{frame}
\begin{tabular}{|p{1cm}|p{1cm}|}
\hline
1 & Hello World \\
\hline
2 & \visible<2->{Hello World} \\
\hline
\end{tabular}
\end{frame}
\end{document}

• Just add \hspace{.1mm} before the \visible..... Mar 11, 2012 at 15:33
• You can actually use \hspace{0pt} as well. Mar 11, 2012 at 17:54

The solution to this problem is to put

\hspace{0pt}


just before the \visible command.

When I discussed this with David Carlisle in chat he said:

because you should never try to do anything fancy as the first thing in a table cell, I don't know exactly what visible does but tex is in a rather unstable state at that position.

So that's about as good an explanation as one can get without looking very deeply into the code.

Percusse (who also had the same idea) credits it to this question: Why does babel not work in Tikz?

• @haggai_e If, like me, you're lazy and want to save on key strokes, you can use ${}$ in place of \hspace{0pt} in this case. Jun 10, 2012 at 7:16