# How to produce theorems in which the color of heading and body of the theorem my differ?

I have tried the following code,

\documentclass{article}
\usepackage{amsthm,amssymb,xcolor}
\theoremstyle{plain}
\newtheorem{thm}{Theorem}
\begin{document}
\begin{color}{blue}{\begin{thm}\begin{color}{red}{The     theorem.}\end{thm}}\end{color}
\end{document}


But it isn't working. So, my questions are the following,

1. How can I solve the problem? As example, what will be the code for the following,

The heading will be colored blue and the body of the theorem will be colored, red.

1. What will be the codes of the same if the documentclass be book or memoir?

The simplest way is with the thmtools interface.

\documentclass{article}
\usepackage{amsthm,thmtools,xcolor}

\declaretheoremstyle[
bodyfont=\color{red}\normalfont\itshape,
]{colored}

\declaretheorem[
style=colored,
name=Theorem,
]{thm}

\begin{document}

\begin{thm}
The theorem.
\end{thm}

\end{document}


• What about other documentclasses? – user 170039 Dec 17 '15 at 13:53
• @user170039 I see no problem in using the same code. – egreg Dec 17 '15 at 13:53

You can achieve your result by declaring a newtheoremstyle as detailed on page 9 of the amsthm documentation:

% declare a new theorem style
\newtheoremstyle{mystyle}%
{3pt}% Space above
{3pt}% Space below
{\itshape\color{red}}% Body font
{}% Indent amount
{}% Theorem head spec (can be left empty, meaning ‘normal’)


You can then use it as:

% use the new theorem style
\theoremstyle{mystyle}
\newtheorem{thm}{Theorem}


Here's a complete example, the output is as in egreg's answer.

% arara: pdflatex
\documentclass{book}
\usepackage{amsthm,xcolor}

% declare a new theorem style
\newtheoremstyle{mystyle}%
{3pt}% Space above
{3pt}% Space below
{\itshape\color{red}}% Body font
{}% Indent amount

• the color{red} might have the side effect off increasing the vertical space separating environments. Sadly, I cannot reproduce this issue now. – pluton Oct 18 '16 at 21:29