7

MWE

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

\begin{document}

\textcolor{red}{\"\!\!\!{\textcolor{black}{o}}} %<-- ?

\end{document}

enter image description here

Is there a way to make this easier? Also work in other accents?

4 Answers 4

5

Accents over nothing are raised by 1ex:

\documentclass{article}
\usepackage{xcolor}

\newcommand{\cu}[2][red]{% colored umlaut
  \leavevmode
  \vbox{
    \halign{%
      \hfil##\hfil\cr
      \textcolor{#1}{\"{}}\cr
      \noalign{\nointerlineskip\kern-1ex}
      #2\cr
    }
  }%
}
\newcommand{\cc}[2][red]{% colored cedilla
 \leavevmode
 \begingroup
 \ooalign{\hfil#2\hfil\cr\hfil\textcolor{#1}{\c{}}\hfil\cr}%
 \endgroup
}

\begin{document}

\cu{O}zg\cu{u}r \"Ozg\"ur \cc[blue]{C}\cc{c}\cc{S}\cc{s} \c{C}\c{c}\c{S}\c{s}

\bigskip

\LARGE \cu{O}zg\cu{u}r \"Ozg\"ur

\end{document}

enter image description here

1
  • @egreg, funziona alla grande.
    – Özgür
    Commented Nov 23, 2017 at 14:59
8

You could use stackengine:

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

\newcommand{\my}[2]{\stackinset{c}{}{c}{1.1pt}{\color{red}#2}{\color{black}#1}}
\newcommand{\myc}[1]{\stackinset{c}{}{c}{.8pt}{#1}{\color{red}\c{#1}}}

\begin{document}
    S\my{o}{\"}\"{o}mething \c{c}\myc{c}o\c{s}\myc{s}a
\end{document}

enter image description here

3
  • \c{c} (ç) and \c{s} (ş) bad working.
    – Özgür
    Commented Nov 23, 2017 at 9:09
  • @Özgür See my renewed answer, this is the best I can do.
    – CarLaTeX
    Commented Nov 23, 2017 at 9:35
  • Your solution provided me with new information.
    – Özgür
    Commented Nov 23, 2017 at 15:00
8

Perhaps just wrap it in a macro, like so:

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

\newcommand{\oo}{\makebox[0pt][l]{\color{red}\"{}}o}
\newcommand{\cc}[1]{\makebox[0pt][l]{\color{red}\c{#1}}#1}

\begin{document}
    L\oo\oo{k} at this: \cc{c} and \cc{s}
\end{document}

enter image description here

3
  • \c{c} (ç) and \c{s} (ş) bad working.
    – Özgür
    Commented Nov 23, 2017 at 9:10
  • \newcommand{\cc}[1]{\makebox[0pt][l]{\color{red}\c{#1}}#1} and using \cc{c}/\cc{s} in the doc? It prints the black c on top of the red one, not sure it that would affect anything in your document
    – Troy
    Commented Nov 23, 2017 at 9:20
  • Your solution provided me with new information
    – Özgür
    Commented Nov 23, 2017 at 15:00
1

Here is a dirty solution, but it might work for weird accents as well:

Usually it is easier to get the letter without the dots than the dots without the letter. Therefore you can draw the complete letter in red, then draw the non-accent part over it:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{xcolor}
\begin{document}
    \textcolor{red}{ö}%% make a red ö
    \llap{o}%% print a black o over it
\end{document}

It doesn't really look good at lower zoom levels, but it might be useful if you don't know how to compose the character.

result

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .