3

I want a box created by tcolorbox to make a theorem without numbering. This is my code while setting up:

\usepackage{tcolorbox}
\tcbuselibrary{theorems}
\newtcbtheorem{theorem}{}
{colback=green!5,colframe=green!35!black,fonttitle=\bfseries}{th}

I've searched online and one tip that I got is using * when making a theorem, so it looks like this:

\begin{theorem*}{Theorem Name}
  This is a theorem.
\end{theorem*}

However, although the numbering is gone, there is still a colon (:) and a space. How do I get rid of it?enter image description here Also, what are other avilable colors of tcolorbox? (solved)

There is also a weird indent after the theorem ends, is there a way to systematically fix that?

enter image description here

MWE:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{tcolorbox}
\tcbuselibrary{theorems}
\newtcbtheorem{theorem}{}
{colback=green!5,colframe=green!35!black,fonttitle=\bfseries}{th}
\begin{document}
\begin{theorem*}{Theorem Name}
  This is a theorem.
\end{theorem*}
\textit{proof.}
\end{document}
4
  • Please, provide MWE, which demonstrate your problem. In tcolorbox ara available all colors defined by xcolor package.
    – Zarko
    Aug 12, 2021 at 0:40
  • @Zarko Sorry, what is MWE?
    – CELLSecret
    Aug 12, 2021 at 0:58
  • Minimal Working Example, a small but complete document beginning with \documentclass and ending with \end{document}, which has in its preamble loaded only to your problem related packages and defined commands/environments. So, it can be compiled as it is (and by this reproduce your problem in our computers)
    – Zarko
    Aug 12, 2021 at 1:06
  • @Zarko Alright. I've put it in the question.
    – CELLSecret
    Aug 12, 2021 at 1:18

1 Answer 1

6

Edit: From your comment follows, that you not need specialized theorem box as defined in the theorems library, but ordinary box (see third example in MWE below).

Try:

\documentclass{article}
\usepackage{tcolorbox}
\tcbuselibrary{theorems}

\newtcbtheorem[number within=section]{theorem}{Theorem}
{colback=green!5,colframe=green!35!black,fonttitle=\bfseries}{th}

\newtcolorbox{my theorem}[1]{
colback=red!5!white,colframe=red!75!black,fonttitle=\bfseries, title={#1}}

\begin{document}

\section{test}
\begin{theorem}{Theorem Name}
  This is a theorem.
\end{theorem}

\begin{theorem*}{Theorem Name}
  This is a theorem.
\end{theorem*}


\begin{my theorem}{Theorem name}
This is a theorem.
\end{my theorem}

\end{document}

enter image description here

If you like to have other colors, than you only need to select desired colors in theorems definitions. For example:

\newtcbtheorem[number within=section]{theorem}{Theorem}
{colback=yellow!30,colframe=orange!50!black,fonttitle=\bfseries}{th}

gives

enter image description here

Addendum:

In cases, when you like to have no indented text after mytherem box, you need to do the following:

  • define my therem as
\newtcolorbox{my theorem}[1]{%
colback=red!5!white,colframe=red!75!black,fonttitle=\bfseries, title={#1},
after=\par\noindent\ignorespacesafterend\ignorespaces}
  • between box and text had not to be empty line

An example:

\documentclass{article}
\usepackage{tcolorbox}

\newtcolorbox{my theorem}[1]{%
colback=red!5!white,colframe=red!75!black,fonttitle=\bfseries, title={#1},
after=\par\noindent\ignorespacesafterend\ignorespaces}

\usepackage{lipsum}
                          
\begin{document}

\begin{my theorem}{Theorem name}
This is a theorem.
\end{my theorem}
\lipsum*[66]
\end{document}

gives

\noindent\ignorespacesafterend\ignorespaces

8
  • I don't want the numbering at all. I just want Theorem Name without the leading My Theorem 1.1: nor My Theorem:
    – CELLSecret
    Aug 12, 2021 at 1:43
  • @CELLSecret, sorry, in your question is stated, that you like to have theorems without numbering. This is solved in answer.
    – Zarko
    Aug 12, 2021 at 1:48
  • so I have to ask a new question-? How should I describe it then
    – CELLSecret
    Aug 12, 2021 at 1:52
  • No, it is not needed. I will edit my answer ASAP.
    – Zarko
    Aug 12, 2021 at 1:56
  • Alright. Thanks
    – CELLSecret
    Aug 12, 2021 at 1:57

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .