You could try the following code, to define your custom block:
\newenvironment<>{proposition}[1][\undefined]{%
\begin{actionenv}#2%
\ifx#1\undefined%
\def\insertblocktitle{Proposition}%
\else%
\def\insertblocktitle{Proposition ({\em#1})}%
\fi%
\par%
\mode<presentation>{%
\setbeamercolor{block title}{fg=white,bg=yellow!50!black}
\setbeamercolor{block body}{fg=black,bg=yellow!20}
}%
\usebeamertemplate{block begin}\em}
{\par\usebeamertemplate{block end}\end{actionenv}}
which has been adapted from here:
Custom beamer blocks for pros and cons?.
Note that an \if has been inserted to typeset either Proposition in the title, when no optional title is given, or Proposition (Name of Proposition) if such an optional name is provided.
The main text has been tweaked to be italic, by inserting the \em command after the \usebeamertemplate{block begin}.
Also, colors have been defined (which was my original motivation for implementing a custom definition in beamer, since using the package thmtools is problematic in beamer when a background color is specified).
In this way you can define definition, assumption, proposition, lemma, theorem, corollary, remark blocks, with possibly different colors each.
Use them as:
\begin{proposition}
Main text, no custom name in the title.
\end{proposition}
when you just want the main text, or if you also want to specify a name in italics within parentheses, then use:
\begin{proposition}[optional name, will become italic]
Main text
\end{proposition}
In case that one prefers the main body text to remain normal (and not in italics), then removing the \em command from after \usebeamertemplate{block begin} will suffice.
To start the answer small: as you will have found in the docs, the actual environment inserted depends on the value of \inserttheoremblockenv
.
Unfortunately, the docs only do what the docs say:
if a theorem that has theorem style example is typeset, it will
expand to exampleblock
and not what they might seem to suggest (i.e. something along the lines of "if the style is X, and environment Xblock
exists, I'll use Xblock
, otherwise block
). The way this is done is simplistic (beamerbasetheorems.sty):
\def\th@example{%
\normalfont % body font
\def\inserttheoremblockenv{exampleblock}
}
\th@example
is the macro that stores the look and layout of theorem style example
. So for a different style, you can change the environment.
Defining an environment for the color combinations you want seems to be done best in a brute-force way by adapting the definition of, e.g. exampleblock
(beamerbaselocalstructure.tex
):
\newenvironment<>{exampleblock}[1]{%
\begin{actionenv}#2%
\def\insertblocktitle{#1}%
\par%
\mode<presentation>{%\usebeamerfont{block}%
\setbeamercolor{local structure}{parent=example text}}%
\usebeamertemplate{block example begin}}
{\par%
\usebeamertemplate{block example end}%
\end{actionenv}}
On first thought, though, this won't help you with the pre-defined theorem names, so you might want to give the class optionnotheorems
to disable the predefined theorem
etc. and define them yourself.
Best Answer
You can set the
theorem begin
andtheorem end
templates to use anexampleblock
:The above solution makes all theorem-like environments inherit the settings for
exampleblock
; if just the defaultdefinition
environment must behave likeexampleblock
, all one has to do is to change the default style used fordefinition
to make it equal to theexample
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 theexample
style.An example showing this approach;
definition
behaves as anexampleblock
, but all other theorem-like structures preserve theis default behaviour: