%!TEX pdflatex

\documentclass{article}
\usepackage{customenvs}
\usepackage[scaled=0.925]{cabin}

%====BOX NUMBER
\newlength\tmpheightboxnumber
\newlength\tmpshadowoffsetboxnumber
\newlength\tmpwidthboxnumber

\defKV[TikzBoxNumber]{%
	bg color=\colorlet{bgboxnumber}{#1},%
	shadow color=\colorlet{shadowboxnumber}{#1},%
	font=\def\fontboxnumber{#1},%
	shadow offset=\setlength\tmpshadowoffsetboxnumber{#1},%
	num color=\colorlet{numboxnumber}{#1},%
}

\setKVdefault[TikzBoxNumber]{%
	bg color=darkgray,%
	shadow color=gray,%
	font=\bfseries,%
	shadow=true,%
	shadow offset=0.25pt,%
	num color=white,%
	width auto=true
}

\NewDocumentCommand\tkzboxnumber{ O{} m }{%
	\restoreKV[TikzBoxNumber]%
	\setKV[TikzBoxNumber]{#1}%
	{%
		\fontboxnumber%
		\getwideststring{0,1,2,3,4,5,6,7,8,9}%
		\xdef\tmplennumberbox{\xintfloateval{trunc(log10(#2),0)+1}}%
		\setlength\tmpwidthboxnumber{\tmplennumberbox\tmpwideststring}%
		\settoheight\tmpheightboxnumber{\hbox{0123456789}}%
		\begin{tikzpicture}[baseline=(char.base)]
			\ifboolKV[TikzBoxNumber]{width auto}%
			{\node[inner sep=0pt] (char) {\vphantom{0123456789}\makebox[\tmpwidthboxnumber][c]{#2}} ;}%
			{\node[inner sep=0pt] (char) {\vphantom{0123456789}#2} ;}%
			\useasboundingbox ([xshift=-0.5mm]char.west)--([xshift=-0.5mm,yshift=-0.15mm]char.south west)--([xshift=0.5mm,yshift=-0.5mm]char.south east)--([xshift=0.5mm,yshift=0.5mm]char.north east)--([xshift=-0.5mm,yshift=0.15mm]char.north west)--cycle;
			\ifboolKV[TikzBoxNumber]{shadow}%
			{%
				\filldraw[rounded corners=0.15\tmpheightboxnumber,shadowboxnumber,opacity=0.75] ([xshift=-0.5mm+\tmpshadowoffsetboxnumber,yshift=-\tmpshadowoffsetboxnumber]char.west)--([xshift=-0.5mm+\tmpshadowoffsetboxnumber,yshift=-0.15mm-\tmpshadowoffsetboxnumber]char.south west)--([xshift=0.5mm+\tmpshadowoffsetboxnumber,yshift=-0.5mm-\tmpshadowoffsetboxnumber]char.south east)--([xshift=0.5mm+\tmpshadowoffsetboxnumber,yshift=0.5mm-\tmpshadowoffsetboxnumber]char.north east)--([xshift=-0.5mm+\tmpshadowoffsetboxnumber,yshift=0.15mm-\tmpshadowoffsetboxnumber]char.north west)--cycle;
			}%
			{}%
			\filldraw[rounded corners=0.15\tmpheightboxnumber,bgboxnumber] ([xshift=-0.5mm]char.west)--([xshift=-0.5mm,yshift=-0.15mm]char.south west)--([xshift=0.5mm,yshift=-0.5mm]char.south east)--([xshift=0.5mm,yshift=0.5mm]char.north east)--([xshift=-0.5mm,yshift=0.15mm]char.north west)--cycle;
			\ifboolKV[TikzBoxNumber]{shadow}%
			{%
				\ifboolKV[TikzBoxNumber]{width auto}%
				{\draw[shadowboxnumber,opacity=0.75] ([xshift=\tmpshadowoffsetboxnumber,yshift=-\tmpshadowoffsetboxnumber]char) node[inner sep=0pt] {\vphantom{0123456789}\makebox[\tmpwidthboxnumber][c]{#2}} ;}
				{\draw[shadowboxnumber,opacity=0.75] ([xshift=\tmpshadowoffsetboxnumber,yshift=-\tmpshadowoffsetboxnumber]char) node[inner sep=0pt] {\vphantom{0123456789}#2} ;}
			}%
			{}%
			\draw[numboxnumber] (char) node[inner sep=0pt] {\vphantom{0123456789}\makebox[\tmpwidthboxnumber][c]{#2}} ;
		\end{tikzpicture}%
	}%
}

\usepackage{lipsum}
\setlength\parindent{0pt}

\begin{document}

\setKVdefault[TikzBoxNumber]{font=\bfseries\sffamily}

{\tkzboxnumber{1}}~\lipsum[1][1]\par

{\tkzboxnumber[width auto=false]{1}}~\lipsum[1][1]\par

{\tkzboxnumber{2}}~\lipsum[1][1]\par

{\tkzboxnumber{3}}~\lipsum[1][1]\par

{\tkzboxnumber[num color=yellow]{4}}~\lipsum[1][1]\par

$\ldots$

{\tkzboxnumber{11}}~\lipsum[1][1]\par


{\tkzboxnumber{77}}~\lipsum[1][1]\par

$\ldots$

{\tkzboxnumber{222}}~\lipsum[1][1]\par

{\tkzboxnumber{697}}~\lipsum[1][1]\par

{\tkzboxnumber[width auto=false]{697}}~\lipsum[1][1]\par

{\tkzboxnumber{800}}~\lipsum[1][1]\par

$\ldots$

{\tkzboxnumber{1564}}~\lipsum[1][1]\par

{\tkzboxnumber[width auto=false]{1564}}~\lipsum[1][1]\par

{\tkzboxnumber{2009}}~\lipsum[1][1]\par

{\tkzboxnumber{7124}}~\lipsum[1][1]\par

\end{document}