Beamer newenvironment for theorems
I believe that TikZ and PGF have better ways to cope with framing. However, here's how you can do it:
\newenvironment<>{myTheorem}[1][]{%
\def\FrameCommand{\parchmentframe}%
\def\FirstFrameCommand{\parchmentframetop}%
\def\LastFrameCommand{\parchmentframebottom}%
\def\MidFrameCommand{\parchmentframemiddle}%
\vskip\baselineskip
\MakeFramed{\FrameRestore}
\noindent\tikz\node[inner sep=1.2ex, draw=blue, fill=blue!10,
anchor=west, overlay, line width = 1.pt, rounded corners=4pt] at (0em, 1em)
{\color{LightBlue}{THEOREM\if\relax\detokenize{#1}\relax\else\space (#1)\fi}};\par\nobreak}%
{\endMakeFramed}
Then call
\begin{frame}
\frametitle{A theorem}
\begin{myTheorem}[True]
All pigs can fly.
\end{myTheorem}
\begin{myTheorem}
No pig can fly.
\end{myTheorem}
\end{frame}
Here's the result (theme Madrid):
Here's the complete code (just added a \colorlet
to set what LightBlue is):
\documentclass{beamer}
\usetheme{Madrid}
\usepackage{tikz}
\usepackage{framed}
\colorlet{LightBlue}{blue}
% Theorem box
\pgfdeclarelayer{background}
\pgfsetlayers{background,main}
\tikzstyle{thmbox} = [inner sep=1em]
\tikzstyle{thmborder} = [draw=blue, fill=none,line width =1.pt, rounded corners=5pt]
\def\parchmentframe#1{
\tikz{
\node[thmbox] (A) {#1};
\begin{pgfonlayer}{background}
\fill[thmborder]
(A.south east) -- (A.south west) --
(A.north west) -- (A.north east) -- cycle;
\end{pgfonlayer}}}
\def\parchmentframetop#1{
\tikz{
\node[thmbox] (A) {#1};
\begin{pgfonlayer}{background}
\fill[thmborder]
(A.south west) -- (A.north west) --
(A.north east) -- (A.south east);
\end{pgfonlayer}}}
\def\parchmentframebottom#1{
\tikz{
\node[thmbox] (A) {#1};
\begin{pgfonlayer}{background}
\fill[thmborder]
(A.north west) -- (A.south west) --
(A.south east) -- (A.north east);
\end{pgfonlayer}}}
\def\parchmentframemiddle#1{
\tikz{
\node[thmbox] (A) {#1};
\begin{pgfonlayer}{background}
\fill[thmborder]
(A.north west) -- (A.south west);
\fill[thmborder]
(A.south east) -- (A.north east);
\end{pgfonlayer}}}
\newenvironment<>{myTheorem}[1][]{%
\def\FrameCommand{\parchmentframe}%
\def\FirstFrameCommand{\parchmentframetop}%
\def\LastFrameCommand{\parchmentframebottom}%
\def\MidFrameCommand{\parchmentframemiddle}%
\vskip\baselineskip
\MakeFramed{\FrameRestore}
\noindent\tikz\node[inner sep=1.2ex, draw=blue, fill=blue!10,
anchor=west, overlay, line width = 1.pt, rounded corners=4pt] at (0em, 1em)
{\color{LightBlue}{THEOREM\if\relax\detokenize{#1}\relax\else\space (#1)\fi}};\par\nobreak}%
{\endMakeFramed}
%%end theorem box
\begin{document}
\begin{frame}
\frametitle{A theorem}
\begin{myTheorem}[True]
All pigs can fly.
\end{myTheorem}
\begin{myTheorem}
All pigs can fly.
\end{myTheorem}
\end{frame}
\end{document}
Al alternative definition made with newtcbtheorem
command from tcolorbox
.
The new environment myTheo
uses two mandatory parameters, the first one is the theorem title and the second a possible label for references. Both can be left empty.
The command also creates an alternative myTheo*
environment for non numbered theorems.
\documentclass{beamer}
\usetheme{Madrid}
\usepackage[most]{tcolorbox}
\newtcbtheorem{myTheorem}{THEOREM}{%
enhanced,
arc=5pt,
boxrule=1pt,
oversize=-1em,
colframe=blue,
colback=white,
attach boxed title to top left={xshift=5mm,yshift*=-\tcboxedtitleheight/2},
boxed title style={ colback=blue!10, boxrule=1pt, arc=5pt, left=1mm, right=1mm},
coltitle=blue,
separator sign none,
description delimiters={(}{)}
}{th}
\begin{document}
\begin{frame}
\frametitle{A theorem}
\begin{myTheorem*}{True}{}
All pigs can fly.
\end{myTheorem*}
\begin{myTheorem}{}{}
All pigs can fly.
\end{myTheorem}
\end{frame}
\end{document}