1

I would like to know if it is possible to have to different kinds of blocks and how to do it in beamer.

As an example, one rounded for examples and one not rounded for theorems.

Is it possible to do this ?

Thanks

  • 1
    Welcome to TeX.SE! Yes, it is certainly possible, see here. And for the theorems see here. samcarter is probably hibernating, err, sleeping now... – marmot Aug 17 '18 at 1:42
2

Shamelessly combined from this nice answer by samcarter and this nice answer by samcarter. Only improvement: load the tikzmarmots package (by samcarter).

\documentclass{beamer}

\useinnertheme[shadow=true]{rounded}
\usepackage{tikzmarmots}
\usepackage{etoolbox}

\setbeamercolor{block title}{use=structure,fg=structure.fg,bg=structure.fg!20!bg}
\setbeamercolor{block body}{parent=normal text,use=block title,bg=block title.bg!50!bg}

\setbeamercolor{block title example}{use=example text,fg=example text.fg,bg=example text.fg!20!bg}
\setbeamercolor{block body example}{parent=normal text,use=block title example,bg=block title example.bg!50!bg}

\addtobeamertemplate{proof begin}{%
    \setbeamercolor{block title}{fg=black,bg=red!50!white}
    \setbeamercolor{block body}{fg=red, bg=red!30!white}
    \setbeamertemplate{blocks}[default]
}{}

\BeforeBeginEnvironment{theorem}{
    \setbeamercolor{block title}{fg=black,bg=orange!50!white}
    \setbeamercolor{block body}{fg=orange, bg=orange!30!white}
}
\AfterEndEnvironment{theorem}{
 \setbeamercolor{block title}{use=structure,fg=structure.fg,bg=structure.fg!20!bg}
 \setbeamercolor{block body}{parent=normal text,use=block title,bg=block title.bg!50!bg, fg=black}
}

\BeforeBeginEnvironment{definition}{%
    \setbeamercolor{block title}{fg=black,bg=pink!50!white}
    \setbeamercolor{block body}{fg=pink, bg=pink!30!white}
}
\AfterEndEnvironment{definition}{
 \setbeamercolor{block title}{use=structure,fg=structure.fg,bg=structure.fg!20!bg}
 \setbeamercolor{block body}{parent=normal text,use=block title,bg=block title.bg!50!bg, fg=black}
}

\begin{document}
\begin{frame}
    \begin{definition}[Marmot]
        A marmot is a \emph{being}.
    \end{definition}

    \begin{theorem}[My theorem]
        The colder the winter, the longer the hibernation time. 
    \end{theorem}
    \begin{proof}[My proof]
        $t_\mathrm{hibernate}\propto T^\alpha$ with $\alpha<0$.
    \end{proof}
    \begin{example}[My example]
        \tikz{\marmot[teeth,whiskers,blush]}
    \end{example}

    \begin{block}{My block}
        A block.
    \end{block}    

\end{frame}
\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.