[Tex/LaTex] Beamer : display the lines of an array pause by pause ( is there an alternative to \hline ?)

arraysbeameroverlays

I would like to display the different lines of an array, using overlays.
However I have trouble with the \hline command which seems to include an carriage return.
Here is a minimal example, I guess what I want is quite obvious: the same result without the first | on the new line

\documentclass{beamer}
\mode<presentation>
\begin{document}
\begin{frame}
$$\begin{array}{|c|c|c|}
\hline \mbox{first line} & bla&bla \\
\hline\pause 
\visible<2->{\mbox{second line} & bla & bla \\
\hline}\pause
\mbox{third line} & bla &bla
\\ \hline
\end{array}$$
\end{frame}
\end{document}

Best Answer

Don't use $$, use \[...\] instead (for details see this question and answers). You can put \noalign{\pause} at the end. Then \pause is applied just when the one row is finished and before the next row is started. Also, it is better to use \text instead of \mbox as the former is more font friendly.

\documentclass{beamer}
\usepackage{amsmath}
\mode<presentation>
\begin{document}
\begin{frame}
\[\begin{array}{|c|c|c|}
\hline \text{first line} & bla&bla \\
\hline\noalign{\pause}
\text{second line} & bla & bla \\
\hline\noalign{\pause}
\text{third line} & bla &bla
\\ \hline
\end{array}\]
\end{frame}
\end{document}

enter image description here