【问题标题】:Semi-transparent figures in beamer (pdflatex)投影仪中的半透明图形(pdflatex)
【发布时间】:2009-10-15 20:13:39
【问题描述】:

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

\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}

文本“Test B”和“Test C”的结果在第一张幻灯片上用阴影表示,但“problem-b”和“problem-c”对应的数字没有阴影。

【问题讨论】:

  • 您包含的图形是 pdf,您可以在外部编辑它们(使用 inkscape、adobe 的东西?等),或将它们转换为位图(使用 ghostscript、incscape 等)然后编辑并包含那些(使用paint、paint.net、gimp等)

标签: latex pdflatex beamer


【解决方案1】:

对于任何偶然发现这一点的人,到目前为止我发现的最好的事情是使用 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}%
}

【讨论】:

  • 我意识到这是一个老问题,但我无法解决这个问题......您包含哪些软件包?
  • @greschd:根据我的记录:subfigure、tikz、textcomp
【解决方案2】:

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

\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}

【讨论】:

  • 这仅适用于纯色背景,即使您有渐变(或其他自定义)背景也可以调整不透明度
【解决方案3】:

我做了以下类似的事情:

\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}

也许对你有用

【讨论】:

    【解决方案4】:

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2011-09-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-04-10
      相关资源
      最近更新 更多