Would it be possible to have the headings for lemma, theorem, corollary, definition, show in colour?

  • Welcome to TeX.SE! Can you please show us what you have and what you want?
    – Mensch
    Commented Apr 23, 2022 at 16:02
  • I have introduced usepackage[x11names]{xcolor}. Then using \color{blue}. But this only colours the user text rather that the theorem heading,
    – Veak
    Commented Apr 23, 2022 at 16:13
  • Please tell us whether you use the amsthm or the ntheorem package (or maybe some other package?) to help generate the theorem-like environments.
    – Mico
    Commented Apr 23, 2022 at 16:28
  • I am using amsthm, yes.
    – Veak
    Commented Apr 23, 2022 at 17:08
  • This question has nothing to do with amsmath. I'm removing that tag. Commented Apr 25, 2022 at 1:19

1 Answer 1


With the package amsthm you can use the enhanced \newtheorem command.

\newtheorem{⟨env name⟩}{⟨text⟩}[⟨parent counter⟩]

\newtheorem{⟨env name⟩}[⟨shared counter⟩]{⟨text⟩}

Then you add colors to the <text> as shown.


Observe that the environment defn used here does not include a shared counter, so it will start as <section number>. 1.



%*********************************************** put the colors <<<<<

    \ifx#1\right\relax \left.\fi#2#1\rvert}

    \section{A color Sampler}
            \biggl(\sum_{\,j\in\mathbf{n}}b_{ij}\hat x_i\biggr)
            =\biggl(\prod_{\,i\in\mathbf{n}}\hat x_i\biggr)\per \mathbf{B}
        where $\per \mathbf{B}$ is the permanent of $\mathbf{B}$.

        \sum^n_{l =0}\sum_{I_l \subseteq n}
        \prod_{i\in I_l}(b_{ii}-\lambda_i)
        \det\mathbf{B}^{(\lambda)}(I_l |I_l ),
    where $I_l =\{i_1,\dots,i_l \}$ and $\mathbf{B}^{(\lambda)}(I_l |I_l )$
    is the principal submatrix obtained from $\mathbf{B}^{(\lambda)}$
    by deleting its $i_1,\dots,i_l $ rows and columns.

    Let $(\A,\A',\A'')$ be a triple of arrangements. Then
    \[ \pi (\A,t) = \pi (\A',t) + t \pi (\A'',t). \]

    Let $(\A,\A',\A'')$ be a triple with respect to
    the hyperplane $H \in \A$. Call $H$ a \textit{separator}
    if $T(\A) \not\in L(\A')$.

        H_c=\frac1{2n}\sum^n_{l =0}(-1)^{l}
        D_{l}=\eval[2]{\sum_{I_{l}\subseteq \mathbf{n}}
                0,& \text{if }i\in I_{l}\quad\\% \quad added for centering
                1,& \text{otherwise}\end{smallmatrix}\right.\;,\;\; i=1,\dots,n}.

The math examples were taken from testmath.tex – Examples of the AMS-LaTeX package

  • Very good, very nice.
    – Veak
    Commented Apr 23, 2022 at 22:32
  • Typo: asmthm on the first line.
    – Simd
    Commented Apr 24, 2022 at 6:10
  • kindly, How can I do the same thing in lyx?
    – user35528
    Commented Nov 27, 2023 at 19:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .