-
Notifications
You must be signed in to change notification settings - Fork 161
/
Copy pathfixpauseincludegraphics.sty
54 lines (46 loc) · 1.89 KB
/
fixpauseincludegraphics.sty
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
% The original version is taken from
% https://github.com/gdevenyi/phd_thesis/blob/master/presentation/fixpauseincludegraphics.sty
% See related question on tex.stackexchange:
% https://tex.stackexchange.com/questions/96418/beamer-pause-and-grey-not-in-order
\ProvidesPackage{fixpauseincludegraphics}
\usepackage{graphicx}
\usepackage{tikz}
\setbeamercovered{transparent}
\gdef\transparent@value{100}
\let\oldincludegraphics\includegraphics
\renewcommand*{\includegraphics}[2][]{%
\begin{tikzpicture}%
% {\node[opacity=\transparent@value/100] {\oldincludegraphics[#1]{#2}};}%
{\node[opacity=\transparent@value/100, style={inner sep=0, outer sep=0}]{\oldincludegraphics[#1]{#2}};}%
\end{tikzpicture}%
}
% override of the original beamer@mixin transparent
\define@key{beamer@mixin}{transparent}[15]{%
\def\beamer@uncoverbeforeactions{\ignorespaces\opaquenessCustom{#1}}%
\def\beamer@uncoverafteractions{\ignorespaces\opaquenessCustom{#1}}%
}
% mostly a copy-and-paste of the original code from beamerbaseoverlay.sty
\def\opaquenessCustom#1{%
\only<1->{%
\beamer@actions{%
\gdef\transparent@value{#1}% here we change the custom transparency according to the pauses
\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{.}%
}%
{%
\gdef\transparent@value{100}% here we initialize our custom transparency
\xdef\beamer@colorhook{\csname beamer@oldcolorhook%
\the\beamer@coveringdepth\endcsname}%
\xdef\beamer@pgfextension{\csname beamer@oldpgfextension%
\the\beamer@coveringdepth\endcsname}%
\color{.}%
}}%
}%
\setbeamercovered{transparent}