# Umlaut dots in a different color

Is there an easy way to do the dots of an o-umlaut in a different color than the o? I've already tried using the textcolor function in the color package, but I suspect that's the wrong way to go. I know I could just manually rotate and position some colored dots over an o, but I'm hoping someone has already implemented this sort of functionality in a package I just don't know about yet.

-
I assume there is some reason you want to do this: it may have a bearing on the answer, so would be handy to know. –  Joseph Wright Mar 25 '14 at 20:48
@JosephWright It's a design choice, mostly. I've designed a logo that has that color scheme, and being able to mimic it in typography would be nice. Also, I'm just really curious whether this has been done! –  Kyle. Mar 25 '14 at 20:53

I come bearing cumlauts. If one looks closely, however, a slight size differential in dots is noted. One could remedy that if one were willing to spend the cycles to \scalebox the periods slightly smaller.

UPDATE: The MWE has been updated to highlight both the ability of the macro to work at different font sizes and to better reflect the obvious temperament of the readership.

\documentclass{article}
\usepackage{stackengine}
\usepackage{xcolor}
\newcommand\cumlaut[2][black]{\stackon[.33ex]{#2}{\textcolor{#1}{\kern-.04ex.\kern-.2ex.}}}
\begin{document}
\"o\"e\"a vs. \cumlaut[yellow]{u} \large\cumlaut[yellow]{u}
\Large\cumlaut[red]{o}\cumlaut[green]{e}\large\cumlaut[blue]{a}%
\normalsize\cumlaut[cyan!50]{a}\scriptsize\cumlaut[cyan!20]{a}
\end{document}


-
"Cumlauts"? Seriously? I mean, there might be children interested in LaTeX! I don't think their parents would approve of your German cumsounds. –  Christian Mar 25 '14 at 23:40
@Christian It's a concatenation of "color" and "umlaut"! I thought it was clever, and give it my full endorsement! –  Kyle. Mar 26 '14 at 0:25
@Kyle A little cleverness is a dangerous thing... –  cfr Mar 26 '14 at 0:55
@cfr I guess that's why \rlap and \llap were never augmented with a "center" lap. Who would want it? –  Steven B. Segletes Mar 26 '14 at 0:59
@Kyle I will just close by emphasizing that the macro name is one word, not two. –  Steven B. Segletes Mar 26 '14 at 10:09

You can overlap the accented letter and the non-accented one using \rlap:

\documentclass{article}

\usepackage{lmodern}
\usepackage[T1]{fontenc}
\usepackage{xcolor}
\usepackage{mathtools}

\let\umlaut\"
\newcommand\colorum[2]{\leavevmode{\rlap{\textcolor{#1}{\umlaut#2}}#2}}
\def\"{\colorum{red}}

\begin{document}

ab\"ab\colorum{blue}ob

AB\"AB\colorum{blue}OB

\end{document}


I re-defined \" to default to red, but it can be easily modified of course. In PDF viewers zoomed-out, the color seems to "leak behind the letter", zoomed-in and printed looks fine.

-
I wrote a similar answer, but was slower, so it's almost redundant. You do need the hspace thing I did before the rlap though (or something similar), because otherwise unlauts at the beginning of a paragraph doesn't work. –  pst Mar 26 '14 at 0:21
@pst Ah yeah, \leavevmode added ;) –  yo' Mar 26 '14 at 0:32

One idea is to print a coloured "ö" and then a black "o" on top of it. An advantage with that approach is that you don't have to handtune the position of the dots. They will appear in the right place, even with an italic or cursive font.

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}

\usepackage{color}

\newcommand\twocolour[2]{\hspace*{0pt}\rlap{\textcolor{red}{#1}}#2}
\DeclareUnicodeCharacter{00D8}{\twocolour{\O}{O}}
\DeclareUnicodeCharacter{00F8}{\twocolour{\o}{o}}

\let\origdiaeresis\"
\renewcommand\"[1]{\twocolour{\origdiaeresis #1}{#1}}

\newcommand\test{\par
Möbelträgerfüße' is a German word with some umlauts.
København is Copenhagen.

How about f\twocolour{i}{\i}sh'' (without the ligature in
fish'').
}

\begin{document}
\LARGE

\test

\textit{\test}

\textsl{\test}

\end{document}
`

More accents and more special characters can be added if "needed".

-