投影仪中的半透明数字(pdflatex)

时间:2009-10-15 20:13:40

标签: latex pdflatex beamer

我正在尝试使用数字叠加来避免为每张幻灯片创建不同的图像。叠加层适用于我包含的任何文本,但不适用于图形。例如:

\setbeamercovered{dynamic}
\begin{figure}\resizebox{10.0cm}{!}{
        \includegraphics{problem-a.pdf}
        Test A
        \pause
        \includegraphics{problem-b.pdf}
        Test B
        \pause
        \includegraphics{problem-c.pdf}
        Test C
}\end{figure}

第一张幻灯片上的“测试B”和“测试C”文字的结果是阴影,但对应“问题-b”和“问题-c”的数字没有阴影。

4 个答案:

答案 0 :(得分:4)

对于任何偶然发现这一点的人来说,到目前为止我发现的最好的事情是使用tikz并设置自定义透明模式:

\gdef\transparent@value{100}
\newcommand{\getbeamertrans}{
    \transparent@value/100
}
\newcommand{\set@transparent}[1]{\gdef\transparent@value{#1}}
\def\opaquenessCustom#1{%
\only<1->{%
  \beamer@actions{%
    \set@transparent{#1}%
    \expandafter\xdef\csname beamer@oldcolorhook%
    \the\beamer@coveringdepth\endcsname{\beamer@colorhook}%
    \expandafter\xdef\csname beamer@oldpgfextension%
    \the\beamer@coveringdepth\endcsname{\beamer@pgfextension}%
    {\globalcolorstrue\colorlet{beamer@freeze\the\beamer@coveringdepth}{bg}}%
    \xdef\beamer@colorhook{!#1!beamer@freeze%
      \the\beamer@coveringdepth\beamer@colorhook}%
    \gdef\beamer@pgfextension{!#1opaque}%
    \color{.}%
  }%
  {%
    \set@transparent{100}%
    \xdef\beamer@colorhook{\csname beamer@oldcolorhook%
      \the\beamer@coveringdepth\endcsname}%
    \xdef\beamer@pgfextension{\csname beamer@oldpgfextension%
      \the\beamer@coveringdepth\endcsname}%
    \color{.}%
  }}%
}%
\define@key{beamer@mixin}{transparent}[15]{%
    \def\beamer@uncoverbeforeactions{\ignorespaces\opaquenessCustom{#1}}%
    \def\beamer@uncoverafteractions{\ignorespaces\opaquenessCustom{#1}}%
}
\newcommand{\BeamerGraphic}[1]{%
    \begin{tikzpicture}%
        {\node[opacity=\getbeamertrans] {\includegraphics{#1}};}%
    \end{tikzpicture}%
}

答案 1 :(得分:0)

我做了类似的事情,做了以下事情:

\begin{figure}
                \includegraphics<1->{problem-a.pdf}
                \onslide<1->{Test A}                    
                \includegraphics<2->{problem-b.pdf}
                \onslide<1->{Test B}
                \includegraphics<3->{problem-c.pdf}
                \onslide<1->{Test C}
\end{figure}

也许它对你有用

答案 2 :(得分:0)

您可以在此document中找到有关在pdflatex中使用导入图形的更多信息。 寻找第12章:“覆盖两个导入的图形”。

答案 3 :(得分:0)

另一种方法可能是用半透明的形状临时覆盖图像:

\documentclass{beamer}
\usepackage{tikz}
\setbeamercovered{dynamic}

\begin{document}

\begin{frame}

\begin{figure}
    \includegraphics[width=2cm,page=1]{example-image-duck}
    Test A
    \pause
    \begin{tikzpicture}
    \node[anchor=south west,inner sep=0] (B) at (4,0) {\includegraphics[width=2cm,page=2]{example-image-duck}};
    \only<1>{%
        \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}
    Test B
    \pause  
     \begin{tikzpicture}
        \node[anchor=south west,inner sep=0] (B) at (4,0) {\includegraphics[width=2cm,page=3]{example-image-duck}};
        \only<1-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}  
    Test C
\end{figure}
\end{frame}

\end{document}

enter image description here