22

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.

22

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}

enter image description here

  • 4
    "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
  • 4
    @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
  • 3
    @Kyle A little cleverness is a dangerous thing... – cfr Mar 26 '14 at 0:55
  • 3
    @DavidRicherby If you manage to find anything dirty in the word "coutput" then you've got much better association skills than I do. All I can think of is C++ which doesn't fulfill any definition of "sexy" that I can think of ;) – Christian Mar 26 '14 at 20:03
  • 3
    @Christian I am reminded of the patient who sees all sorts of sexual imagery in the Rorschach ink blots with which he is being evaluated. The psychiatric evaluator diagnoses him with an acute sexual dysfunction of some sort. The patient is incensed, blurting out "why, don't blame me...you're the one who brought the dirty pictures." – Steven B. Segletes Mar 26 '14 at 20:39
14

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.

click to enlarge

  • 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
11

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".

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.