[Tex/LaTex] Beamer overlays: changing font between slides

beamerboldformattingtikz-pgf

I am creating slides with overlays in Beamer, using TiKZ to create a figure consisting mainly of text nodes. The idea is that different parts of the figure are highlighted on each slide. Initially it all appears in a light gray (I'm using "seagull" colours with a white background), and on each slide a different part of the figure is shown in full colour.

I've achieved this by basically drawing the figure twice: once in light gray, and then drawing it again using a sequence of "onslide" commands. However, what I'd like is for text in a node to appear as bold face when it appears in colour. Here is an MWE:

\documentclass{beamer}

\usepackage{tikz}

\title{A test} 
\author{Me} 
\date{\today}

\begin{document} 

\begin{frame}   
  \maketitle 
\end{frame}

\begin{frame}{This is the test slide}

  \begin{tikzpicture}[remember picture,overlay,color=lightgray]
    \draw (current page.south west)++(1,1) coordinate (SW);
    \draw (SW)++(2,1) node {First bit of text};
    \draw (SW)++(4,3.5) node {Second bit of text};
    \draw (SW)++(6,6) node {Third and final text};
    \onslide<2>{\draw[color=blue] (SW)++(2,1) node {First bit of text};}
    \onslide<3>{\draw[color=blue] (SW)++(4,3.5) node {Second bit of text};}
    \onslide<4>{\draw[color=blue] (SW)++(6,6) node {Third and final  text};}     
  \end{tikzpicture}    
\end{frame}

\end{document}

Now there may well be an easier and more natural way of doing this; on the other hand it means I can position text wherever I want.

If I include a text = \bfseries in the second part of the above, then it seems to stick, and the lightgray text is also bold, which I don't want. So – any ideas on how text will appear in a color and bold, and then go back to lightgray and normal when it's not highlighted?

Best Answer

Is this what you want to achieve?

Draw the lightgray parts only on a specified number of slides using the \only<frame_number> command and afterwards use \onlide<2> (or another frame number` to draw the text in other font/color etc.

\documentclass{beamer}

\usepackage{tikz}

\title{A test} 
\author{Me} 
\date{\today}

\begin{document} 

\begin{frame}   
  \maketitle 
\end{frame}

\begin{frame}{This is the test slide}

  \begin{tikzpicture}[remember picture,overlay,color=red]
    \draw (current page.south west)++(1,1) coordinate (SW);
    \only<1,3-4>{\draw (SW)++(2,1) node {First bit of text};}
    \only<1-2,4>{\draw (SW)++(4,3.5) node {Second bit of text};}
    \only<1-3>  {\draw (SW)++(6,6) node {Third and final text}};
    \only<2>{\draw[color=blue] (SW)++(2,1) node {\textbf{First bit of text}};}
    \only<3>{\draw[color=blue] (SW)++(4,3.5) node {\textbf{Second bit of text}};}
    \only<4>{\draw[color=blue] (SW)++(6,6) node {\textbf{Third and final  text}};}     
  \end{tikzpicture}    
\end{frame}

\end{document}

I changed from lightgray to red just for the snapshot, because lightgray is hard to recognize in a screenshot.

enter image description here

Related Question