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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
|
%%
%% This is file `spot.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% spot.dtx (with options: `package')
%%
%% This is a generated file.
%%
%% Copyright (C) 2010 by Anders Hendrickson <ahendric@cord.edu>
%%
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.3
%% of this license or (at your option) any later version.
%% The latest version of this license is in
%% http://www.latex-project.org/lppl.txt
%% and version 1.3 or later is part of all distributions of LaTeX
%% version 2005/12/01 or later.
%%
\NeedsTeXFormat{LaTeX2e}[1999/12/01]
\ProvidesPackage{spot}
[2010/09/21 v1.0 Spotlight highlighting]
\RequirePackage{tikz}
\usetikzlibrary{shapes}
\usetikzlibrary{fadings}
\newif\ifspot@beamer
\@ifundefined{beamer@frameslide}{\spot@beamerfalse}{\spot@beamertrue}
\let\xa=\expandafter
\ifspot@beamer
\g@addto@macro\beamer@frameslide{\spot@everybeginframe@hook}
\let\spot@oldmaterial=\endbeamer@frameslide
\def\spot@newmaterial{%
\spot@endframe@hook%
\gdef\spot@endframe@hook{}%
\spot@everyendframe@hook}
\xa\xa\xa\def
\xa\xa\xa\endbeamer@frameslide
\xa\xa\xa{%
\xa\spot@newmaterial\spot@oldmaterial}%
\def\spot@endframe@hook{}
\def\spot@everyendframe@hook{}
\def\spot@everybeginframe@hook{}
\long\def\AtEndFrame#1{\g@addto@macro\spot@endframe@hook{#1}}
\long\def\AtEveryEndFrame#1{\g@addto@macro\spot@everyendframe@hook{#1}}
\long\def\AtEveryBeginFrame#1{\g@addto@macro\spot@everybeginframe@hook{#1}}
\else
\RequirePackage{afterpage}
\fi
\def\spotlightcolor{spotlightgold}
\def\setspotlightcolor#1{\xdef\spotlightcolor{#1}}
\def\resetspotlightcolor{\gdef\spotlightcolor{spotlightgold}}
\def\spotlightnodeoptions{}
\def\setspotlightstyle#1{\g@addto@macro\spotlightnodeoptions{#1, }}
\def\resetspotlightstyle{\gdef\spotlightnodeoptions{}}
\definecolor{spotlightgold}{RGB}{255,204,51}
\tikzfading[name=spot@fade,
inner color=transparent!0,
outer color=transparent!60]
\newcount\c@spot@spots
\c@spot@spots=1
\ifspot@beamer
\AtEveryBeginFrame{\global\c@spot@spots=1\relax}
\else
\afterpage{\global\c@spot@spots=1\relax}
\fi
\newif\ifspot@star
\spot@starfalse
\def\spot{\@ifnextchar*{\spot@star}{\spot@nostar}}
\def\spot@star#1{\global\spot@startrue\spot@nostar}
\def\spot@nostar{%
\@ifnextchar<{\spot@in}{\spot@in<1->}%
}
\def\spot@in<#1>{%
\@ifnextchar({\spot@inte<#1>}%
{\spot@inte<#1>(spot@dummynode)}%
}
\def\spot@inte<#1>(#2){%
\@ifnextchar[{\spot@intern<#1>(#2)}{\spot@intern<#1>(#2)[]}%
}
\def\spot@intern<#1>(#2)[#3]#4{%
\edef\spot@totaloptions{fill=\spotlightcolor, \spotlightnodeoptions, #3}%
\xa\spot@internal\xa[\spot@totaloptions]<#1>(#2){#4}%
}
\def\spot@internal[#1]<#2>(#3)#4{%
\ifspot@beamer%
\spot@internal@beamer<#2>(#3)[#1]{#4}%
\else%
\spot@internal@static<#2>(#3)[#1]{#4}%
\fi%
}
\def\spot@internal@beamer<#1>(#2)[#3]#4{%
\@ifundefined{spot@box@\romannumeral\c@spot@spots}%
{\xa\newbox\csname spot@box@\romannumeral\c@spot@spots\endcsname}{}%
\ifmmode
\global\xa\setbox\csname spot@box@\romannumeral\c@spot@spots\endcsname=\hbox{$#4$}%
\else
\global\xa\setbox\csname spot@box@\romannumeral\c@spot@spots\endcsname=\hbox{#4}%
\fi
\xa\let\xa\spot@currentbox\csname spot@box@\romannumeral\c@spot@spots\endcsname%
\tikz[remember picture, baseline]{
\alt<#1>{\path[use as bounding box]
node[anchor=base, inner sep=0, outer sep=0, opacity=0]
(spot@\romannumeral\c@spot@spots) {\usebox\spot@currentbox};
\path (spot@\romannumeral\c@spot@spots)
node[anchor=center, outer sep=0,
shape=ellipse, inner sep=0.5ex,
#3, opacity=0] (#2) {\usebox\spot@currentbox};}
{\path node[anchor=base, inner sep=0, outer sep=0, opacity=1]
(#2) {\usebox\spot@currentbox};}
}%
\alt<#1>{\xa\spot@savepaint\xa{\romannumeral\c@spot@spots}[#3]}%
{\AtEndFrame{\rule{0pt}{0pt}}}%
\global\advance\c@spot@spots by 1\relax%
}
\def\spot@savepaint#1[#2]{%
\AtEndFrame{\spot@paintspot(spot@#1)[#2]{\usebox{\csname spot@box@#1\endcsname}}}%
}
\def\spot@paintspot(#1)[#2]#3{%
\begin{tikzpicture}[remember picture, overlay, baseline]
\path (#1) node[anchor=center, outer sep=0,
shape=ellipse, inner sep=0.5ex, text opacity=1,
path fading=spot@fade, text=black, #2] {#3};
\end{tikzpicture}%
}
\gdef\spot@savedpaintcommands{}
\def\dospots{%
\marginpar{\spot@savedpaintcommands}%
\gdef\spot@savedpaintcommands{}%
}
\def\dospotsheader{%
\spot@savedpaintcommands%
\gdef\spot@savedpaintcommands{}%
}
\let\dospotsfooter=\dospotsheader
\def\spot@internal@static<#1>(#2)[#3]#4{%
\@ifundefined{spot@box@\romannumeral\c@spot@spots}%
{\xa\newbox\csname spot@box@\romannumeral\c@spot@spots\endcsname}{}%
\ifmmode
\global\xa\setbox\csname spot@box@\romannumeral\c@spot@spots\endcsname=\hbox{$#4$}%
\else
\global\xa\setbox\csname spot@box@\romannumeral\c@spot@spots\endcsname=\hbox{#4}%
\fi
\xa\let\xa\spot@currentbox\csname spot@box@\romannumeral\c@spot@spots\endcsname%
\tikz[remember picture, baseline]{
\path[use as bounding box]
node[anchor=base, inner sep=0, outer sep=0, opacity=0]
(spot@\romannumeral\c@spot@spots) {\usebox\spot@currentbox};
\path (spot@\romannumeral\c@spot@spots)
node[anchor=center, inner sep=0, outer sep=0,
shape=ellipse, inner sep=0.5ex,
#3, opacity=0] (#2) {\usebox\spot@currentbox};
}%
\xa\spot@static@savepaint\xa{\romannumeral\c@spot@spots}[#3]%
\global\advance\c@spot@spots by 1\relax%
\global\spot@starfalse%
}
\def\spot@static@savepaint#1[#2]{%
\def\spot@saveit{%
\g@addto@macro\spot@savedpaintcommands{%
\spot@paintspot(spot@#1)[#2]{\usebox{\csname spot@box@#1\endcsname}}}%
\afterpage{\spot@checkforlostspots}%
}%
\ifspot@star
\spot@saveit
\else
\ifinner
\spot@saveit
\else
\ifmmode
\spot@saveit
\else
\marginpar{\spot@paintspot(spot@#1)[#2]{\usebox{\csname spot@box@#1\endcsname}}}%
\dospots
\fi
\fi
\fi
}
\def\spot@checkforlostspots{%
\def\spot@empty{}%
\ifx\spot@savedpaintcommands\spot@empty%
\relax%
\else%
\bgroup
\advance\count0 by -1
\PackageError{spot}%
{A \protect\dospots\space command is missing
from page \the\count0.\MessageBreak
Some highlighted text will not appear in the output}%
{If the last \protect\spot\space command on a
page is issued in math mode or a \MessageBreak
TeX inner mode (such as a tabular environment),
it must be followed by a \MessageBreak
\protect\dospots\space command somewhere later
on the page, outside such a mode.\MessageBreak
You could also put \protect\dospotsheader\space
in a header or footer on each page.}
\egroup
\fi%
}
\endinput
%%
%% End of file `spot.sty'.
|