I found these beautiful box in Math ebooks which is created by Adobe Indesign, I tired mdframed
, tcolorbox
but I didn't try Tikz.
So could someone create them using LaTeX please?
\documentclass[a4paper]{article}
\usepackage{amsmath}
\usepackage{amsmath,amsfonts,amssymb}
\usepackage[svgnames]{xcolor}
\usepackage[most]{tcolorbox}
\tcbset{
lemmastyle/.style={enhanced, colback=white, colframe=blue!50, arc=0pt,
fonttitle=\bfseries, description color=Maroon,
colbacktitle=white, coltitle=DarkOliveGreen,
top=\tcboxedtitleheight,
boxed title style={arc=0pt},
attach boxed title to top right={yshift=-\tcboxedtitleheight/3,
xshift=-2mm}%
},
}
\newtcbtheorem{myLemma}{Type Text Here Without counter }{lemmastyle}{thm}
\usepackage{pifont}
\begin{document}
\begin{myLemma}{}{}
\end{myLemma}
\end{document}
Update:
Thanks, but when I use the code of @Alenanno, the equation doesn't fit the box. It's wider than it. Even when I put long text, the box is still too tight. I tired to fix it but with no luck. Could you please try? And could you make it breakable? (I mean by 'breakable' that the contents can be broken between two pages if the box contains long text.)
\documentclass[a4paper]{article}
\usepackage{amsmath}
\usepackage{amsmath,amssymb}% pour les maths
\usepackage{enumitem}
\usepackage[svgnames]{xcolor}
\usepackage[most]{tcolorbox}
\usepackage{tikz}
\tcbset{
lemmastyle/.style={enhanced, colback=white, colframe=blue!20, arc=0pt,
fonttitle=\bfseries, description color=Maroon,
colbacktitle=white, coltitle=DarkOliveGreen,
top=\tcboxedtitleheight,
boxed title style={arc=0pt},
attach boxed title to top left={yshift=-\tcboxedtitleheight/2,
xshift=4mm}%
},
}
\newtcbtheorem{myLemma}{Long text here without counter }{lemmastyle}{thm}
\usetikzlibrary{calc, fit}
\newcommand{\mybox}[4][8cm]{
\begin{figure}[!h]
\centering
\begin{tikzpicture}
\node[line width=0.5mm, rounded corners, text width=#1, draw=#2] (one) {\vspace{25pt}\\ #4};
\node[text=white,anchor=north east,align=center, minimum height=20pt] (two) at (one.north east) {#3};
\path[fill=#2]
(one.north west|-two.west) --
($(two.west)+(-1.5cm,0)$)
to[out=0,in=180] (two.south west) --
(two.south east) [rounded corners] --
(one.north east) --
(one.north west) [sharp corners] -- cycle;
\node[text=white,anchor=north east,align=center, minimum height=25pt, text height=2ex] (three) at (one.north east) {#3 \hspace*{.5mm}};
\end{tikzpicture}
\end{figure}
}
\usepackage{pifont}
\begin{document}
\mybox[6cm]{green!70!black}{Long Fancy Title}{
\begin{enumerate}
\item Show that
${\displaystyle D_2f(x,y) = \frac{\partial {}}{\partial{y}} \left ( \int_0^xg_1 (t,0) \ dt + \int_0^y g_2(x,s) \ ds \right)}$
\item prove that
${ \displaystyle \left(\forall x\in\mathbb{R} \right)\left(\forall y \in \mathbb{R} \right) x\neq y\, \text{and} \, x+y \neq 2 \implies x^{2}-2x \neq y^2-2y }$
\end{enumerate}
}
\begin{myLemma}{}{}
\begin{enumerate}
\item Show that
${\displaystyle D_2f(x,y) = \frac{\partial {}}{\partial{y}} \left ( \int_0^xg_1 (t,0) \ dt + \int_0^y g_2(x,s) \ ds \right)}$
\item prove that
${ \displaystyle \left(\forall x\in\mathbb{R} \right)\left(\forall y \in \mathbb{R} \right) x\neq y\, \text{and} \, x+y \neq 2 \implies x^{2}-2x \neq y^2-2y }$
\end{enumerate}
\end{myLemma}
\mybox[6cm]{blue!70!black}{Very Very Long Fancy Title}{Duis id dolor et ligula eleifend imperdiet. Mauris luctus, quam vitae viverra sagittis, dolor nibh imperdiet augue, eu venenatis eros augue et nisl. Vivamus nec fermentum est.}
Nullam libero augue, luctus et est vitae, fermentum aliquet libero. Maecenas dictum placerat eros, eu fermentum sem fermentum dapibus. Quisque non tellus nec magna feugiat luctus.
\end{document}
\biggl( ... \biggr)
instead of\left( .. \right)
, and don't enclose the whole math expression in a pair of braces, i.e. don't write${ ... }$
, just$ ... $
. Also, you likely want to have\text{ and }
instead of\;\text{and}\;
.