# beamer box around equations

How can I make a fancy box around equations like the one in the left? I tried many time on my own but nothing satisfactory obtained!

• Just start with a block: \begin{block}{} equation here \end{block}. Then you can add some block styles. – Sigur Feb 2 '15 at 13:41

Here are some options with empheq and tcolorbox adopting code from this answer.

\documentclass{article}
\usepackage[svgnames,hyperref]{xcolor}
\usepackage{empheq}
\usepackage[many]{tcolorbox}
%\tcbuselibrary{skins}

\tcbset{highlight math style={enhanced,
colframe=red!60!black,colback=yellow!50!white,arc=4pt,boxrule=1pt,
}}

\newtcbox{\mybox}[1][]{nobeforeafter,math upper,tcbox raise base,
enhanced,frame hidden,boxrule=0pt,interior style={top color=green!10!white,
bottom color=green!10!white,middle color=green!50!yellow},
fuzzy halo=1pt with green,drop large lifted shadow,#1}

\begin{document}

\begin{empheq}[box=\tcbhighmath]{align}
a&=b\\
E&=mc^2 + \int_a^a x\, dx
\end{empheq}

a&=b\\
E&=mc^2 + \int_a^a x\, dx
\end{empheq}

\begin{empheq}[box=\mybox]{align}
a&=b\\
E&=mc^2 + \int_a^a x\, dx
\end{empheq}

\end{document}


• I cannot find drop large lifted shadow in the documentation of tcolorbox. Do you use a development version or is it just undocumented? – Henri Menke Feb 2 '15 at 15:07
• @HenriMenke It is there in documentation, page 155, of tcolorbox version 3.36 (9-1-2015) – user11232 Feb 2 '15 at 15:09
• Ah, I see. Then texdoc.net is not up-to-date. – Henri Menke Feb 2 '15 at 15:44
• @HenriMenke I tried to implement your codes but I got an error message: "File 'tcolorbox.sty' not found". I found it by search and then I got another error message: "I can't find file tcbskins.code.tex". I also found this file by search but I do not know what should I do. Do you know how to solve this issues? – Moody Feb 2 '15 at 16:55

This should be a starting point. I used tcolorbox for the fancy equation box. The font is biolinum.

\documentclass[9pt]{beamer}
\usefonttheme[onlymath]{serif}
\setbeamertemplate{itemize item}[circle]
\defbeamertemplate{footline}{sky blue}
{
\leavevmode%
\hbox{\begin{beamercolorbox}[wd=\paperwidth,ht=2.5ex,dp=1.125ex,leftskip=1em,rightskip=1em]{frametitle}%
\end{beamercolorbox}}%
\vskip0pt%
}
\setbeamertemplate{footline}[sky blue]

\usepackage{tcolorbox,mathtools,biolinum}
\tcbuselibrary{skins,theorems}

\definecolor{sblue}{HTML}{0049A9}
\definecolor{scyan}{HTML}{CBEAFC}
\definecolor{sred}{HTML}{B5595C}
\definecolor{sgreen}{HTML}{609B57}
\definecolor{spink}{HTML}{FFB0FF}
\setbeamercolor{frametitle}{fg=sblue,bg=scyan}

\newcommand\markit[1]{\textcolor{sblue}{#1}}
\newtcolorbox{fancyeqbox}[1][]{
boxrule=0pt,arc=0pt,boxsep=0pt,
left=.5em,right=.5em,top=1ex,bottom=1ex,
colback=white,#1
}
\setlength{\leftmargini}{0pt}
\begin{document}

\title{Controllo di Processo e dei Sistemi di Produzione -- A.a.\ 2009/09}

\begin{frame}{Receding horizon philosophy}
\begin{columns}[totalwidth=\linewidth]
\column{.5\linewidth}
\begin{itemize}
\item \underline{At time $t$:} solve and \markit{optimal control}
problem over a finite future horizon of \markit{$N$} steps:
\begin{fancyeqbox}[ams align*,width=\linewidth+.7cm,enlarge left by=-.7cm]
\min_{u_t,\ldots,u_{t+N-1}}
&\left\{ \sum_{k=0}^{N-1} \| {\color{sred} y_{t+k} - r(t)} \|^ 2 + \right. \\
&\quad\left. \rho \| {\color{sred} u_{t+k} - u_r(t)} \|^2 \right\} \\
& {\color{sblue} x_{t+k+1} = f(x_{t+k},u_{t+k})} \\
& {\color{sblue} y_{t+k} = g(x_{t+k},u_{t+k})} \\
& {\color{sgreen} u_{\mathrm{min}} \leq u_{t+k} \leq u_{\mathrm{max}}} \\
& {\color{sgreen} y_{\mathrm{min}} \leq y_{t+k} \leq y_{\mathrm{max}}} \\
& x_{t} = x(t), k=0,\ldots,N-1
\end{fancyeqbox}
\end{itemize}

\column{.5\linewidth}
\centering
\includegraphics[width=.7\linewidth]{example-image-golden-upright}
\end{columns}
\begin{itemize}
\item Only apply the firt optimal move \markit{$u^*(t)$}
\item \underline{At time $t+1$:} \markit{Get new measurements},
repeat the optimization. And so on\ldots
\end{itemize}
\begin{center}
\colorbox{spink}{Advantage of repeated on-line optimization: \textcolor{red}{FEEDBACK!}}
\end{center}
\end{frame}
\end{document}