[Tex/LaTex] \centering not working properly

beamer

I am just copied/pasted the solution posted for the following question.

how to get a newline in \fbox?

My problem is that box does not appear in the center of frame.

Below is the snap shot of my code along with its pdf version

enter image description here

Best Answer

The code in the linked solution works as expected. The problem in your case is that you are using an old version of beamer in which an explicit end of paragraph was needed before \end{frame} for commands such as \centering to have effect. Add an explicit end of paragraph (a blank line or \par) before \end{frame}:

\documentclass{beamer}
\usepackage{vietnam}
\usepackage{varwidth}

\begin{document}

\begin{frame}
\centering
\fbox{\begin{varwidth}{\textwidth}
\centering
One billion searches per second $\Rightarrow$ 36 yrs  \\ All this to recover only $10$ bits !
\end{varwidth}}

\end{frame}

\end{document}

I'd suggest you to update your LaTeX system.

Related Question