summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/footnotehyper
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2017-02-17 22:27:22 +0000
committerKarl Berry <karl@freefriends.org>2017-02-17 22:27:22 +0000
commitab45728245c1e07608202ff15953b97a9d3232b0 (patch)
tree6470ca7d06a29ff07cd58e5328c4a95115b28bde /Master/texmf-dist/tex/latex/footnotehyper
parent8ad0b999fe8e87386fa707c55c57c002a99a0a66 (diff)
footnotehyper (17feb17)
git-svn-id: svn://tug.org/texlive/trunk@43260 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/footnotehyper')
-rw-r--r--Master/texmf-dist/tex/latex/footnotehyper/footnotehyper.sty343
1 files changed, 207 insertions, 136 deletions
diff --git a/Master/texmf-dist/tex/latex/footnotehyper/footnotehyper.sty b/Master/texmf-dist/tex/latex/footnotehyper/footnotehyper.sty
index 42184342406..192a473dcbf 100644
--- a/Master/texmf-dist/tex/latex/footnotehyper/footnotehyper.sty
+++ b/Master/texmf-dist/tex/latex/footnotehyper/footnotehyper.sty
@@ -23,162 +23,233 @@
%%
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{footnotehyper}%
- [2016/10/03 v0.9f hyperref aware footnote.sty (JFB)]
+ [2017/02/16 v0.99 hyperref aware footnote.sty (JFB)]
%%
%% Package: footnotehyper
-%% Version: 0.9f (2016/10/03)
+%% Version: 0.99 (2017/02/16)
%% License: LPPL 1.3c
-%% Copyright (C) 2016 Jean-Francois Burnol <jfbu at free dot fr>.
+%% Copyright (C) 2016-2017 Jean-Francois Burnol <jfbu at free dot fr>.
%%
-\DeclareOption*{\PackageWarning{footnotehyper}{Option `\CurrentOption' is unknown}}%
+\DeclareOption*%
+ {\PackageWarning{footnotehyper}{Option `\CurrentOption' is unknown}}%
\ProcessOptions\relax
-\@ifpackageloaded{footnote}
- {\PackageWarningNoLine{footnotehyper}%
- {Please next time do not load package footnote,^^J
- but leave that to me. For the time being, I will start by undoing the^^J
- modifications it did to \string\parbox. Use \string\fnparbox\space if needed.}%
- }
- {\let\FNH@@makefntext\@makefntext\let\@makefntext\@firstofone
- \RequirePackage{footnote}
- \let\@makefntext\FNH@@makefntext
- }%
-\let\fnparbox\parbox\let\parbox\fn@parbox
-\let\FNH@fn@footnote \footnote % footnote.sty's \footnote will get
-\let\FNH@fn@footnotetext\footnotetext % redefined later. We preserve also
-\let\footnote \fn@latex@@footnote % the meaning of \footnote from prior
-\let\footnotetext\fn@latex@@footnotetext % to the loading of footnote.sty
-\def\fn@endnote {\color@endgroup}%
+\newbox\FNH@notes
+\newdimen\FNH@width
+\let\FNH@colwidth\columnwidth
+\newif\ifFNH@savingnotes
\AtBeginDocument {%
- \let\fn@latex@@footnote \footnote % meaning of \footnote at end of preamble
- \let\fn@latex@@footnotetext\footnotetext
-}%
-\AtBeginDocument{\@ifpackageloaded{hyperref}
+ \@ifpackageloaded{hyperref}
{\ifHy@hyperfootnotes
- \let\fn@fntext \FNH@hyper@fntext
- \let\spewnotes \FNH@hyper@spewnotes
- \let\endsavenotes\spewnotes
- \let\fn@endfntext\FNH@fixed@endfntext
- \let\footnote \FNH@fixed@footnote
- \let\footnotetext\FNH@fixed@footnotetext
+ \let\FNH@latex@footnote \footnote
+ \let\FNH@latex@footnotetext\footnotetext
+ \newenvironment{savenotes}
+ {\FNH@savenotes\ignorespaces}{\FNH@spewnotes\ignorespacesafterend}%
+ \let\spewnotes \FNH@spewnotes
+ \let\footnote \FNH@footnote
+ \let\footnotetext \FNH@footnotetext
+ \let\endfootnote \FNH@endfntext
+ \let\endfootnotetext\FNH@endfntext
\else
- \FNH@inactive
- \fi }{\FNH@inactive}%
- \let\endfootnote\fn@endfntext
- \let\endfootnotetext\endfootnote
-}%
-\def\FNH@fix@endfntext\@finalstrut\strutbox\fn@postfntext
- {\@finalstrut\strutbox\fn@postfntext\fn@endnote}%
-\def\FNH@inactive {%
- \let\footnote \FNH@fn@footnote
- \let\footnotetext\FNH@fn@footnotetext
- \expandafter\expandafter\expandafter\def
- \expandafter\expandafter\expandafter\fn@endfntext
- \expandafter\expandafter\expandafter
- {\expandafter\FNH@fix@endfntext\fn@endfntext}%
\PackageInfo{footnotehyper}%
- {hyperref package not loaded or hyperfootnotes^^J
- =false option; I did not activate myself and only patched footnote.sty^^J
- for color/xcolor compatibility, leaving some other issues unfixed.}}%
-\def\FNH@hyper@fntext {\ifx\ifmeasuring@\undefined\expandafter\@secondoftwo
- \else\expandafter\@firstofone\fi
- {\ifmeasuring@\expandafter\@gobbletwo\fi}%
- \FNH@hyper@fntext@i }%
-\long\def\FNH@hyper@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@hyper@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\FNH@fixed@endfntext {%
- \@finalstrut\strutbox
- \fn@postfntext
- \fn@endnote
- \egroup\FNH@endfntext@next % will decide if link or no link
+ {inactive due to hyperfootnotes=false option}%
+ \fi}%
+ {\PackageWarning{footnotehyper}{^^J\@spaces\@spaces*************^^J%
+ \space deactivating myself as hyperref is not detected !^^J}}%
}%
-\def\FNH@endfntext@link {\begingroup
- \let\@makefntext\@empty\let\@finalstrut\@gobble\let\rule\@gobbletwo
- \@footnotetext {\unvbox\z@}%
+\def\FNH@hyper@fntext{\FNH@fntext\FNH@hyper@fntext@i}%
+\def\FNH@nohyp@fntext{\FNH@fntext\FNH@nohyp@fntext@i}%
+\def\FNH@fntext #1{\ifx\ifmeasuring@\@undefined
+ \expandafter\@secondoftwo\else\expandafter\@firstofone\fi
+ {\ifmeasuring@\expandafter\@gobbletwo\fi}#1%
+}%
+\long\def\FNH@hyper@fntext@i#1{%
+ \global\setbox\FNH@notes\vbox
+ {\unvbox\FNH@notes
+ \FNH@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
+ }%
+ \FNH@endnote
+ }%
+}%
+\long\def\FNH@nohyp@fntext@i#1{%
+ \global\setbox\FNH@notes\vbox
+ {\unvbox\FNH@notes
+ \FNH@startnote
+ \@makefntext{\rule\z@\footnotesep\ignorespaces#1\@finalstrut\strutbox}%
+ \FNH@endnote
+ }%
+}%
+\def\FNH@startnote{%
+ \hsize\FNH@colwidth
+ \interlinepenalty\interfootnotelinepenalty
+ \reset@font\footnotesize
+ \floatingpenalty\@MM% Is this right???
+ \@parboxrestore
+ \protected@edef\@currentlabel{\csname p@\@mpfn\endcsname\@thefnmark}%
+ \color@begingroup
+}%
+\def\FNH@endnote{\color@endgroup}%
+\def\FNH@savenotes{%
+ \begingroup
+ \ifFNH@savingnotes\else
+ \FNH@savingnotestrue
+ \let\@footnotetext \FNH@hyper@fntext
+ \let\@mpfootnotetext \FNH@hyper@fntext
+ \let\H@@mpfootnotetext\FNH@nohyp@fntext % fool hyperref's \@xfootnotetext
+ \FNH@width\columnwidth
+ \let\FNH@colwidth\FNH@width
+ \global\setbox\FNH@notes\box\voidb@x
+ \let\FNH@thempfn\thempfn
+ \let\FNH@mpfn\@mpfn
+ \ifx\@minipagerestore\relax\let\@minipagerestore\@empty\fi
+ \expandafter\def\expandafter\@minipagerestore\expandafter{%
+ \@minipagerestore
+ \let\thempfn\FNH@thempfn
+ \let\@mpfn\FNH@mpfn
+ }%
+ \fi
+}%
+\def\FNH@spewnotes {%
+ \endgroup
+ \ifFNH@savingnotes\else
+ \ifvoid\FNH@notes\else
+ \begingroup
+ \let\@makefntext\@empty
+ \let\@finalstrut\@gobble
+ \let\rule\@gobbletwo
+ \H@@footnotetext{\unvbox\FNH@notes}%
\endgroup
+ \fi
+ \fi
+}%
+\def\FNH@footnote@envname {footnote}%
+\def\FNH@footnotetext@envname{footnotetext}%
+\def\FNH@footnote{%
+ \ifx\@currenvir\FNH@footnote@envname
+ \expandafter\FNH@footnoteenv
+ \else
+ \expandafter\FNH@latex@footnote
+ \fi
+}%
+\def\FNH@footnoteenv{%
+ \@ifnextchar[%
+ \FNH@footnoteenv@i %]
+ {\stepcounter\@mpfn
+ \protected@xdef\@thefnmark{\thempfn}%
+ \@footnotemark
+ \def\FNH@endfntext@fntext{\@footnotetext}%
+ \FNH@startfntext}%
}%
-\def\FNH@endfntext@nolink {\begingroup
- \let\@makefntext\@empty\let\@finalstrut\@gobble
- \let\rule\@gobbletwo
- \if@savingnotes\expandafter\fn@fntext\else\expandafter\H@@footnotetext\fi
- {\unvbox\z@}\endgroup
-}%
-\def\FNH@fixed@footnote {\ifx\@currenvir\fn@footnote
- \expandafter\FNH@footnoteenv\else\expandafter\fn@latex@@footnote\fi }%
-\def\FNH@footnoteenv {\@ifnextchar[\FNH@xfootnoteenv%]
- {\stepcounter\@mpfn
- \protected@xdef\@thefnmark{\thempfn}\@footnotemark
- \def\FNH@endfntext@next{\FNH@endfntext@link}\fn@startfntext}}%
-\def\FNH@xfootnoteenv [#1]{%
+\def\FNH@footnoteenv@i[#1]{%
\begingroup
\csname c@\@mpfn\endcsname #1\relax
\unrestored@protected@xdef\@thefnmark{\thempfn}%
- \endgroup\@footnotemark\def\FNH@endfntext@next{\FNH@endfntext@link}%
- \fn@startfntext}%
-\def\FNH@fixed@footnotetext {\ifx\@currenvir\fn@footnotetext
- \expandafter\FNH@footnotetextenv\else\expandafter\fn@latex@@footnotetext\fi}%
-\def\FNH@footnotetextenv {\@ifnextchar[\FNH@xfootnotetextenv%]
- {\protected@xdef\@thefnmark{\thempfn}%
- \def\FNH@endfntext@next{\FNH@endfntext@link}\fn@startfntext}}%
-\def\FNH@xfootnotetextenv [#1]{%
+ \endgroup
+ \@footnotemark
+ \def\FNH@endfntext@fntext{\@footnotetext}%
+ \FNH@startfntext
+}%
+\def\FNH@footnotetext{%
+ \ifx\@currenvir\FNH@footnotetext@envname
+ \expandafter\FNH@footnotetextenv
+ \else
+ \expandafter\FNH@latex@footnotetext
+ \fi
+}%
+\def\FNH@footnotetextenv{%
+ \@ifnextchar[%
+ \FNH@footnotetextenv@i %]
+ {\protected@xdef\@thefnmark{\thempfn}%
+ \def\FNH@endfntext@fntext{\@footnotetext}%
+ \FNH@startfntext}%
+}%
+\def\FNH@footnotetextenv@i[#1]{%
\begingroup
\csname c@\@mpfn\endcsname #1\relax
\unrestored@protected@xdef\@thefnmark{\thempfn}%
- \endgroup\def\FNH@endfntext@next{\FNH@endfntext@nolink}%
- \fn@startfntext }%
-\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
-{%
+ \endgroup
+ \ifFNH@savingnotes
+ \def\FNH@endfntext@fntext{\FNH@nohyp@fntext}%
+ \else
+ \def\FNH@endfntext@fntext{\H@@footnotetext}%
+ \fi
+ \FNH@startfntext
+}%
+\def\FNH@startfntext{%
+ \setbox\z@\vbox\bgroup
+ \FNH@startnote
+ \FNH@prefntext
+ \rule\z@\footnotesep\ignorespaces
+}%
+\def\FNH@endfntext {%
+ \@finalstrut\strutbox
+ \FNH@postfntext
+ \FNH@endnote
+ \egroup
+ \begingroup
+ \let\@makefntext\@empty\let\@finalstrut\@gobble\let\rule\@gobbletwo
+ \FNH@endfntext@fntext {\unvbox\z@}%
+ \endgroup
+}%
+\AtBeginDocument{\let\FNH@@makefntext\@makefntext
+ \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@makefntext@alert
+ {\def\FNH@prefntext{#1}\def\FNH@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
-{\PackageWarningNoLine{footnotehyper}%
- {The footnote environment from package footnote^^J
- will be dysfunctional, sorry (not my fault...). You may try to mail me the^^J
- preamble and/or only the next lines:}%
+ \expandafter\meaning\expandafter\FNH@prefntext
+ \meaning\FNH@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@makefntext@alert
+}%
+\def\FNH@bad@makefntext@alert{%
+ \PackageWarningNoLine{footnotehyper}%
+ {^^J The footnote environment will not be fully functional, sorry.^^J
+ You may try to email the author with the following information:}%
\typeout{\meaning\@makefntext}%
- \let\fn@prefntext\@empty\let\fn@postfntext\@empty
+ \let\FNH@prefntext\@empty\let\FNH@postfntext\@empty
+}%
+\def\makesavenoteenv{\@ifnextchar[\FNH@msne@ii\FNH@msne@i}%]
+\def\FNH@msne@i #1{%
+ \expandafter\let\csname FNH$#1\expandafter\endcsname %$
+ \csname #1\endcsname
+ \expandafter\let\csname endFNH$#1\expandafter\endcsname %$
+ \csname end#1\endcsname
+ \FNH@msne@ii[#1]{FNH$#1}%$
+}%
+\def\FNH@msne@ii[#1]#2{%
+ \expandafter\edef\csname#1\endcsname{%
+ \noexpand\savenotes
+ \expandafter\noexpand\csname#2\endcsname
+ }%
+ \expandafter\edef\csname end#1\endcsname{%
+ \expandafter\noexpand\csname end#2\endcsname
+ \noexpand\expandafter
+ \noexpand\spewnotes
+ \noexpand\if@endpe\noexpand\@endpetrue\noexpand\fi
+ }%
}%
\endinput
%%