%%
%% This is file `footnotehyper.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% footnotehyper.dtx  (with options: `package')
%% 
%% IMPORTANT NOTICE:
%% 
%% For the copyright see the source file.
%% 
%% Any modified versions of this file must be renamed
%% with new filenames distinct from footnotehyper.sty.
%% 
%% For distribution of the original source see the terms
%% for copying and modification in the file footnotehyper.dtx.
%% 
%% This generated file may be distributed as long as the
%% original source files, as listed above, are part of the
%% same distribution. (The sources need not necessarily be
%% in the same archive or directory.)
%%
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{footnotehyper}%
 [2016/04/30 v0.9e hyperref aware footnote.sty (JFB)]
%%
%% Package: footnotehyper
%% Version: 0.9e (2016/04/30)
%% License: LPPL 1.3c
%% Copyright (C) 2016 Jean-Francois Burnol <jfbu at free dot fr>.
%%
\DeclareOption*{\PackageWarning{footnotehyper}{Option `\CurrentOption' is unknown}}%
\ProcessOptions\relax
\@ifpackageloaded{footnote}
 {\PackageWarning{footnotehyper}{Please next time do not load footnote,^^J
    but leave that to me, that is much safer.}}
 {\let\FNH@@makefntext\@makefntext\let\@makefntext\@firstofone
  \RequirePackage{footnote}
  \let\@makefntext\FNH@@makefntext
 }%
\let\FNH@fn@footnote    \footnote
\let\FNH@fn@footnotetext\footnotetext
\let\footnote    \fn@latex@@footnote
\let\footnotetext\fn@latex@@footnotetext
\AtBeginDocument {%
    \let\fn@latex@@footnote    \footnote
    \let\fn@latex@@footnotetext\footnotetext
    \let\footnote    \FNH@fn@footnote
    \let\footnotetext\FNH@fn@footnotetext
}%
\AtBeginDocument{\@ifpackageloaded{hyperref}
  {\ifHy@hyperfootnotes
    \let\fn@fntext \FNH@fn@fntext
    \let\spewnotes \FNH@spewnotes
    \let\endsavenotes\spewnotes
    \let\fn@endfntext\FNH@fn@endfntext
   \else
     \FNH@inactive
   \fi }\FNH@inactive
    \let\endfootnote\fn@endfntext
    \let\endfootnotetext\endfootnote
}%
\def\FNH@fixendfntext\@finalstrut\strutbox\fn@postfntext
    {\@finalstrut\strutbox\fn@postfntext\fn@endnote}%
\def\FNH@inactive {%
    \expandafter\expandafter\expandafter\def
    \expandafter\expandafter\expandafter\fn@endfntext
    \expandafter\expandafter\expandafter
       {\expandafter\FNH@fixendfntext\fn@endfntext}%
    \PackageInfo{footnotehyper}{hyperref package not loaded,^^J
     or hyperfootnotes=false option; I did not activate myself and only^^J
     patched footnote.sty for color/xcolor/babel-frenchb compatibility}}%
\def\FNH@fn@fntext {\ifx\ifmeasuring@\undefined\expandafter\@secondoftwo
                                      \else\expandafter\@firstofone\fi
    {\ifmeasuring@\expandafter\@gobbletwo\fi}%
    \FNH@fn@fntext@i }%
\long\def\FNH@fn@fntext@i #1{\global\setbox\fn@notes\vbox
     {\unvbox\fn@notes
      \fn@startnote
      \@makefntext
       {\rule\z@\footnotesep\ignorespaces
        \ifHy@nesting\expandafter\ltx@firstoftwo
                \else\expandafter\ltx@secondoftwo
        \fi
        {\expandafter\hyper@@anchor\expandafter{\Hy@footnote@currentHref}{#1}}%
        {\Hy@raisedlink
          {\expandafter\hyper@@anchor\expandafter{\Hy@footnote@currentHref}%
          {\relax}}%
         \let\@currentHref\Hy@footnote@currentHref
         \let\@currentlabelname\@empty
         #1}%
      \@finalstrut\strutbox }%
      \fn@endnote }%
}%
\def\FNH@spewnotes {\endgroup
    \if@savingnotes\else\ifvoid\fn@notes\else
    \begingroup\let\@makefntext\@empty
               \let\@finalstrut\@gobble
               \let\rule\@gobbletwo
               \H@@footnotetext{\unvbox\fn@notes}%
    \endgroup\fi\fi
}%
\def\fn@endnote  {\color@endgroup}%
\def\FNH@fn@endfntext{%
    \@finalstrut\strutbox
    \fn@postfntext
    \fn@endnote
    \egroup
    \begingroup
    \let\@makefntext\@empty
    \let\@finalstrut\@gobble
    \let\rule\@gobbletwo
    \H@@footnotetext
    {\ifHy@nesting\expandafter\ltx@firstoftwo
             \else\expandafter\ltx@secondoftwo
        \fi
        {\expandafter\hyper@@anchor
         \expandafter{\Hy@footnote@currentHref}{\unvbox\z@}}%
        {\Hy@raisedlink
          {\expandafter\hyper@@anchor\expandafter{\Hy@footnote@currentHref}%
          {\relax}}%
         \let\@currentHref\Hy@footnote@currentHref
         \let\@currentlabelname\@empty
         \unvbox\z@}%
    }%
    \endgroup
}%
\ifx\FNH@@makefntext\undefined\expandafter\@gobble
   \else\expandafter\AtBeginDocument\fi
{%
 \ifx\@makefntextFB\undefined
                   \expandafter\@gobble\else\expandafter\@firstofone\fi
 {\ifFBFrenchFootnotes \let\FNH@@makefntext\@makefntextFB \else
                       \let\FNH@@makefntext\@makefntextORI\fi}%
 \expandafter\FNH@check@a\FNH@@makefntext{1.2!3?4,}\FNH@@@1.2!3?4,\FNH@@@\relax
}%
\long\def\FNH@check@a #11.2!3?4,#2\FNH@@@#3%
{%
     \ifx\relax#3\expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi
     \FNH@bad@footnote@env
     {\def\fn@prefntext{#1}\def\fn@postfntext{#2}\FNH@check@b}%
}%
\def\FNH@check@b #1\relax
{%
    \expandafter\expandafter\expandafter\FNH@check@c
    \expandafter\meaning\expandafter\fn@prefntext
                            \meaning\fn@postfntext1.2!3?4,\FNH@check@c\relax
}%
\def\FNH@check@c #11.2!3?4,#2#3\relax
   {\ifx\FNH@check@c#2\expandafter\@gobble\fi\FNH@bad@footnote@env}%
\def\FNH@bad@footnote@env
{%
    \PackageWarning{footnotehyper}%
     {The footnote environment from package footnote^^J%
      will be dysfunctional, sorry (not my fault...). You may try to mail
      me^^Jthe preamble and/or only the next lines:}%
    \typeout{\meaning\@makefntext}%
    \let\fn@prefntext\@empty\let\fn@postfntext\@empty
}%
\endinput
%%
%% End of file `footnotehyper.sty'.
