It's not perfect (I personally don't like how the code cuts mid tag) but it should do the job.
Basically, I unpacked the tcblisting
environment and added a multicols
environment.
\documentclass{report}
\usepackage{tcolorbox}
\tcbuselibrary{minted}
\usepackage{blindtext}
\usepackage{multicol} % added package
\begin{document}
\blindtext
\begin{tcolorbox}[title=This is source code in another language (XML)]
%add special color box to list of listings
\makeatletter
\addcontentsline{lol}{subsection}{\kvtcb@title}
\makeatother
\begin{multicols}{2}
\begin{minted}{xml}
<project
name="Package tcolorbox"
default="documentation"
basedir="."
>
</project>
<project
name="Package tcolorbox"
default="documentation"
basedir="."
>
</project>
<project
name="Package tcolorbox"
default="documentation"
basedir="."
>
</project>
\end{minted}
\end{multicols}
\end{tcolorbox}
\blindtext
\end{document}
First, let me say, your settings are correct, but what you see are previewer artifacts. It depends on the previewer if you see the small lines or not.
I have two solutions how to get rid of these artifacts.
The first one changes your code just sligtly. Mainly, enhanced
is replaced by enhanced jigsaw
. The jigsaw variant uses another code to draw the frame which can be used for transparent boxes. Also, zero width lines are not displayed by many previewers:
\documentclass[]{report}
\usepackage{tcolorbox}
\tcbuselibrary{theorems}
\tcbuselibrary{skins}
\newtcbtheorem[number within=chapter]{thm}{Theorem}{
theorem style=change apart,
enhanced jigsaw,% <--- jigsaw
sharp corners,
boxrule=0pt,
toprule=1pt,bottomrule=1pt,
left=0.2cm,right=0.2cm,top=0.2cm,
titlerule=0.5em,
toptitle=0.1cm,
bottomtitle=-0.1cm,
colframe=white!25!black,colback=white,coltitle=white,
%title style={white!25!black}, & <---- remove
fonttitle=\bfseries,fontupper=\normalsize}{thm}
\begin{document}
\begin{thm}{Stokes}{stokes}
Let $D$ be a regular domain in an oriented $n$-dimensional manifold $M$,
and let $\omega$ be a smooth $(n-1)$ form of compact support. Then
\[\int_D d\omega = \int_{\partial D} \omega.\]
\end{thm}
\end{document}
This gives the expected result with Adobe Reader and SumatraPDF on Windows:
You may have a previewer which still shows left and right lines. In this case, I have a second solution. Here, I do not expect any artifacts because there is simply nothing drawn at all. The bottom rule is made by a borderline south
option:
\documentclass[]{report}
\usepackage{tcolorbox}
\tcbuselibrary{theorems}
\tcbuselibrary{skins}
\newtcbtheorem[number within=chapter]{thm}{Theorem}{
theorem style=change apart,
enhanced,
frame hidden,interior hidden,
sharp corners,
boxrule=0pt,
left=0.2cm,right=0.2cm,top=0.2cm,
toptitle=0.1cm+1pt,% <-- I used your values here
bottomtitle=-0.1cm+0.5em,% <-- I used your values here
colframe=white!25!black,colback=white,coltitle=white,
title style=white!25!black,
bottomrule=1pt,% <-- reserve space
borderline south={1pt}{0pt}{white!25!black},%---- draw line
fonttitle=\bfseries,fontupper=\normalsize}{thm}
\begin{document}
\begin{thm}{Stokes}{stokes}
Let $D$ be a regular domain in an oriented $n$-dimensional manifold $M$,
and let $\omega$ be a smooth $(n-1)$ form of compact support. Then
\[\int_D d\omega = \int_{\partial D} \omega.\]
\end{thm}
\end{document}
Best Answer
To include
listings
with some other content you can use alisting and comment
orcomment and listing
box. The listing part is written into the tcolorbox environment and the comment into the options.An example:
Update: combining listing and only text boxes
It's possible to use a
tcblisting
box to present only textual contents, without anylisting
. This can be done with optionstext only
orcomment only
. In the second case, the box contents is still declared intocomment
options and the environment content is avoided. With atext only
options, there's no need forcomment
and the text is written inside the environment. With this options, there's no need to declare different tcolorboxes for listing or non listing contents and all boxes share the same counter.