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

问题描述 投票:5回答:4

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

\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”的数字没有阴影。

latex pdflatex beamer
4个回答
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}%
}

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}

也许它对你有用


0
投票

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


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

© www.soinside.com 2019 - 2024. All rights reserved.