# tight tcolorboxes

I want something like a tcolorbox but that it's width and heigth is just as large as its content, I mean that the margin of the box is as tight as possible and the box is centered, is important too that I can enter things like verbatim or lst listings, like I would be able to in a regular tcolorbox

• Welcome! \tcbox does precisely that. \documentclass{article} \usepackage{tcolorbox} \begin{document} \tcbox{A tight tcolorbox.} \end{document}. – user194703 May 11 at 5:35
• yeah but I can't use verbatim inside that \tcbox{} – Rodolfo Reyes S. May 11 at 19:32

tcolorbox already has this. You basically need the hbox key. For example,

\documentclass{article}
\usepackage[skins,listings]{tcolorbox}

\newtcblisting{mylisting}{%