I have examined this question, where the OP wanted to discard the effect of \color
when it is used inside an other \textcolor
. @Rmano was faster than me and answered the question with the same way that I wanted.
However, "our" solution has a little problem about an extra whitespace:
I have tried to fix it many ways like \relax
, \gobble
, \xspace
\ignorespaces
, but I was shooting randomly and couldn't find the solution. Do you have any ideas?
\documentclass{article}
\usepackage{color}
\newcommand{\Textcolor}[2]{%
\textcolor{#1}{\renewcommand{\color}[1]{}#2}%
}%
\begin{document}
Some text
Some {\color{blue} text}
Some \textcolor{blue}{text}
\textcolor{red}{Some {\color{blue} text}}
\Textcolor{red}{Some {\color{blue} text}} %should produce the same
\Textcolor{red}{Some {\color{blue}text}} %should produce the same
\textcolor{red}{Some {\color{blue} text}}
\end{document}