[Tex/LaTex] Adjust width of tcolorbox to contains long Equation

beamerframedtcolorbox

My work based on that subject Create Beamer-Theorem like boxes

i want all long equations be inside a box and the width to be adjust based on the content

also the my box can't be split on different pages even i added breakable option As pointed out by Gonzalo Medina in a comment. by the way i use \usetheme{Luebeck}

here is my go

\documentclass[leqno,mathserif,hyperref={pdfpagelabels=false}]{beamer}
\usepackage{lmodern}
\usepackage{graphics,bm}
%\usetheme{AnnArbor}
\usetheme{Luebeck}
\usepackage{tcolorbox}
\tcbuselibrary{breakable,skins}
\setbeamercolor{structure}{blue}
\usepackage[tightpage]{preview}


\setbeamercovered{transparent}
\usepackage[T1]{fontenc}
\usepackage[english]{babel}
\usepackage{xcolor}
\usepackage{enumerate}
\newcommand{\diff}{\mathop{}\mathopen{}\mathrm{d}}

\usepackage{lipsum}
\usepackage{enumitem}


\colorlet{xlightblue}{blue!5}

\newtcolorbox{Educ}[1]{
 title=#1,
  beamer, 
  colback=xlightblue,
  colframe=blue!30,
  fonttitle=\bfseries,
  left=1mm,
  right=1mm,
  top=1mm,
  bottom=1mm,
  middle=1mm,
  breakable,
}

\begin{document}
\section[Plan]{Plan}
\section[Introduction]{Introduction}
\section[Example1]{Example1}
\section[Example2]{Example2}
\begin{frame}
\frametitle{Solution d'une EDS}
\begin{Educ}{Définition}
Une solution de l'EDS $E(b,\sigma)$  est un couple $(X,W)$ de processus adaptés sur un espace de probabilité filtré $(\Omega,\mathcal{F},\mathcal{F}_{t},\mathbb{P})$ qui satisfait les conditions usuelles, vérifiant :
\begin{itemize}
\item $W$ est un $\mathcal{F}_{t}$-mouvement brownien m-dimensionnel;
\item pour tout $t\geq 0$, on a les conditions de régularité 
\[
\mathbb{P}\big\{ \int_{0}^{t} \sum_{i=1}^{n} |b_{i}(s,X_{s})| \diff s <\infty \big\}=\mathbb{P}\big\{ \int_{0}^{t}\sum_{i=1}^{n}\sum_{j=1}^{m}|\sigma_{ij} (s,X_{s})|^{2}\diff s <\infty \big\}=1;
\]
\item pour tout $t\geq 0, i=1,\ldots,n$, on a presque sûrement  
\[
X_{t}^{i}=X_{0}^{i}+\int_{0}^{t}b_{i}(s,X_{s})\diff s +\sum_{j=1}^{m}\int_{0}^{t}\sigma_{ij}(s,X_{s})\diff W_{s}^{j}.
\]
\end{itemize}
\lipsum[5]
\end{Educ}
\end{frame}

 \end{document}

enter image description here

I can use align* so that the box can contians the equation but that take lot space that's why i want the equation be in one row and inside a box

\begin{align*}
&\mathbb{P}\big\{ \int_{0}^{t} \sum_{i=1}^{n} \abs{b_{i}(s,X_{s})} \diff s <\infty \big\}\\
&=\mathbb{P}\big\{ \int_{0}^{t}\sum_{i=1}^{n}\sum_{j=1}^{m}\abs{\sigma_{ij} (s,X_{s})}^{2}\diff s <\infty \big\}\\
&=1;
\end{align*}

enter image description here

Best Answer

Since the OP indicated that shrinking the font is acceptable, it can be done this way. First, you place the equation into a box. Then you scale/resize the box (requires graphicx package).

I have EDITED this answer to make the rescale automatic, if you pass the equation to the defined macro \fiteq{}. If the equation is larger than 85% of \textwidth, it will be shrunk to that size. For demonstration, both equations in this slide were passed through \fiteq. Only the first one was resized.

\documentclass[leqno,mathserif,hyperref={pdfpagelabels=false}]{beamer}
\usepackage{lmodern}
\usepackage{graphicx,bm}
%\usetheme{AnnArbor}
\usetheme{Luebeck}
\usepackage{tcolorbox}
\tcbuselibrary{breakable,skins}
%\setbeamercolor{structure}{blue}
\usepackage[tightpage]{preview}


\setbeamercovered{transparent}
\usepackage[T1]{fontenc}
\usepackage[english]{babel}
\usepackage{xcolor}
\usepackage{enumerate}
\newcommand{\diff}{\mathop{}\mathopen{}\mathrm{d}}

\usepackage{lipsum}
\usepackage{enumitem}


\colorlet{xlightblue}{blue!5}

\newtcolorbox{Educ}[1]{
 title=#1,
  beamer, 
  colback=xlightblue,
  colframe=blue!30,
  fonttitle=\bfseries,
  left=1mm,
  right=1mm,
  top=1mm,
  bottom=1mm,
  middle=1mm,
  breakable,
}
\newcommand\fiteq[1]{%
  \sbox{\mybox}{$\displaystyle#1$}%
  \ifdim\wd\mybox>.85\textwidth\resizebox{.85\textwidth}{!}{\usebox{\mybox}}%
  \else\usebox{\mybox}\fi%
}

\newsavebox{\mybox}

\begin{document}
\section[Plan]{Plan}
\section[Introduction]{Introduction}
\section[Example1]{Example1}
\section[Example2]{Example2}
\begin{frame}
\frametitle{Solution d'une EDS}
\begin{Educ}{Définition}
Une solution de l'EDS $E(b,\sigma)$  est un couple $(X,W)$ de processus adaptés sur un espace de probabilité filtré $(\Omega,\mathcal{F},\mathcal{F}_{t},\mathbb{P})$ qui satisfait les conditions usuelles, vérifiant :
\begin{itemize}
\item $W$ est un $\mathcal{F}_{t}$-mouvement brownien m-dimensionnel;
\item pour tout $t\geq 0$, on a les conditions de régularité 
\[
\fiteq{%
\mathbb{P}\big\{ \int_{0}^{t} \sum_{i=1}^{n} |b_{i}(s,X_{s})| \diff s <\infty \big\}=\mathbb{P}\big\{ \int_{0}^{t}\sum_{i=1}^{n}\sum_{j=1}^{m}|\sigma_{ij} (s,X_{s})|^{2}\diff s <\infty \big\}=1;
}
\]
\item pour tout $t\geq 0, i=1,\ldots,n$, on a presque sûrement  
\[\fiteq{%
X_{t}^{i}=X_{0}^{i}+\int_{0}^{t}b_{i}(s,X_{s})\diff s +\sum_{j=1}^{m}\int_{0}^{t}\sigma_{ij}(s,X_{s})\diff W_{s}^{j}.%
}\]
\end{itemize}
\lipsum[5]
\end{Educ}
\end{frame}

 \end{document}

enter image description here