Center block on frame with Beamer
If the shortened block is put inside a minipage
, you can center it easily
\documentclass{beamer}
\usetheme{Warsaw}
\newenvironment<>{varblock}[2][.9\textwidth]{%
\setlength{\textwidth}{#1}
\begin{actionenv}#3%
\def\insertblocktitle{#2}%
\par%
\usebeamertemplate{block begin}}
{\par%
\usebeamertemplate{block end}%
\end{actionenv}}
\begin{document}
\begin{frame}
\begin{center}
\begin{minipage}{4cm}
\begin{varblock}[4cm]{New block}
Variable width, here 4cm
\end{varblock}
\end{minipage}
\end{center}
\end{frame}
\end{document}
If you use minipage
as indicated by samcarter, you can use block
and omit the varblock
definition since minipage
already allows for reducing the width of the block
:
\documentclass{beamer}
\usetheme{Warsaw}
\begin{document}
\begin{frame}
\begin{center}
\begin{minipage}{4cm}
\begin{block}{New block}
Variable width, here 4cm
\end{block}
\end{minipage}
\end{center}
\end{frame}
\end{document}