4

I am creating a presentation with Beamer, using Berkeley as theme. On one frame I have the columns environment in order to put two blocks side by side. Each block has a header and contains a picture.

I would like to show both blocks on the first slide and then highlight only the first block on the second slide. I achieved this using the \uncover command but, nevertheless, the picture in the second block is still “fully” visible. On the contrary, I would like also the picture to be faded (note: NOT transparent).

In other words, this is what I get: enter image description here While this is what I would like to get:enter image description here

This is the MWE I am using:

\documentclass[11pt]{beamer}
\usepackage[english]{babel}
\usepackage{fontenc}
\usepackage[latin1]{inputenc}
\mode<presentation>
{
\usetheme{Berkeley}
\setbeamercovered{transparent}
}

%Title
\title[Example]{Example}

%*DOCUMENT*
\begin{document}

%*INTRODUCTION*
\section{Introduction}

%Trees
\subsection[Trees]{Trees}
\begin{frame}
\frametitle{Introduction:\\ Trees}
\begin{columns}[t]
 \begin{column}{0.48\textwidth}
 \uncover<1,2>{
  \begin{block}{Tree1}
   \begin{figure}
    \centering
        \includegraphics[width=\linewidth]{Tree.jpeg}
        \label{fig:a}
   \end{figure}
  \end{block}}      
 \end{column}
 \begin{column}{0.48\textwidth}
 \uncover<1>{
  \begin{block}{Tree2}
   \begin{figure}
    \centering
        \includegraphics[width=\linewidth]{Tree.jpeg}
        \label{fig:b}
   \end{figure}
  \end{block}}
 \end{column}
\end{columns}
\end{frame} 

\end{document}
4

Solution 1:

Produce a second, faded version of the image with some external tool of your choice.

\documentclass[11pt]{beamer}
\usepackage[english]{babel}
\usepackage{fontenc}
\usepackage[latin1]{inputenc}
\mode<presentation>
{
\usetheme{Berkeley}
\setbeamercovered{transparent}
}

%Title
\title[Example]{Example}

%*DOCUMENT*
\begin{document}

%*INTRODUCTION*
\section{Introduction}

%Trees
\subsection[Trees]{Trees}
\begin{frame}
\frametitle{Introduction:\\ Trees}
\begin{columns}[t]
 \begin{column}{0.48\textwidth}
 \uncover<1,2>{
  \begin{block}{Tree1}
   \begin{figure}
    \centering
        \includegraphics[width=\linewidth]{tree1}
        \label{fig:a}
   \end{figure}
  \end{block}}      
 \end{column}
 \begin{column}{0.48\textwidth}
 \uncover<1>{
  \begin{block}{Tree2}
   \begin{figure}
    \centering
        \includegraphics<2>[width=\linewidth]{tree2}
        \includegraphics<1>[width=\linewidth]{tree1}
        \label{fig:b}
   \end{figure}
  \end{block}}
 \end{column}
\end{columns}
\end{frame} 

\end{document}

enter image description here

Solution 2:

using tikz

\documentclass[11pt]{beamer}
\usepackage[english]{babel}
\usepackage{fontenc}
\usepackage[latin1]{inputenc}
\mode<presentation>
{
\usetheme{Berkeley}
\setbeamercovered{transparent}
}

%Title
\title[Example]{Example}
\usepackage{tikz}

%*DOCUMENT*
\begin{document}

%*INTRODUCTION*
\section{Introduction}

%Trees
\subsection[Trees]{Trees}
\begin{frame}
\frametitle{Introduction:\\ Trees}
\begin{columns}[t]
 \begin{column}{0.48\textwidth}
 \uncover<1,2>{
  \begin{block}{Tree1}
   \begin{figure}
    \centering
        \includegraphics[width=\linewidth]{tree1}
        \label{fig:a}
   \end{figure}
  \end{block}}      
 \end{column}
 \begin{column}{0.48\textwidth}
 \uncover<1>{
  \begin{block}{Tree2}
  \begin{figure}
    \begin{tikzpicture}
    \node[anchor=south west,inner sep=0] (B) at (4,0) {\includegraphics[width=\linewidth]{tree1}};
    \only<2>{%
        \fill [draw=none, fill=white, fill opacity=0.7] (B.north west) -- (B.north east) -- (B.south east) -- (B.south west) -- (B.north west) -- cycle;
    }
    \end{tikzpicture}
    \end{figure}
  \end{block}}
 \end{column}
\end{columns}
\end{frame} 

\end{document}

enter image description here

2

I am just building on top of @samcarter great answer and making a new command \uncovergraphics for it, for simple reuse (personally I place it in my custom beamer theme):

\newcommand<>{\uncovergraphics}[2][{}]{
    % Taken from: <https://tex.stackexchange.com/a/354033/95423>
    \begin{tikzpicture}
    \node[anchor=south west,inner sep=0] (B) at (4,0)
        {\includegraphics[#1]{#2}};
    \alt#3{}{%
        \fill [draw=none, fill=background, fill opacity=0.9] (B.north west) -- (B.north east) -- (B.south east) -- (B.south west) -- (B.north west) -- cycle;
    }
    \end{tikzpicture}
}

Note: I used the color named background, which is defined in my colortheme, but change it to your needs.

Then I simply use it like I would for \includegraphics:

\uncovergraphics<2->[width=\linewidth]{tree1}

EDIT:

There was this answer already that proposed the same idea, but redefines includegraphics so that it works in any case (e.g after pause command).

  • This should be the correct answer, bravo!!! – Anh-Thi DINH Dec 19 '18 at 14:26

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.