%%
%% 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}
    [2011/05/09 v1.1 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\beamer@checkframetitle}
  \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'.
