I want to change the color of a single letter inside a custom \spacedallcaps
command. This command makes the specified text uppercase and changes the letter spacing.
When I introduce a \textcolor{color}{letter}
it will simply not work.
Also, taking the letter out of the \spacedallcaps
piece of text works only if the specified letter is at the end or at the beginning. But how can I manage this when the letter is in the middle of a word?
I tried the following :
\documentclass{article}
\usepackage{color}
\usepackage{textcase} % for \MakeTextUppercase
\usepackage{soul} % for letterspacing
\sodef\allcapsspacing{\upshape}{0.25em}{0.8em}{0.6em} % : {space between letters}{space between words}{0.6em}
\DeclareRobustCommand{\spacedallcaps}[1]{\MakeTextUppercase{\allcapsspacing{#1}}} % all caps with better spacing
\begin{document}
\spacedallcaps{One single colored letter}\\
\spacedallcaps{One single col}\hspace{0.25em}\textcolor{red}{O}\spacedallcaps{red letter}\\
\spacedallcaps{One single col}\hspace{0.25em}\textcolor{red}{O}\hspace{0.25em}\spacedallcaps{red letter}
\end{document}
But the result is far from being good :
One can always play with the \hspace
function but it is extremely tedious as it requires endless trials.
How can one achieve this automatically?