2

When defining the color of the text in a textblock environment (i.e. from textpos package), then the color of the text of the next frame is changed to that color too.

In the example below (compiled with lualatex), the text "n°1" is set to Gray, and in the next frame, the normal text ("Answers!") is Gray too.

screen shot

Code:

\documentclass[20pt, xcolor={usenames, dvipsnames}]{beamer}
\usepackage[overlay,absolute]{textpos}

\begin{document}

\begin{frame}
\begin{center}
\begin{textblock}{1}(0.5,0.5)\color{Gray}{n°1}\end{textblock}
$ \text{5}\times \text{9} $ = \color{BrickRed}{?}
\end{center}
\end{frame}

\begin{frame}
\begin{center}
Answers!
\end{center}
\end{frame}

\begin{frame}
\begin{center}
\begin{textblock}{1}(0.5,0.5)\color{Gray}{n°1}\end{textblock}
\only<1>{$ \text{5}\times \text{9} $ = \color{BrickRed}{?}}
\only<2>{$ \text{5}\times \text{9} $ = \color{OliveGreen}{\text{45}}}
\end{center}
\end{frame}

\end{document} 

I know a very simple workaround consists of wrapping "Answers!": color{Black}{Answers!} but:

  • I am not sure whether this is a normal behaviour (hence the cause is my document is badly written) or if it is a clash between packages (textpos documentation mentions such a clash but the workarounds it gives are not meant for lualatex or are about other commands that I do not use, like \pagecolor; nevertheless trying the mentionned tricks with lualatex did not work (same result)). Also, I tried in vain to add: \setbeamercolor{normal text}{fg=black,bg=white} before \begin{document}.

  • As the document is to be created automatically, I'd prefer to avoid adding such a workaround, if possible

So, is there anything to do (better than my workaround) to get the text of next frame in the normal color (here, black)? If possible, the answer should not use any other package (to limit the risk of other packages clash(es)).

3

\color is not a macro taking arguments, it's a switch. With how your code is set up, I suggest to use \textcolor{<color>}{<text>} instead. This has the additional advantage, that it is overlay aware, so if you'd like some text to switch colours between slides, you could do \textcolor<2>{green}{test}.

If you want to keep the colour command, using it within a group { \color{red} text } will prevent the colour from "leaking" out to the following text.

\documentclass[20pt, xcolor={usenames, dvipsnames}]{beamer}
\usepackage[overlay,absolute]{textpos}

\begin{document}

\begin{frame}
\begin{center}
\begin{textblock}{1}(0.5,0.5)\textcolor{Gray}{n°1}\end{textblock}
$ \text{5}\times \text{9} $ = \textcolor{BrickRed}{?}
\end{center}
\end{frame}

\begin{frame}
\begin{center}
Answers!
\end{center}
\end{frame}

\begin{frame}
\begin{center}
\begin{textblock}{1}(0.5,0.5)\textcolor{Gray}{n°1}\end{textblock}
\only<1>{$ \text{5}\times \text{9} $ = \textcolor{BrickRed}{?}}
\only<2>{$ \text{5}\times \text{9} $ = \textcolor{OliveGreen}{\text{45}}}
\end{center}
\end{frame}

\end{document} 

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.