在 beamer 的参考书目中设置透明图标

在 beamer 的参考书目中设置透明图标

我想\uncover在特定覆盖层中引用。问题是参考书目的项目图标(本例中为文章)未设置为透明,但文本是透明的。

我怎样才能使图标也透明?

以下是 MWE:

\documentclass{beamer}

\begin{document}

\begin{frame}
\setbeamercovered{transparent}

\begin{thebibliography}{1}
\uncover<1>{
    \setbeamertemplate{bibliography item}[article]
    \bibitem{}
    \scriptsize Doe, J. (1975).
    \newblock\scriptsize Title of the first paper.
    \newblock {\em Journal.}
}
\uncover<1-2>{
    \setbeamertemplate{bibliography item}[article]
    \bibitem{}
    \scriptsize Doe, J. (1980).
    \newblock\scriptsize Title of the second paper.
    \newblock {\em Journal.}
}
\end{thebibliography}

\end{frame}

\end{document}

输出如下:

输出gif

答案1

有一个相关问题。我认为 Jealie 的答案似乎就是你想要的,但我无法让它发挥作用。

一般问题是透明度的生成方式。使用自定义(文本)符号可能是一种选择(因为文本没有问题)或 tikz 图片。这导致我花了太多时间在 tikz 中重新创建文章图标(尽管更简约的图标可能会更好),并想出了这个解决方法:

在此处输入图片描述

生成者:

\documentclass{beamer}

\usepackage{tikz}
\begin{document}

\begin{frame}

\setbeamercovered{transparent}

\setbeamertemplate{bibliography item}{
\begin{tikzpicture}[color=gray,scale=0.4,very thin]
\draw (0.1,0.82)--(.5,.82); %headline
\draw (0.15,0.72)--(.55,.72); %abstact
\draw (0.15,0.62)--(.55,.62);

\draw (0.08,0.48)--(.32,.48); %left column
\draw (0.08,0.38)--(.32,.38);
\draw (0.08,0.28)--(.32,.28);
\draw (0.08,0.18)--(.32,.18);
\draw (0.08,0.1)--(.32,.1);

%right column
\draw[fill=blue!70!black,draw=none] (0.4,0.5)--(.62,.5)--(.62,.4)--(0.4,0.4) --(0.4,0.5);
\draw[fill=red!70!black,draw=none] (0.4,0.4)--(.62,.4)--(.62,.3)--(0.4,0.3) --(0.4,0.4);
\draw[fill=green!70!black,draw=none] (0.4,0.3)--(.62,.3)--(.62,.2)--(0.4,0.2) --(0.4,0.3);
\draw (0.4,0.1)--(.62,.1);

%page
\draw[black,fill=yellow!40!gray,fill opacity=0.3,line width=0.4pt] (0,0) -- (0,.95) -- (0.5,.95) -- (.7,0.75) -- (.7,0) --(0,0);
\draw[black,fill=black!10!brown,join=round] (0.5,.95) -- (0.7,0.75) -- (0.5,0.75) --(0.5,.95);
\end{tikzpicture}
}
\begin{thebibliography}{1}

\uncover<1>{
    \bibitem{}
    \scriptsize Doe, J. (1975).
    \newblock\scriptsize Title of the first paper.
    \newblock {\em Journal.}
}
\uncover<1-2>{
    \bibitem{}
    \scriptsize Doe, J. (1980).
    \newblock\scriptsize Title of the second paper.
    \newblock {\em Journal.}
}

\end{thebibliography}

\end{frame}

\end{document}

答案2

编辑:有两种方法可以获得所需的透明效果。仅使用beamer代码的原始解决方案在方法 2 中给出。更简单,也许更优雅的解决方案基于transparent包的方法如方法 1 所示。

方法 1

使用该包transparent可以创建一个简单的透明环境,使文本和图标在所需的覆盖层上透明。

输出:

输出方法 1

代码:

\documentclass{beamer}

% Required package
\usepackage{transparent}

% Create transparent environment
\newenvironment<>{transpenv}{\bgroup\only#1{\transparent{0.2}}}{\egroup}

\begin{document}

\begin{frame}

\setbeamercovered{transparent}

\begin{thebibliography}{1}

% Normal article entry
\setbeamertemplate{bibliography item}[article]
\bibitem{}
\scriptsize Doe, J. (1975).
\newblock\scriptsize Title of the first paper.
\newblock {\em Journal.}

% Transparent article entry on overlay 2
\begin{transpenv}<2>
\setbeamertemplate{bibliography item}[article]
\bibitem{}
\scriptsize Doe, J. (1980).
\newblock\scriptsize Title of the second paper.
\newblock {\em Journal.}
\end{transpenv}

% % BOOK % %        

% Normal book entry

\setbeamertemplate{bibliography item}[book]
\bibitem{}
\scriptsize Doe, J. (2000).
\newblock\scriptsize {\em Title of the first book.}
\newblock Editorial.

% This changes the transparency of the text
\begin{transpenv}<2>
\setbeamertemplate{bibliography item}[book]
\bibitem{}
\scriptsize Doe, J. (2010).
\newblock\scriptsize {\em Title of the second book.}
\newblock Editorial.
\end{transpenv}

% % ONLINE % %

% Normal web entry
\setbeamertemplate{bibliography item}[online]
\bibitem{}
\scriptsize Doe, J. (2001).
\newblock\scriptsize {\em Title of the first website.}
\newblock The website.

% This changes the transparency of the text
\begin{transpenv}<2>
\setbeamertemplate{bibliography item}[online]
\bibitem{}
\scriptsize Doe, J. (2014).
\newblock\scriptsize {\em Title of the second website.}
\newblock The website.
\end{transpenv} 

\end{thebibliography}

\end{frame}

\end{document}

方法 2

在对 的源代码进行一些研究后,beamer我找到了一个令人满意的解决方案,因为参考书目的透明图标确实可用这里。例如,透明beamericonarticle.pdf的是beamericonarticle.20.pdf

因此,我们的想法是利用\uncover文本的透明度,并在每个覆盖层上选择适当的图标。如果您想要与 的原始显示和参考书目图标对齐保持一致,这会有点棘手,因此您需要准确模仿它的功能。这就是新命令、及其透明版本、、的beamer原因。\iconarticle\iconbook\icononline\iconarticletransparent\iconbooktransparent\icononlinetransparent

输出:

输出方法 2

代码:

\documentclass{beamer}

% Commands to center properly the figures (codes constructed from the information in beamerinnerthemedefault.sty and beamerbaseauxtemplates.sty)
\newcommand{\iconarticle}{\lower3.5pt\hbox{\hskip2pt\includegraphics[width=11pt,height=14pt]{{beamericonarticle}.pdf}}}
\newcommand{\iconarticletransparent}{\lower3.5pt\hbox{\hskip2pt\includegraphics[width=11pt,height=14pt]{{beamericonarticle.20}.pdf}}}
\newcommand{\iconbook}{\lower2pt\hbox{\includegraphics[width=14pt,height=12pt]{{beamericonbook}.pdf}}}
\newcommand{\iconbooktransparent}{\lower2pt\hbox{\includegraphics[width=14pt,height=12pt]{{beamericonbook.20}.pdf}}}
\newcommand{\icononline}{\lower2pt\hbox{\includegraphics[width=14pt,height=14pt]{{beamericononline}.pdf}}}
\newcommand{\icononlinetransparent}{\lower2pt\hbox{\includegraphics[width=14pt,height=14pt]{{beamericononline.20}.pdf}}}

\begin{document}

\begin{frame}

\setbeamercovered{transparent}

\begin{thebibliography}{1}

% % ARTICLE % %

% Normal article entry
\setbeamertemplate{bibliography item}[article]
\bibitem{}
\scriptsize Doe, J. (1975).
\newblock\scriptsize Title of the first paper.
\newblock {\em Journal.}

% This chooses the icon (transparent or not)
\only<1>{\setbeamertemplate{bibliography item}{\iconarticle}}
\only<2>{\setbeamertemplate{bibliography item}{\iconarticletransparent}}

% This changes the transparency of the text
\uncover<1>{
\bibitem{}
\scriptsize Doe, J. (1980).
\newblock\scriptsize Title of the second paper.
\newblock {\em Journal.}
}

% % BOOK % %        

% Normal book entry
\setbeamertemplate{bibliography item}[book]
\bibitem{}
\scriptsize Doe, J. (2000).
\newblock\scriptsize {\em Title of the first book.}
\newblock Editorial.

% This chooses the icon (transparent or not)
\only<1>{\setbeamertemplate{bibliography item}{\iconbook}}
\only<2>{\setbeamertemplate{bibliography item}{\iconbooktransparent}}

% This changes the transparency of the text
\uncover<1>{
\bibitem{}
\scriptsize Doe, J. (2010).
\newblock\scriptsize {\em Title of the second book.}
\newblock Editorial.
}

% % ONLINE % %

% Normal web entry
\setbeamertemplate{bibliography item}[online]
\bibitem{}
\scriptsize Doe, J. (2001).
\newblock\scriptsize {\em Title of the first website.}
\newblock The website.

% This chooses the icon (transparent or not)
\only<1>{\setbeamertemplate{bibliography item}{\icononline}}
\only<2>{\setbeamertemplate{bibliography item}{\icononlinetransparent}}

% This changes the transparency of the text
\uncover<1>{
    \bibitem{}
    \scriptsize Doe, J. (2014).
    \newblock\scriptsize {\em Title of the second website.}
    \newblock The website.
}

\end{thebibliography}

\end{frame}

\end{document}

相关内容