5

I have a theorem environment, and I would like:

  • The text color of Problems and their contents to be a custom color (defined as `db' below)
  • The text color of Solutions to be a custom color (defined as `dg' below), BUT NOT it's contents. I would like the contents to remain black.
  • I would not like the contents of Problems and Solutionss to be italicized
  • Keep the same counter

    \usepackage{amsmath}
    \usepackage{amsthm}
    
    \definecolor{db}{RGB}{23,20,119}
    \definecolor{dg}{RGB}{2,101,15}
    
    \newtheoremstyle{dotless}{}{}{\itshape}{}{\bfseries}{}{ }{}
    \theoremstyle{dotless}
    %\theoremstyle{plain}% default
    \newtheorem{thm}{Theorem}%[section]
    \newtheorem{lem}[thm]{Lemma}
    \newtheorem{prop}[thm]{Proposition}
    \newtheorem{cor}[thm]{Corollary}
    \newtheorem{defn}[thm]{Definition}
    \newtheorem{examp}[thm]{Example}
    \newtheorem{conj}[thm]{Conjecture}
    \newtheorem{rmk}[thm]{Remark}
    \newtheorem{prob}[thm]{Problem}
    \newtheorem*{sol}{Solution}
    \newtheorem*{qu}{Question}
    \newtheorem*{as}{Assumptions}
    \newtheorem*{rs}{Restatement}
    \newtheorem*{ques}{Question}
    

I've found a few pages about relevant information, but most of it was regarding boxing theorems or changing the entire environment.

Werner
  • 603,163
Reck
  • 585
  • From the many-argumented \newtheoremstyle, I assume you use amsthm? – Ulrich Schwarz Jan 23 '14 at 05:28
  • Are you referring to a background color or you just want the text to receive some color? – Gonzalo Medina Jan 23 '14 at 05:28
  • @UlrichSchwarz Yes, amsthm, my apologies. I have added the package to the code. – Reck Jan 23 '14 at 05:31
  • @GonzaloMedina The actual color of the text. For Problems I would like the word and count of problem to have the text color, as well as the contents. For Solution, I would like it to have the text color green, but I would like its contents to remain black. I have updated the question to be a bit more specific. – Reck Jan 23 '14 at 05:33

1 Answers1

6

I would imagine the following is sufficient. That is, define a \newtheoremstyle for the prob and sol theorems each:

\newtheoremstyle{dotlessP}{}{}{\color{db}}{}{\color{db}\bfseries}{}{ }{}
\theoremstyle{dotlessP}
\newtheorem{prob}[thm]{Problem}
\newtheoremstyle{dotlessS}{}{}{}{}{\color{dg}\bfseries}{}{ }{}
\theoremstyle{dotlessS}
\newtheorem*{sol}{Solution}

enter image description here

Werner
  • 603,163
  • Worked perfectly, thank you!!! I didn't realize I could change the theorem style while keeping them in the same families. – Reck Jan 23 '14 at 05:47
  • How can I change the color of the heading only, in theorems,lemmas, definitions etc, to the red color. many thanks – user35528 Nov 28 '23 at 09:20
  • @user35528: It depends on how they are defined, since different packages provide different interfaces. – Werner Nov 28 '23 at 16:35