چند نمونه زیر را امتحان کن
\documentclass{article}
\usepackage{cleveref}
\usepackage{tikz,lmodern,amssymb}
\usepackage[most]{tcolorbox}
\tcbuselibrary{skins}
\usepackage{ptext,xepersian}
\settextfont{Yas}
\begin{document}
\section{کادر با شماره}
\def\mtex{مقداری متن برای پر کردن داخل این کادر زیبا}
\def\onv{عنوان این کادر رنگی}
\newtcolorbox[auto counter,number within=section,
number freestyle={(\noexpand\arabic{\tcbcounter}.\thesection)},
]{phbox}[2][]{%
colback=yellow!15!white,colframe=blue!75!black,fonttitle=\bfseries,
title=تمرین~\thetcbcounter: #2,#1}
\begin{phbox}[label={myfreestyle}]{\onv}
\mtex\mtex \ref{myfreestyle}\mtex
\pageref{myfreestyle}.\mtex\mtex
\mtex\mtex\mtex
\end{phbox}
\begin{phbox}[label={myfreestyle}]{\onv}
\mtex\mtex \ref{myfreestyle}\mtex
\pageref{myfreestyle}.\mtex\mtex
\mtex\mtex\mtex
\end{phbox}
\tcbset{
defstyle/.style={fonttitle=\bfseries\upshape, fontupper=\slshape,
arc=0mm, colback=blue!5!white,colframe=blue!75!black},
theostyle/.style={fonttitle=\bfseries\upshape, fontupper=\slshape,
colback=red!10!white,colframe=red!75!black},
}
\newtcbtheorem[number within=section,crefname={definition}{definitions}]%
{Defi}{تعریف}{defstyle}{def}
\newtcbtheorem[use counter from=Defi,crefname={theorem}{theorems}]%
{Tho}{قضیه}{theostyle}{theo}
\newtcbtheorem[use counter from=Defi,crefname={corollary}{corollaries}]%
{Corollary}{Corollary}{theostyle}{cor}
\begin{Tho}{اینجا صورت قضیه را بنویسید.}{mb5}%
\mtex\mtex\ref{mb5}
\end{Tho}
\begin{Defi}{\onv}{diffbarkeit}
\mtex\mtex
\begin{equation*}
\lim\limits_{x\to x_0}\frac{f(x)-f(x_0)}{x-x_0}=
\lim\limits_{h\to 0}\frac{f(x_0+h)-f(x_0)}{h}
\end{equation*}
\end{Defi}
\newtcbtheorem[use counter from=Defi]{YetAnotherTheorem}{قضیه}%
{theorem style=change apart,enhanced,arc=0mm,outer arc=0mm,
boxrule=0mm,toprule=1mm,bottomrule=1mm,left=1mm,right=1mm,
titlerule=0mm,toptitle=0mm,bottomtitle=1mm,top=0mm,
colframe=red!50!black,colback=red!5!white,coltitle=red!50!black,
title style={top color=yellow!50!white,bottom color=red!5!white,
middle color=yellow!50!white},
fonttitle=\bfseries\normalsize,fontupper=\normalsize\itshape,
}{theo}
\begin{YetAnotherTheorem}{\onv }{n2}%
\mtex, $D\subseteq\mathbb{R}^n$ \mtex
$f\in C^{1}(D,\mathbb{R})$. \mtex
$[x_0,x]\subset D$
\begin{equation*}
f(x)-f(x_0) = \operatorname{grad} f(\xi)^{\top}(x-x_0)
\end{equation*}
\end{YetAnotherTheorem}
\end{document}
خروجی: