0

Is there a way to have a transparent figure which can be made "solid" just like one can have a transperent block which can be made solid?

See figure enter image description here

only the caption is made transparent and not the actual figure code for generating the above figure

\documentclass[10pt]{beamer}
\mode<presentation> {
    \usetheme{Frankfurt}
}

\usepackage{graphicx} % Allows including images

\setbeamercovered{transparent}

\begin{document}

    \begin{frame}
    \begin{block}{t}
        test
    \end{block}
    %
    \pause
    \begin{block}{t}
        test
    \end{block}

\begin{figure}
    \includegraphics[width = 0.2\textheight]{example-image}
    \caption{1}
\end{figure}
\begin{figure}

\includegraphics[width = 0.2\textheight]{example-image}
\caption{2}
\end{figure}
\end{frame}

\end{document}

any help is highly appreciated

0

You could use the visible on style from this great answer. Note the proposed style is now provided by the aobs-tikz package. Instead of setting opacity to 0 just set it to another value that fits your need (I do not know the default opacity that beamer uses.

\documentclass[10pt]{beamer}
\usepackage{tikz}

\tikzset{
  invisible/.style={opacity=0.3},
  visible on/.style={alt=#1{}{invisible}},
  alt/.code args={<#1>#2#3}{%
    \alt<#1>{\pgfkeysalso{#2}}{\pgfkeysalso{#3}} % \pgfkeysalso doesn't change the path
  },
}

\newcommand{\includegraphicswithwisibility}[3]{
\begin{tikzpicture}
\node[visible on={#1}] at (0,0) {\includegraphics[#2]{#3}};
\end{tikzpicture}
}

\mode<presentation> {
    \usetheme{Frankfurt}
}

\usepackage{graphicx} % Allows including images

\setbeamercovered{transparent}

\begin{document}

\begin{frame}
\begin{block}{t}
    test
\end{block}
%
\pause
\begin{block}{t}
test
\end{block}

\begin{figure}
\includegraphicswithwisibility{<1->}{width = 0.2\textheight}{example-image}
\caption{1}
\end{figure}
\begin{figure}

\includegraphicswithwisibility{<2->}{width = 0.2\textheight}{example-image}
\caption{2}
\end{figure}
\end{frame}

\end{document}

enter image description here

EDIT

To use the aobs-tikz functionnalities, replace

\usepackage{tikz}
\tikzset{
  invisible/.style={opacity=0.3},
  visible on/.style={alt=#1{}{invisible}},
  alt/.code args={<#1>#2#3}{%
    \alt<#1>{\pgfkeysalso{#2}}{\pgfkeysalso{#3}} % \pgfkeysalso doesn't change the path
  },
}

with

\usepackage{aobs-tikz}
\tikzset{invisible/.style={opacity=0.3}}

as aobs-tikz loads tikz. However the package defines the invisible style as invisible/.style={opacity=0,text opacity=0} hence the re-definition of the style.

  • How would the code look like if one had 2 x 2 figures where each figures has to be transparent and then to turn solid one by one? – Jesper Hagelskjær Sep 23 '19 at 18:43
  • Basically, you should use the beamer overlay options like <*> (see the documentation for more explainations). Short explaination if you want to see somenthing between visible between step i and step j type <i-j> first and last may be omitted. For the 2*2 figure, you can use subfigure environments to place the graphics – BambOo Sep 23 '19 at 19:07

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.