5

I would like to color only a "tilde" on my letters. I read how to do this with Umlauts or other accent, but for my expression it seems different I think. Here is my expression :

\widetilde{E}^w

So, is there a way to color only the tilde and not the E^w ? Someone already has implemented it?

B_runo
  • 115
  • 4

4 Answers4

6

Changing color is not really supported, so you lose some metric information and a manual correction could be needed in some cases:

\documentclass{article}
\usepackage{mathtools,xcolor}

\newcommand{\colorwt}[2][2]{%
  {}\mspace{#1mu}\mathrlap{\textcolor{red}{\widetilde{\phantom{#2}}}}%
  \mspace{-#1mu}#2%
}

\begin{document}
X$\widetilde{E}^{w}$X$\widetilde{I}$X

X$\colorwt{E}^{w}$X$\colorwt{I}$X

X$\colorwt[3]{E}^{w}$X$\colorwt[3]{I}$X

X$\colorwt[2]{E}^{w}$X$\colorwt[2]{I}$X

X$\colorwt[1]{E}^{w}$X$\colorwt[1]{I}$X
\end{document}

The default value of the manual correction is 2, I have shown what's the effect when you specify a different value.

enter image description here

egreg
  • 1,121,712
4

Quite simply:

 $\textcolor{red}{\widetilde{\textcolor{black}{E\,}}}²!^w $

I had to make a small correction to have a correct positioning of the accent, though.

enter image description here

Bernard
  • 271,350
1

Grouping does the work:

\documentclass{article}

\usepackage{color}

\begin{document}


${\color{green}\widetilde{\color{black}{E}}}^w$

\end{document}

enter image description here

0

I finally found it, see the link below :

How to color over/underline, or other ways to highlight substituted expressions in proofs?

and change \overline in the newcommand by \widetilde or any accent you want.

B_runo
  • 115
  • 4