# Creating a specific theorem style

I was wondering how to create a theorem environment similar to the following example:

Specifically, the environment should resemble the box that contains "Claim -- The function g is linear".

This comes from a document written by Evan Chen, who has his style files uploaded here. I have tried to mimic what I believed to be the relevant code (as there's a lot of stuff there that isn't related to this), to no avail. I have attached my attempt below, but it may be better to ignore it.

\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{mdframed}
\usepackage{thmtools}
\usepackage{tikz}
\usepackage{xcolor}
\usepackage[framemethod=TikZ]{mdframed}
\mdfdefinestyle{mdgreenbox}{%
linewidth=0.5pt,
skipabove=12pt,
frametitleaboveskip=5pt,
frametitlebelowskip=0pt,
skipbelow=2pt,
frametitlefont=\bfseries,
innertopmargin=4pt,
innerbottommargin=8pt,
nobreak=true,
backgroundcolor=SpringGreen!15,
rightline=false,
leftline=false,
topline=false,
bottomline=false,
linecolor=green,
}
\declaretheoremstyle[
mdframed={style=mdgreenbox},
]{thmgreenbox}
\declaretheorem[style=thmgreenbox]{thrm1}


This returns an error, one for xcolor not recognizing the colors, and the following.

l.17        \mdfdefinestyle
{mdgreenbox}{%
[]
There has now been an attempt to load it with options
[framemethod=TikZ]
,framemethod=TikZ
to your \documentclass declaration may fix this.
Try typing  <return>  to proceed.

Package thmtools Info: Key mdframed' (with value style=mdgreenbox')
(thmtools)             is not a known style key.
(thmtools)             Will pass this to every \declaretheorem
(thmtools)             that uses style=thmgreenbox' on input line 39.
Package thmtools Info: Automatically pulling in thmdef-mdframed' on input line 40.
(/usr/local/texlive/2017/texmf-dist/tex/latex/thmtools/thmdef-mdframed.sty
Package: thmdef-mdframed 2014/04/21 v66
)
\c@thrm1=\count282
(/compile/output.aux)
\openout1 = output.aux'.


I am looking for a way to mimic the environment more than to fix my methods.

• Have a look at tcolorbox. – user156344 Feb 21 at 6:46
• The obvious and immediate issues with your code are that you load the package mdframed twice (and with conflicting options, which causes an error): You have \usepackage{mdframed} and then a bit later \usepackage[framemethod=TikZ]{mdframed}. You should probably remove the first of those calls. The colours are not recognised because you loaded xcolor without an additional option to provide more colours, you probably want to load it as \usepackage[dvipsnames]{xcolor} or \usepackage[svgnames]{xcolor} for SpringGreen to work. – moewe Feb 21 at 6:54
• Other than that I agree with JouleV that tcolorbox is worth a look. It does a similar job as mdframed but offers a lot more options (at least that's what I think). tcolorbox is also still being actively maintained, whereas mdframed development has stalled in recent years (that need not necessarily be a bad thing, but it could mean that you are on your own when you find bugs or want a new feature). See also tex.stackexchange.com/q/135871/35864 – moewe Feb 21 at 6:57

A solution using the tcolorbox package as suggested by @JouleV :

\documentclass{article}
\usepackage[theorems]{tcolorbox}

\newtcbtheorem{myclaim}{Claim --\ }{
coltitle=purple,
colback=blue!10,
colframe=green!70!blue,
detach title,
boxrule=0pt,
leftrule=2pt,
attach title to upper,
sharp corners,
left=1mm,
}{}

\begin{document}
\begin{myclaim*}{}
The function $g$ is linear
\end{myclaim*}
\end{document}
`