Here is a solution with ntheorem
. I define a wrap
theorem style, which simply uses \hangindent
and \hangafter
:
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage[thmmarks, amsmath, thref]{ntheorem}
\makeatletter
\newlength{\wrapboxlg}
\newtheoremstyle{wrap}%%
{\item[\hskip\labelsep\Large\theorem@headerfont ##1~##2\theorem@separator]
\mbox{}\endgraf\settowidth{\wrapboxlg}{\Large\theorem@headerfont ##1~##2\theorem@separator\normalsize\enspace}
\vskip-1.5\baselineskip
\hangindent = \wrapboxlg\hangafter =-2\noindent
}%
{\item[\hskip\labelsep\Large\theorem@headerfont ##1~##2]
\mbox{}\endgraf\settowidth{\wrapboxlg}{\Large\theorem@headerfont ##1~##2\theorem@separator\normalsize\enspace}
\vskip-1.5\baselineskip
\hangindent = \wrapboxlg\hangafter =-2\noindent
{\theorem@headerfont (##3)\theorem@separator}\ }%
\makeatother
\theoremstyle{wrap}
\theoremheaderfont{\upshape\bfseries}
\theorembodyfont{\normalfont}
\theoremseparator{.}
\newtheorem{Ex}{Example}[section]
\usepackage{lipsum}
\begin{document}
\setcounter{section}{1}
\setcounter{Ex}{22}
\begin{Ex}
\lipsum[11]
\end{Ex}
\bigskip
\begin{Ex}[This is the example title]
Sed feugiat. Cum sociis natoque penatibus et magnis dis par-
turient montes, nascetur ridiculus mus. Ut pellentesque augue
sed urna. Vestibulum diam eros, fringilla et, consectetuer eu, nonummy id,
sapien. Nullam at lectus. In sagittis ultrices mauris. Curabitur malesuada
erat sit amet massa. Fusce blandit. Aliquam erat volutpat. Aliquam euismod.
Aenean vel lectus. Nunc imperdiet justo nec dolor.
\end{Ex}
\end{document}

wrapfig
? – Ignasi Mar 14 '17 at 17:45wrapfigure
environment where thetcolorbox
mimes the title, i.e. something like here: tex.stackexchange.com/questions/358298/… – user31729 Mar 14 '17 at 17:51