Une autre solution avec `bclogo` :
\documentclass{article}
\usepackage{xcolor}
\usepackage[tikz]{bclogo}
\renewcommand\bcStyleTitre[1]{\centering
\smash{\raisebox{1em}{\colorbox{black}{\color{white}#1}}}}%
\begin{document}
\begin{bclogo}[barre=none,logo={}]{Titre}
Texte
\end{bclogo}
\end{document}
<img src="/upfiles/Screen_Shot_2019-08-18_at_17.16.10.png" style="width: 95%;"/>
---
Le code de la doc de Chemfig ce trouve ici http://mirrors.ctan.org/macros/generic/chemfig/chemfig-fr.tex La définition original du cadre :
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{fancybox,chemfig}
\parindent=0pt
\makeatletter
\newcommand\make@car@active[1]{%
\catcode`#1\active
\begingroup
\lccode`\~`#1\relax
\lowercase{\endgroup\def~}%
}
\newif\if@exstar
\newcommand\exemple{%
\begingroup
\parskip\z@
\@makeother\;\@makeother\!\@makeother\?\@makeother\:% neutralise frenchb
\@ifstar{\@exstartrue\exemple@}{\@exstarfalse\exemple@}}
\newcommand\exemple@[2][65]{%
\medbreak\noindent
\begingroup
\let\do\@makeother\dospecials
\make@car@active\ { {}}%
\make@car@active\^^M{\par\leavevmode}%
\make@car@active\^^I{\space\space}%
\make@car@active\,{\leavevmode\kern\z@\string,}%
\make@car@active\-{\leavevmode\kern\z@\string-}%
\make@car@active\>{\leavevmode\kern\z@\string>}%
\make@car@active\<{\leavevmode\kern\z@\string<}%
\exemple@@{#1}{#2}%
}
\newcommand\exemple@@[3]{%
\def\@tempa##1#3{\exemple@@@{#1}{#2}{##1}}%
\@tempa
}
\newcommand\exemple@@@[3]{%
\xdef\the@code{#3}%
\endgroup
\if@exstar
\begingroup
\fboxrule0.4pt
\let\breakboxparindent\z@
\def\bkvz@bottom{\hrule\@height\fboxrule}%
\let\bkvz@before@breakbox\relax
\def\bkvz@set@linewidth{\advance\linewidth\dimexpr-2\fboxrule-2\fboxsep}%
\def\bkvz@left{\vrule\@width\fboxrule\hskip\fboxsep}%
\def\bkvz@right{\hskip\fboxsep\vrule\@width\fboxrule}%
\def\bkvz@top{\hbox to \hsize{%
\vrule\@width\fboxrule\@height\fboxrule
\leaders\bkvz@bottom\hfill
\sffamily
\fboxsep\z@
\colorbox{black}{\kern0.25em\color{white}\footnotesize\lower0.5ex\hbox{\strut#2}\kern0.25em}%
\leaders\bkvz@bottom\hfill
\vrule\@width\fboxrule\@height\fboxrule}}%
\breakbox
\kern.5ex\relax
\ttfamily\footnotesize\the@code\par
\normalfont
\kern3pt
\hrule height0.1pt width\linewidth depth0.1pt
\vskip5pt
\rightskip0pt plus 1fill
\everypar{{\color{lightgray}\rlap{\vrule height0.1pt width\linewidth depth0.1pt}}\hskip0pt plus 1fill}%
\newlinechar`\^^M\everyeof{\noexpand}\scantokens{#3}\par
\endbreakbox
\endgroup
\else
\vskip0.5ex
\boxput*(0,1)
{\fboxsep\z@
\hbox{\sffamily\colorbox{black}{\leavevmode\kern0.25em{\color{white}\footnotesize\strut#2}\kern0.25em}}%
}%
{\fboxsep5pt
\fbox{%
$\vcenter{\hsize\dimexpr0.#1\linewidth-\fboxsep-\fboxrule\relax
\kern5pt\parskip0pt \ttfamily\footnotesize\the@code}%
\vcenter{\kern5pt\hsize\dimexpr\linewidth-0.#1\linewidth-\fboxsep-\fboxrule\relax
\everypar{{\color{lightgray}\rlap{\vrule height0.1pt width\dimexpr\linewidth-0.#1\linewidth-\fboxsep-\fboxrule depth0.1pt}}}%
\footnotesize\newlinechar`\^^M\everyeof{\noexpand}\scantokens{#3}}$%
}%
}%
\fi
\medbreak
\endgroup
}
\begin{document}
\exemple{Distance interatome}|\chemfig[atom sep=2em]{A-B}\par
\chemfig[atom sep=50pt]{A-B}|
\end{document}
<img src="/upfiles/Screen_Shot_2019-08-19_at_12.30.42.png" style="width: 95%;"/>
95%;"/>