There are similar questions around, for example:
The main question is that at the end of \textcolor
there is a \reset@color
which does not know what is the proper color to restore.
The problem evolves when beamer comes in. Basically the story is as follows:
- graphics loads
pdftex.def
or xetex.def
according to the current compiler.
pdftex.def
will define \reset@color
;
xetex.def
will define \reset@color@nostack
and \reset@color@stack
.
- beamer redefines
\reset@color
.
xetex.def
will decide whether \reset@color@nostack
or \reset@color@stack
will be the \reset@color
.
Here 1, 2, 3 happens at \documentclass{beamer}
and 4 happens at \begin{document}
.
Now you can see a problem: for XeLaTeX, since 4 happens after 3, reset@color
is redefined to be a non-beamer version.
The following code illustrate the difference more clearly
\documentclass{beamer}
\usepackage{tikz}
\setbeamercolor{background canvas}{bg=teal}
\setbeamercolor{normal text}{fg=white}
\begin{document}
\frame{
\tikz{
\node[text=yellow]{
Yellow
\textcolor{red}{Red}
What?
};
}
}
\end{document}
LaTeX gives
and XeLaTeX gives
Neither of them is expected. What we want is yellow. But reluctantly, white is better than black. And white is indeed done by the beamer version of \reset@color
and black is done by the xetex.def
version.
{\textcolor{red} Red}
.xelatex
makes 'ed Normal' in black.\Normal{..}
or something.