[Tex/LaTex] How to change color of operators (lim, log, etc.)

colormath-operators

How can I change the color of operators like "log", "lim" or the root symbol of \sqrt command?

Best Answer

You could tap into the primitive \mathop:

enter image description here

\documentclass{article}
\usepackage{xcolor,amsmath}
\DeclareMathOperator{\abc}{abc}

\let\oldmathop\mathop
\def\mathop#1{\oldmathop{\textcolor{red}{#1}}}
\let\oldsurd\surd
\def\surd{\textcolor{red}{\oldsurd}}

\begin{document}
\[
  \abc d \quad
  \sin \theta \quad
  \log_e \quad
  \lim_{x \rightarrow 0} \quad
  \int_a^b \quad
  \sqrt[n]{} \quad
  \surd
\]

\end{document}

The above is not thoroughly tested though...