[Tex/LaTex] Change Color of Proof

color

I'm using the \begin{proof} of the amsthm package. And I want to change the color of everything in this environment. Currently, I use {\color{blue} \begin{proof} ... \end{proof}}. But I need to do this every time. How can I do it more easily, please? Thank you!

Best Answer

Prepend \proof (similar to \begin{proof}) with \color{blue} using the following:

enter image description here

\documentclass{article}

\usepackage{amsthm,xcolor}
\usepackage{mathtools}% To colour equation numbers in proof

\let\oldproof\proof
\renewcommand{\proof}{\color{blue}\oldproof}

\begin{document}

\begin{proof}
This is a proof. Here is an equation:
\begin{equation} f(x) = ax^2 + bx + c \end{equation}
Here is another equation, this time unnumbered
\[ f(x) = ax^2 + bx + c \]
And the end of the proof.
\end{proof}

Some text between proofs.
\begin{equation} f(x) = ax^2 + bx + c \end{equation}

\begin{proof}[abc]
This is a proof. Here is an equation:
\begin{equation} f(x) = ax^2 + bx + c \end{equation}
Here is another equation, this time unnumbered
\[ f(x) = ax^2 + bx + c \]
And the end of the proof.
\end{proof}

\end{document}

The grouping provided by \begin...\end limits the scope of \color{blue} to everything inside the proof environment (including math content).

I've added mathtools above since it redefines the way tags work under amsmath. In that sense, it automatically colours equation numbers inside the proof environment as well. Without it, you may be left with black equation numbers and have to redefine the tag-form yourself.

The proof environment takes an optional argument. In such cases it may be safer to use \LetLtxMacro (from the similarly-named package) instead of a pure \let. See When to use \LetLtxMacro?

Related Question