[Tuglist] How to write theorems etc. in a colour other than black.

Radhakrishnan CV tuglist@tug.org.in
Sun, 24 Mar 2002 10:49:25 +0530 (IST)


On Sun, 24 Mar 2002 at 10:08, indrajit@cal2.vsnl.net.in wrote:

   I wish to write the theorems, corollaries etc. of my paper in
   different colour ink (not in black) and the other part of the
   paper in black ink. Please suggest me the procedure.

\usepackage{color}
%
% \newtheorem needs a hack and here it goes
%
\makeatletter
\def\@begintheorem#1#2{\trivlist\color{#1color}
   \item[\hskip \labelsep{\bfseries #1\ #2}]\itshape}
\def\@opargbegintheorem#1#2#3{\trivlist\color{#1color}
      \item[\hskip \labelsep{\bfseries #1\ #2\ (#3)}]\itshape}
\makeatother 
 
\definecolor{Theoremcolor}{rgb}{1,0,0}
\definecolor{Lemmacolor}{rgb}{0,1,0}
\definecolor{Corollarycolor}{rgb}{0,0,1}

\newtheorem{thm}{Theorem}
\newtheorem{cor}{Corollary}
\newtheorem{lem}{Lemma}

\begin{document}

\begin{thm} Here is a theorem \end{thm}

\begin{lem}Here is a Lemma \end{lem}

\begin{cor}Here is a corollary \end{cor}

Here goes the text.
\end{document}   

The above code should output theorem in red color, lemma in green, 
corollary in blue and normal text in black. You can define colors as 
per your choice.

-- 
Radhakrishnan