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}
before skip
and after skip
provide such spaces. You will not notice them if they are too small.
\documentclass{report}
\usepackage{tcolorbox}
\tcbuselibrary{theorems}
\newtcbtheorem[number within=section]{mytheo}{My Theorem}
{colback=green!5,colframe=green!35!black,fonttitle=\bfseries,before
skip=20pt plus 2pt,after skip=20pt plus 2pt}{th}
\begin{document}
Add space below this text.
\begin{mytheo}{This is my title}{theoexample}
This is the text of the theorem. The counter is automatically assigned and,
in this example, prefixed with the section number.
\end{mytheo}
Add space above this text.
\end{document}
Best Answer
The
define
environment specified via\newtcbtheorem
requires two mandatory parameters, both of which can be empty{}
. The first is the title and the second is the<marker>
used as a\label
and can be referenced via\ref{def:<marker>}
:Including the
hyperref
package makes the reference a link. You can also use thenameref
package for more options.Code: