# Colored theorem style which does not color the name

I am using a thmtools to color my theorems. However, I want the name of this theorems to be uncolored. Now I have :

but I want the "test" in black.

The code I use for these theorems is :

\documentclass[10pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{amsthm}
\usepackage{thmtools}
\usepackage{color}

\definecolor{thmtitre}{RGB}{218,4,4}

\declaretheoremstyle[
bodyfont=\normalfont\itshape,
spaceabove = 6pt,
spacebelow = 6pt,
]{thmstyle}

\theoremstyle{thmstyle}
\newtheorem{thm}{Theorem}

\begin{document}
\begin{thm}[test]
hey
\end{thm}
\end{document}


and I did not find an option in thmtools to solve my problem

Thank you by advance !

• What precisely do you want to be colored? Aug 19 at 17:22
• If want that "Theorem 1" stills colored, but the rest in black Aug 19 at 17:26
• Please: 1) Envelop your code wihtin {} ... it's not a comment. 2) Complete the code. At least we need the preamble AND the call which shows your "hey"-print. Thanks Aug 19 at 17:41
• Yes sorry, I did not found the right way to write code. I have edited my question Aug 19 at 18:01

Here it is, with the headformat key.

Incidentally, needless to load inputenc with option [utf8]: it is what LaTeX expects by default. You don't have to load amsfonts either, since  amssymb does it for you.

\documentclass[10pt,a4paper]{article}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{amsthm}
\usepackage{thmtools}
\usepackage{xcolor}

\definecolor{thmtitre}{RGB}{218,4,4}

\declaretheoremstyle[
bodyfont=\normalfont\itshape,
spaceabove = 6pt,
spacebelow = 6pt,
]{thmstyle}

\theoremstyle{thmstyle}
\newtheorem{thm}{Theorem}

\begin{document}

\begin{thm}[test]
Successful test?
\end{thm}

\end{document}


• It works perfectly, thanks a lot ! Aug 19 at 19:24
• headformat=\normalfont\textcolor{thmtitre}{\bfseries\NAME\ \NUMBER}\NOTE (not \,) Aug 20 at 8:05
• @egreg: I tested first with ~ (which is approximately the same as \ , except it's unbreakable, if I'm not mistaken) and found it too large, that's why I used a thin space. Of course, it's a matter of personal taste. Aug 20 at 8:17
• @Bernard The space produced by ~ can be different from \  when following punctuation, otherwise they're the same; and they produce the standard spacing used everywhere. Anyway, \normalfont should be outside the scope of \color (and \textcolor is better). Aug 20 at 8:31
• @egreg: I've fixed the code – except the spacing: having tested, I really prefer a thin space (somewhat like the spacing between a number and the unit). Aug 20 at 8:52