# Redefine block template for Beamer theorem-like environment

I would like to redefine the block templates for Beamer's theorem-like environments. For example, the example environment creates an exampleblock. I would like to make the definition environment do the same thing.

It's possible to do this locally using the exampleblock environment:

\begin{exampleblock}{Definition}
(Definition here)
\end{exampleblock}


However, I would like a global solution.

I should add that much the same question was asked on Stackoverflow, but no one seems to have figured out a solution.

-
So you want the definition environment to behave exactly as an exampleblock? –  Gonzalo Medina Sep 12 '12 at 13:14
Yes, that's right. –  Andrew Uzzell Sep 12 '12 at 13:16

You can set the theorem begin and theorem end templates to use an exampleblock:

\documentclass{beamer}
\usetheme{CambridgeUS}

\makeatletter
\setbeamertemplate{theorem begin}
{%
\begin{exampleblock}
{%
%    \inserttheoremheadfont% uncomment if you want amsthm-like formatting
\inserttheoremname
\inserttheoremnumber
\inserttheorempunctuation
}%
}
\setbeamertemplate{theorem end}{\end{exampleblock}}
\makeatother

\begin{document}

\begin{frame}
\begin{definition}
Test text.
\end{definition}
\begin{exampleblock}{Definition}
(Definition here)
\end{exampleblock}
\end{frame}

\end{document}


The above solution makes all theorem-like environments inherit the settings for exampleblock; if just the default definition environment must behave like exampleblock, all one has to do is to change the default style used for definition to make it equal to the example style; a simple way to achieve this is to \let both commands \definition and \enddefinition to \relax and then use \newtheorem to define the definition structure using the example style.

An example showing this approach; definition behaves as an exampleblock, but all other theorem-like structures preserve theis default behaviour:

\documentclass{beamer}
\usetheme{CambridgeUS}

\let\definition\relax
\let\enddefinition\relax

\theoremstyle{example}
\newtheorem{definition}[theorem]{\translate{Definition}}

\begin{document}

\begin{frame}
\begin{definition}
Test text.
\end{definition}
\begin{exampleblock}{Definition}
Test text.
\end{exampleblock}
\begin{theorem}
Test text.
\end{theorem}
\end{frame}

\end{document}


-
This solution changes all theorem environments. I would like to make definition into an exampleblock, but leave the other theorem environments unchanged. –  Andrew Uzzell Sep 12 '12 at 14:08
@AndrewUzzell please see my updated answer. –  Gonzalo Medina Sep 12 '12 at 17:49