The following example only seems to work if I remove the hbox
option.
\documentclass{article}
\usepackage{tcolorbox}
\tcbuselibrary{listings,skins}
\newtcblisting[auto counter,list inside=example]{example}[2][]{%
title=#2,
#1,
%hbox,%hbox doesn't work?
center,
colback=green!20,
colbacktitle=green!50,
colframe=green,
%listing only,
lower separated=false,%remove lines inside
fonttitle=\bfseries\sffamily\large,coltitle=black,titlerule=0pt,enhanced,drop fuzzy shadow}
\begin{document}
\begin{example}[listing side text]{An example}
\textbf{bold text}
\textit{italics text}
\end{example}
\end{document}
If I include hbox
, tcolorbox
generates an error (Undefined control sequence. \end{example}
) and the content is misaligned (too little space between the left side and the right side):
If I use the option listing only
, everything works fine.
code output
of the TeX listing is treated aslower box
.listings only
displays the TeX code only in the upper part and with thishbox
works, of course#1
at the end of your code options, not right at the start, where following code options override your settings