texlive[42205] Master/texmf-dist: footnotehyper (4oct16)
commits+karl at tug.org
commits+karl at tug.org
Tue Oct 4 23:33:59 CEST 2016
Revision: 42205
http://tug.org/svn/texlive?view=revision&revision=42205
Author: karl
Date: 2016-10-04 23:33:59 +0200 (Tue, 04 Oct 2016)
Log Message:
-----------
footnotehyper (4oct16)
Modified Paths:
--------------
trunk/Master/texmf-dist/doc/latex/footnotehyper/README.md
trunk/Master/texmf-dist/doc/latex/footnotehyper/footnotehyper.pdf
trunk/Master/texmf-dist/doc/latex/footnotehyper/footnotehyper.tex
trunk/Master/texmf-dist/source/latex/footnotehyper/footnotehyper.dtx
trunk/Master/texmf-dist/source/latex/footnotehyper/footnotehyper.ins
trunk/Master/texmf-dist/tex/latex/footnotehyper/footnotehyper.sty
Modified: trunk/Master/texmf-dist/doc/latex/footnotehyper/README.md
===================================================================
--- trunk/Master/texmf-dist/doc/latex/footnotehyper/README.md 2016-10-04 21:33:49 UTC (rev 42204)
+++ trunk/Master/texmf-dist/doc/latex/footnotehyper/README.md 2016-10-04 21:33:59 UTC (rev 42205)
@@ -1,44 +1,32 @@
<!-- -->
- Source: footnotehyper.dtx (v0.9e 2016/04/30)
+ Source: footnotehyper.dtx (v0.9f 2016/10/03)
Author: Jean-Francois Burnol
Info: hyperref aware footnote.sty
- License: LPPL 1.3c or later
+ License: LPPL 1.3c
Copyright (C) 2016 Jean-Francois Burnol <jfbu at free dot fr>.
ABSTRACT
========
-The `footnote` package by Mark Wooding dates back to 1997 and has
-not been made `hyperref` compatible. The aim of the present
-package is to do that. Its state is what I found sufficiently
-well-working on a current LaTeX document of mine.
+The `footnote` package by Mark Wooding (which dates back to 1997)
+allows to gather footnotes (`\savenotes`) and later insert them
+(`\spewnotes`) at the bottom of the page, even if the intervening
+material consists of tabulars, minipages or framed contents for
+example. There is a command to patch any given environment to do
+the `\savenotes/\spewnotes` commands automatically. Also there is
+a `footnote` environment which allows to insert verbatim material.
-For those who don't know: the `footnote` package allows via
-`\savenotes` to gather footnotes and later release them via
-`\spewnotes` (one can also use a `savenotes` environment.)
-Thus footnotes emitted from tabulars or minipages
-are not separated from the general document stream of footnotes,
-and are printed with the others at bottom of page. This works also
-for environments like `framed` (1) from the eponymous package and
-avoids the `\footnotemark/\footnotetext` approach, which anyhow is
-not immediately `hyperref` compatible. The `footnote` package has
-a facility to patch any user-chosen environment to do the
-`\savenotes/\spewnotes` automatically.
+The `footnotehyper` package loads `footnote.sty` and rewrites a
+number of its commands to add `hyperref` awareness and to fix some
+issues, particularly the one of incompatibility with
+`color/xcolor`. The incompatibility with `babel-frenchb` is
+addressed, too. In case of absence of `hyperref`, `footnotehyper`
+limits itself to partially fix some of these issues.
-This package provides no facility for handling footnotes from floating
-environments.
+This package provides no facility dedicated to footnotes from
+floating environments.
-Some issues from `footnote.sty` made it incompatible with the
-`color` and `xcolor` packages; this is corrected by `footnotehyper`. The
-compatibility with `babel-frenchb` is improved, too.
-
-The loading of `hyperref` (either before or after) is mandatory
-but left to the user.
-
-(1): in case of multi-page content, the footnotes are delivered in
-the last page.
-
INSTALLATION
============
Modified: trunk/Master/texmf-dist/doc/latex/footnotehyper/footnotehyper.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/doc/latex/footnotehyper/footnotehyper.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/footnotehyper/footnotehyper.tex 2016-10-04 21:33:49 UTC (rev 42204)
+++ trunk/Master/texmf-dist/doc/latex/footnotehyper/footnotehyper.tex 2016-10-04 21:33:59 UTC (rev 42205)
@@ -1,13 +1,13 @@
%%
%% Package: footnotehyper
-%% Version: 0.9e (2016/04/30)
+%% Version: 0.9f (2016/10/03)
%% License: LPPL 1.3c
%% Copyright (C) 2016 Jean-Francois Burnol <jfbu at free dot fr>.
%%
\def\pkgname {footnotehyper}
-\def\pkgdate {2016/04/30}
-\def\docdate {2016/04/30}
-\def\pkgversion {v0.9e}
+\def\pkgdate {2016/10/03}
+\def\docdate {2016/10/03}
+\def\pkgversion {v0.9f}
\def\pkgdescription {hyperref aware footnote.sty (JFB)}
%%
%% run latex twice on this file footnotehyper.tex then dvipdfmx on
Modified: trunk/Master/texmf-dist/source/latex/footnotehyper/footnotehyper.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/footnotehyper/footnotehyper.dtx 2016-10-04 21:33:49 UTC (rev 42204)
+++ trunk/Master/texmf-dist/source/latex/footnotehyper/footnotehyper.dtx 2016-10-04 21:33:59 UTC (rev 42205)
@@ -1,11 +1,11 @@
% -*- coding: utf-8; time-stamp-format: "%02d-%02m-%:y at %02H:%02M:%02S %Z" -*-
%<*none>
-\def\dtxtimestamp {Time-stamp: <30-04-2016 at 20:34:58 CEST>}
+\def\dtxtimestamp {Time-stamp: <03-10-2016 at 23:00:16 CEST>}
%</none>
%<*!readme>
%%
%% Package: footnotehyper
-%% Version: 0.9e (2016/04/30)
+%% Version: 0.9f (2016/10/03)
%% License: LPPL 1.3c
%% Copyright (C) 2016 Jean-Francois Burnol <jfbu at free dot fr>.
%%
@@ -12,9 +12,9 @@
%</!readme>
%<*insfile|tex>
\def\pkgname {footnotehyper}
-\def\pkgdate {2016/04/30}
-\def\docdate {2016/04/30}
-\def\pkgversion {v0.9e}
+\def\pkgdate {2016/10/03}
+\def\docdate {2016/10/03}
+\def\pkgversion {v0.9f}
\def\pkgdescription {hyperref aware footnote.sty (JFB)}
%</insfile|tex>
%<*none>
@@ -25,7 +25,7 @@
\catcode32=13\catcode`\\=12^^Brelax^^A
^^Bfirstofone{^^Bendgroup^^Bdef^^BpkgLicense^^A
{% Package: footnotehyper
-% Version: 0.9e (2016/04/30)
+% Version: 0.9f (2016/10/03)
% License: LPPL 1.3c
% Copyright (C) 2016 Jean-Francois Burnol <jfbu at free dot fr>.
%
@@ -54,10 +54,10 @@
%<*readme>
<!-- -->
- Source: footnotehyper.dtx (v0.9e 2016/04/30)
+ Source: footnotehyper.dtx (v0.9f 2016/10/03)
Author: Jean-Francois Burnol
Info: hyperref aware footnote.sty
- License: LPPL 1.3c or later
+ License: LPPL 1.3c
Copyright (C) 2016 Jean-Francois Burnol <jfbu at free dot fr>.
@@ -64,37 +64,25 @@
ABSTRACT
========
-The `footnote` package by Mark Wooding dates back to 1997 and has
-not been made `hyperref` compatible. The aim of the present
-package is to do that. Its state is what I found sufficiently
-well-working on a current LaTeX document of mine.
+The `footnote` package by Mark Wooding (which dates back to 1997)
+allows to gather footnotes (`\savenotes`) and later insert them
+(`\spewnotes`) at the bottom of the page, even if the intervening
+material consists of tabulars, minipages or framed contents for
+example. There is a command to patch any given environment to do
+the `\savenotes/\spewnotes` commands automatically. Also there is
+a `footnote` environment which allows to insert verbatim material.
-For those who don't know: the `footnote` package allows via
-`\savenotes` to gather footnotes and later release them via
-`\spewnotes` (one can also use a `savenotes` environment.)
-Thus footnotes emitted from tabulars or minipages
-are not separated from the general document stream of footnotes,
-and are printed with the others at bottom of page. This works also
-for environments like `framed` (1) from the eponymous package and
-avoids the `\footnotemark/\footnotetext` approach, which anyhow is
-not immediately `hyperref` compatible. The `footnote` package has
-a facility to patch any user-chosen environment to do the
-`\savenotes/\spewnotes` automatically.
+The `footnotehyper` package loads `footnote.sty` and rewrites a
+number of its commands to add `hyperref` awareness and to fix some
+issues, particularly the one of incompatibility with
+`color/xcolor`. The incompatibility with `babel-frenchb` is
+addressed, too. In case of absence of `hyperref`, `footnotehyper`
+limits itself to partially fix some of these issues.
-This package provides no facility for handling footnotes from floating
-environments.
+This package provides no facility dedicated to footnotes from
+floating environments.
-Some issues from `footnote.sty` made it incompatible with the
-`color` and `xcolor` packages; this is corrected by `footnotehyper`. The
-compatibility with `babel-frenchb` is improved, too.
-The loading of `hyperref` (either before or after) is mandatory
-but left to the user.
-
-(1): in case of multi-page content, the footnotes are delivered in
-the last page.
-
-
INSTALLATION
============
@@ -172,7 +160,7 @@
%</tex>-------------------------------------------------------------------------
%<*insfile>---------------------------------------------------------------------
%%
-%% Run etex on this file to extract from footnotehyper.dtx:
+%% Run tex on this file to extract from footnotehyper.dtx:
%% footnotehyper.sty, footnotehyper.tex, and README.md
%%
%% Refer to README.md for installation instructions, if needed.
@@ -204,11 +192,6 @@
\Msg{* Happy TeXing!}
\Msg{*}
\Msg{************************************************************************}
-\ifx\numexpr\undefined
-\Msg{* warning: to get correct utf-8 encoded README.md}%
-\Msg{* do 'etex \pkgname.ins' and not 'tex \pkgname.ins'}%
-\Msg{************************************************************************}
-\fi
\endbatchfile
%</insfile>---------------------------------------------------------------------
%<*none>------------------------------------------------------------------------
@@ -268,13 +251,6 @@
\file{\pkgname.sty}{\from{\pkgname.dtx}{package}}}%
\endgroup
\fi % end of file extraction (from etex/latex/pdflatex run on \pkgname.dtx)
-\ifnum\noetex=1 % warning for README.md
- \expandafter\def\expandafter\MessageDeFin\expandafter
-{\MessageDeFin
-\Msg{* warning: to get correct utf-8 encoded README.md ^^J}%
-\Msg{* do 'etex \pkgname.dtx' and not 'tex \pkgname.dtx' ^^J}%
-\Msg{********************************************************************^^J}}%
-\fi
\ifnum\extractfiles=0 % tex/etex/xetex/etc on \pkgname.dtx, files extracted, stop
\MessageDeFin\expandafter\end
\fi
@@ -371,34 +347,23 @@
\MakeShortVerb{\`}%
\begin{abstract}
- The `footnote` package by \textsc{Mark Wooding} dates back to
- 1997 and has not been made `hyperref` compatible. The aim of the
- present package is to do that. Its state is what I found
- sufficiently well-working on a current LaTeX document of mine.
+The `footnote` package by Mark \textsc{Wooding} (which dates back to 1997)
+allows to gather footnotes (`\savenotes`) and later insert them
+(`\spewnotes`) at the bottom of the page, even if the intervening
+material consists of tabulars, minipages or framed contents for
+example. There is a command to patch any given environment to do
+the `\savenotes/\spewnotes` commands automatically. Also there is
+a `footnote` environment which allows to insert verbatim material.
- For those who don't know: the `footnote` package allows via
- `\savenotes` to gather footnotes and later release them via
- `\spewnotes` (one can also use a `savenotes` environment.) Thus
- footnotes emitted from tabulars or minipages are not separated
- from the general document stream of footnotes, and are printed
- with the others at bottom of page. This works also for
- environments like `framed`%
-%
-%\footnote
-\space({in case of multi-page content, the footnotes are delivered in the last
-page})
-%
-from the eponymous package and avoids the `\footnotemark/\footnotetext`
-approach, which anyhow is not immediately `hyperref` compatible. The
-`footnote` package has a facility to patch any user-chosen environment to
-do the `\savenotes/\spewnotes` automatically.
+The \fnh package loads `footnote.sty` and rewrites a number of its
+commands to add `hyperref` awareness and to fix some issues,
+particularly the one of incompatibility with `color/xcolor`. The
+incompatibility with `babel-frenchb` is addressed, too. In case of
+absence of `hyperref`, \fnh limits itself to partially fix some of
+these issues.
-Some issues from `footnote.sty` made it incompatible with the
-`color` and `xcolor` packages; this is corrected by \fnh. The
-compatibility with `babel-frenchb` has been improved, too.
-
-The loading of `hyperref` (either before or after) is mandatory
-but left to the user.
+This package provides no facility dedicated to footnotes from
+floating environments.
\end{abstract}
\DeleteShortVerb{\`}
@@ -411,8 +376,8 @@
\section{Usage}
-Do \emph{not} load |footnote|, leave that job to \fnh. You \emph{must} load
-|hyperref|.\footnote{Since |0.9e| \fnh deactivates itself
+DON'T load |footnote|, leave that job to \fnh. You \emph{must} load
+|hyperref|.\footnote{Since |v0.9e| \fnh deactivates itself
gracefully if |hyperref| is not loaded, or under |hyperref| option
|hyperfootnotes=false|.}
@@ -496,19 +461,76 @@
\begin{footnote}
\verb|&$^%\[}$|
\end{footnote}
+which was coded as:
+<let's avoid infinite recursion ;-) >
\end{verbatim}
-And one more normal footnote.\footnote{\fnh deactivates itself if
- |hyperfootnotes=false| option to |hyperref| is detected.
- Essentially, it only
-fixes then the incompatibilities between |footnote.sty| and
-|color/xcolor/babel-frenchb| packages.}
+And here a use of |\footnotemark|\footnotemark\
+followed by a |footnotetext| environment.
+\begin{footnotetext}
+ This one uses the normal footnote counter and the hyperlink works.
+\end{footnotetext}
+Now a use of |\footnotemark[N]|\footnotemark[99] followed with a
+|footnotetext| environment using the same optional argument |[N]|.
+No hyperfootnote link is then inserted by |hyperref|.%
+\begin{footnotetext}[99]
+ |hyperref| puts no hyperlink in this case, which is similar to
+ the |\footnotemark[N]/\footnotetext[N]{<foo>}| context (there is
+ no such problem with using the |[N]| with a |\footnote| or with
+ a |footnote| environment.)
+\end{footnotetext}
+And a final footnote, with a |footnote| environment using an
+optional argument |[N]|.%
+\begin{footnote}[100]\csname @minipagetrue\endcsname % to reduce
+ % framed inserted vertical spacing
+ \begin{framed}
+ \noindent\fnh deactivates itself if |hyperfootnotes=false| option to
+ |hyperref| is detected, or if |hyperref| is not loaded at all.
+ Essentially, it only then fixes some of the incompatibilities
+ between |footnote.sty| and |color/xcolor/babel-frenchb|
+ packages. But the bug making the |footnote| environment
+ optional argument unusable remains unfixed by \fnh if
+ |hyperref| has not been detected.
+ \end{framed}
+\end{footnote}
+No problem with the hyperlink, then.
+\section{Notes}
+
+The |footnote| environment of |footnote.sty| had various issues
+but as \fnh initially focused only on |\savenotes/\spewnotes| I
+became aware only at the time of |v0.9f| of the error when this
+environment is used with the optional |[N]| parameter; this is a
+different bug than the one of incompatibility with |color/xcolor|.
+The |v0.9f| release fixes this new problem (no extensive
+tests were done.)
+
+During this I realized (this is unrelated to |footnote| package or
+\fnh) that there is a typesetting interference of |hyperref| with
+|babel+frenchb| in the case of the |\footnotemark[N]| syntax. \fnh
+does not fix that. I reported the problem and perhaps an upstream
+fix will come at a later date (tested with |hyperref 6.83q| and
+|frenchb 3.2c|).
+
+The |hyperref| package inserts no hyperlink in case of
+|\footnotemark[N]/\footnotetext[N]|. This is not modified by \fnh.
+
+The |footnote.sty| package patches the \LaTeX\ kernel |\parbox|. I had not
+realized that earlier, and starting with \fnh |v0.9f| the patch is undone.
+But the re-defined macro is made available as |\fnparbox|.
+
+\medskip
+
+At this stage, \fnh rewrites large parts of the original
+|footnote.sty| code. Perhaps a later release will not load at all
+the original package (but it will keep the |\savenotes/\spewnotes|
+interface.)
+
\StopEventually{\end{document}\endinput}
\makeatletter
\let\check at percent\original at check@percent
\makeatother
-%\clearpage
+\newgeometry{left=4cm, hscale=0.72}
\section{Implementation}
\small
@@ -548,6 +570,14 @@
%
%</none>
%<*package>
+% It is surely difficult to understand the code here as its expansion depends on
+% some macros whose definitions are still in |footnote.sty| and used with no
+% modification here: the most important are |\savenotes|, |\fn at startnote|, and
+% |\fn at startfntext| (which is used only for the environment form.) Obviously the
+% macros here depend on what these three do.
+%
+% Surely, next release of \fnh will drop entirely the idea of patching
+% |footnote.sty| and will contain all definitions.
% \begin{macro}{no options}
% \begin{macrocode}
\DeclareOption*{\PackageWarning{footnotehyper}{Option `\CurrentOption' is unknown}}%
@@ -557,86 +587,110 @@
% \begin{macro}{\@makefntext}
% \begin{macro}{\footnote}
% \begin{macro}{\footnotetext}
+% \begin{macro}{\parbox}
+% \begin{macro}{\fn at endnote}
% We load |footnote| but leave to the user to take care of |hyperref|.
%
-% As we need to intercept some re-definitions done by |footnote| we will first
-% check if it is already loaded.
+% As we need to intercept some re-definitions done by
+% |footnote.sty| we will first check if it is already loaded.
%
% If \cs{@makefntext} has been customized and its argument is not visible at
% top level in its meaning, then loading |footnote.sty| will fail with a low
% level \TeX\ error. We save its meaning and replace it by an innocuous one
% for the time being. We will come back to this at begin document.
+%
+% |footnote.sty| modifies |\parbox|. We (|v0.9f|) undo the patch, because
+% modifying |\parbox| in any way for no good reason is BAD.
+%
+% The |\fn at endnote| was |\let| to |\color at endgroup| which is bad as it fails if
+% |color/xcolor| is not yet loaded. Besides its presence was missing from some
+% needed place (see later).
%
-% We also postpone to at begin document the redefinitions of \cs{footnote} and
+% We postpone to at begin document the redefinitions of \cs{footnote} and
% \cs{footnotetext}.
% \begin{macrocode}
\@ifpackageloaded{footnote}
- {\PackageWarning{footnotehyper}{Please next time do not load footnote,^^J
- but leave that to me, that is much safer.}}
+ {\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\FNH at fn@footnote \footnote
-\let\FNH at fn@footnotetext\footnotetext
-\let\footnote \fn at latex@@footnote
-\let\footnotetext\fn at latex@@footnotetext
+\let\fnparbox\parbox\let\parbox\fn at parbox
+\let\FNH at fn@footnote \footnote % footnote.sty's \footnote will get
+\let\FNH at fn@footnotetext\footnotetext % redefined later. We preserve also
+\let\footnote \fn at latex@@footnote % the meaning of \footnote from prior
+\let\footnotetext\fn at latex@@footnotetext % to the loading of footnote.sty
+\def\fn at endnote {\color at endgroup}%
% \end{macrocode}
-% \end{macro}\end{macro}\end{macro}
+% \end{macro}\end{macro}\end{macro}\end{macro}\end{macro}
% There are some |\let|'s done by |footnote.sty| in what appears to be
% premature ways.
% \begin{macrocode}
\AtBeginDocument {%
- \let\fn at latex@@footnote \footnote
+ \let\fn at latex@@footnote \footnote % meaning of \footnote at end of preamble
\let\fn at latex@@footnotetext\footnotetext
- \let\footnote \FNH at fn@footnote
- \let\footnotetext\FNH at fn@footnotetext
}%
% \end{macrocode}
% \begin{macro}{\FNH at inactive}
-% We intervene (for real) only if |hyperfootnotes| option of |hyperref| applies.
+% Apart from fixing some of the bugs with |footnote.sty|'s footnote
+% environment, we intervene only if |hyperfootnotes| option of |hyperref|
+% applies.
% \begin{macrocode}
\AtBeginDocument{\@ifpackageloaded{hyperref}
{\ifHy at hyperfootnotes
- \let\fn at fntext \FNH at fn@fntext
- \let\spewnotes \FNH at spewnotes
+ \let\fn at fntext \FNH at hyper@fntext
+ \let\spewnotes \FNH at hyper@spewnotes
\let\endsavenotes\spewnotes
- \let\fn at endfntext\FNH at fn@endfntext
+ \let\fn at endfntext\FNH at fixed@endfntext
+ \let\footnote \FNH at fixed@footnote
+ \let\footnotetext\FNH at fixed@footnotetext
\else
\FNH at inactive
- \fi }\FNH at inactive
+ \fi }{\FNH at inactive}%
\let\endfootnote\fn at endfntext
\let\endfootnotetext\endfootnote
}%
-\def\FNH at fixendfntext\@finalstrut\strutbox\fn at postfntext
+% \end{macrocode}
+% |v0.9e| did a partial fix of the |footnote| environment from |footnote.sty|,
+% |v0.9f| fix is more complete but is applied only if |hyperref| is present with
+% option |hyperfootnotes=true|.
+% \begin{macrocode}
+\def\FNH at fix@endfntext\@finalstrut\strutbox\fn at postfntext
{\@finalstrut\strutbox\fn at postfntext\fn at endnote}%
\def\FNH at inactive {%
+ \let\footnote \FNH at fn@footnote
+ \let\footnotetext\FNH at fn@footnotetext
\expandafter\expandafter\expandafter\def
\expandafter\expandafter\expandafter\fn at endfntext
\expandafter\expandafter\expandafter
- {\expandafter\FNH at fixendfntext\fn at 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}}%
+ {\expandafter\FNH at fix@endfntext\fn at 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.}}%
% \end{macrocode}
% \end{macro}
-% \begin{macro}{\FNH at fn@fntext}
+% \begin{macro}{\FNH at hyper@fntext}
% Some |amsmath| complications. I change the coding, but same effect as
-% original.
+% in original |\fn at fntext|.
% \begin{macrocode}
-\def\FNH at fn@fntext {\ifx\ifmeasuring@\undefined\expandafter\@secondoftwo
+\def\FNH at hyper@fntext {\ifx\ifmeasuring@\undefined\expandafter\@secondoftwo
\else\expandafter\@firstofone\fi
{\ifmeasuring@\expandafter\@gobbletwo\fi}%
- \FNH at fn@fntext at i }%
+ \FNH at hyper@fntext at i }%
% \end{macrocode}
% \end{macro}
-% \begin{macro}{\FNH at fn@fntext at i}
+% \begin{macro}{\FNH at hyper@fntext at i}
% Note: original \cs{fn at fntext} had no \cs{long}, which looks wrong.
%
% We do the \cs{ifHy at nesting} test although hyperref's manual
% says ``Allows links to be nested; no drivers currently support this.''
% \begin{macrocode}
-\long\def\FNH at fn@fntext at i #1{\global\setbox\fn at notes\vbox
+\long\def\FNH at hyper@fntext at i #1{\global\setbox\fn at notes\vbox
{\unvbox\fn at notes
\fn at startnote
\@makefntext
@@ -656,13 +710,12 @@
}%
% \end{macrocode}
% \end{macro}
-% \begin{macro}{\FNH at spewnotes}
-% \begin{macro}{\FNH at endsavenotes}
+% \begin{macro}{\FNH at hyper@spewnotes}
% The final touch in our hack is to patch the original \cs{spewnotes} for it
% to use the original, non-hyperref modified, version of \cs{@footnotetext}.
% And let's not forget \cs{endsavenotes} (done at begin document).
% \begin{macrocode}
-\def\FNH at spewnotes {\endgroup
+\def\FNH at hyper@spewnotes {\endgroup
\if at savingnotes\else\ifvoid\fn at notes\else
\begingroup\let\@makefntext\@empty
\let\@finalstrut\@gobble
@@ -671,55 +724,91 @@
\endgroup\fi\fi
}%
% \end{macrocode}
-% \end{macro}\end{macro}
-% \begin{macro}{\FNH at fn@endfntext}
-% \begin{macro}{\fn at endnote}
-% We now take care of |footnote.sty|'s |footnote| environment. The original
-% \cs{fn at endfntext} is lacking a \cs{fn at endnote}, and this meant that
-% |footnote.sty| was incompatible with |color/xcolor| packages. Also this
-% \cs{fn at endnote} was |\let| to |\color at endgroup| which is wrong.
+% \end{macro}
+% \begin{macro}{\FNH at fixed@endfntext}
+% We now take care of |footnote.sty|'s |footnote| environment. The original
+% \cs{fn at endfntext} is lacking a \cs{fn at endnote}, and this meant that
+% |footnote.sty| was incompatible with |color/xcolor| packages. Also this
+% \cs{fn at endnote} was |\let| to |\color at endgroup| which is wrong.
%
-% And we need our usual replacement of \cs{@footnotetext} by
-% \cs{H@@footnotetext}. And this time (|v0.9d|) let's not forget the hyperlink
-% target.
+% Furthermore, independently of presence of the |\color/xcolor| issue, the
+% |footnote.sty|'s |footnote| environment raised an error if used with an
+% optional argument. |v0.9f| addresses this issue.
+%
+% The |footnotetext| environment adds a complication, in case of optional
+% argument we should not try to set up a link due to the fact that |hyperref|
+% does not support them for |\footnotemark[N]/\footnotetext[N]| syntax.
+% And we need to make sure that the |footnote| and |footnotetext| environments
+% obey the |\savenotes/\spewnotes| mechanism.
+%
+% To handle all of this we code things completely differently from
+% |footnote.sty|, its |\fn at getmark| isn't used at all.
% \begin{macrocode}
-\def\fn at endnote {\color at endgroup}%
-\def\FNH at fn@endfntext{%
+\def\FNH at fixed@endfntext {%
\@finalstrut\strutbox
\fn at postfntext
\fn at endnote
- \egroup
- \begingroup
- \let\@makefntext\@empty
- \let\@finalstrut\@gobble
- \let\rule\@gobbletwo
- \H@@footnotetext
- {\ifHy at nesting\expandafter\ltx at firstoftwo
- \else\expandafter\ltx at secondoftwo
- \fi
- {\expandafter\hyper@@anchor
- \expandafter{\Hy at footnote@currentHref}{\unvbox\z@}}%
- {\Hy at raisedlink
- {\expandafter\hyper@@anchor\expandafter{\Hy at footnote@currentHref}%
- {\relax}}%
- \let\@currentHref\Hy at footnote@currentHref
- \let\@currentlabelname\@empty
- \unvbox\z@}%
- }%
+ \egroup\FNH at endfntext@next % will decide if link or no link
+}%
+\def\FNH at endfntext@link {\begingroup
+ \let\@makefntext\@empty\let\@finalstrut\@gobble\let\rule\@gobbletwo
+ \@footnotetext {\unvbox\z@}%
\endgroup
}%
+\def\FNH at endfntext@nolink {\begingroup
+ \let\@makefntext\@empty\let\@finalstrut\@gobble
+ \let\rule\@gobbletwo
+ \if at savingnotes\expandafter\fn at fntext\else\expandafter\H@@footnotetext\fi
+ {\unvbox\z@}\endgroup
+}%
% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\FNH at fixed@footnote}
+% \begin{macro}{\FNH at fixed@footnotetext}
+% \begin{macrocode}
+\def\FNH at fixed@footnote {\ifx\@currenvir\fn at footnote
+ \expandafter\FNH at footnoteenv\else\expandafter\fn at latex@@footnote\fi }%
+\def\FNH at footnoteenv {\@ifnextchar[\FNH at xfootnoteenv%]
+ {\stepcounter\@mpfn
+ \protected at xdef\@thefnmark{\thempfn}\@footnotemark
+ \def\FNH at endfntext@next{\FNH at endfntext@link}\fn at startfntext}}%
+\def\FNH at xfootnoteenv [#1]{%
+ \begingroup
+ \csname c@\@mpfn\endcsname #1\relax
+ \unrestored at protected@xdef\@thefnmark{\thempfn}%
+ \endgroup\@footnotemark\def\FNH at endfntext@next{\FNH at endfntext@link}%
+ \fn at startfntext}%
+\def\FNH at fixed@footnotetext {\ifx\@currenvir\fn at footnotetext
+ \expandafter\FNH at footnotetextenv\else\expandafter\fn at latex@@footnotetext\fi}%
+\def\FNH at footnotetextenv {\@ifnextchar[\FNH at xfootnotetextenv%]
+ {\protected at xdef\@thefnmark{\thempfn}%
+ \def\FNH at endfntext@next{\FNH at endfntext@link}\fn at startfntext}}%
+\def\FNH at xfootnotetextenv [#1]{%
+ \begingroup
+ \csname c@\@mpfn\endcsname #1\relax
+ \unrestored at protected@xdef\@thefnmark{\thempfn}%
+ \endgroup\def\FNH at endfntext@next{\FNH at endfntext@nolink}%
+ \fn at startfntext }%
+% \end{macrocode}
% \end{macro}\end{macro}
% \begin{macro}{\@makefntext}
% \begin{macro}{\fn at prefntext}
% \begin{macro}{\fn at postfntext}
-% The |footnote.sty|'s mechanism for setting up a |footnote| environment is
-% doomed to failure if the parameter in |\@makefntext| is not visible at top
-% level in its meaning. This is the case with babel-frenchb at begin
-% document. It is also wrong if the parameter is used multiple times. Let's
-% figure it out; and a special rescue for |footnote+babel+frenchb|... notice
-% that these checks will fail (rather, they are skipped) if |footnote|'s
-% loading was done by the user and not by |footnotehyper|.
+% The definitions of |\fn at prefntext| and |\fn at prefntext| (which are needed for
+% the |footnote| environment, within |\fn at startfntext| and |\fn at endfntext|)
+% are from a daring analysis done inside |footnote.sty| of |\@makefntext|. It
+% may very easily fail to give a sensible result. \fnh does a check of its own
+% to determine if that was the case but can't salvage the situation, except
+% for hard-coded rescues like done here with |frenchb|. In particular the
+% mechanism is doomed to failure if the parameter in |\@makefntext| is not
+% visible at top level in its meaning. It is also wrong if the parameter is
+% used multiple times. These checks will fail (rather, they are skipped) if
+% |footnote|'s loading was done by the user and not by |footnotehyper|.
+%
+% Note: there is an interference which I could fix here between |hyperref|
+% and |frenchb| regarding |\footnotemark[NUM]|, but it is better to wait it
+% is fixed on |frenchb| side (or |hyperref|'s side !), else my own fix might
+% badly interfere with the ``official'' one |;-)|.
% \begin{macrocode}
\ifx\FNH@@makefntext\undefined\expandafter\@gobble
\else\expandafter\AtBeginDocument\fi
@@ -745,11 +834,10 @@
\def\FNH at check@c #11.2!3?4,#2#3\relax
{\ifx\FNH at check@c#2\expandafter\@gobble\fi\FNH at bad@footnote at env}%
\def\FNH at bad@footnote at 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:}%
+{\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:}%
\typeout{\meaning\@makefntext}%
\let\fn at prefntext\@empty\let\fn at postfntext\@empty
}%
@@ -756,8 +844,6 @@
\endinput
% \end{macrocode}
% \end{macro}\end{macro}\end{macro}
-% Let me say again I have barely tested on a few examples that it
-% does at all work! One of the main tests being the present documentation\dots
% \MakePercentComment
\Finale
%%
Modified: trunk/Master/texmf-dist/source/latex/footnotehyper/footnotehyper.ins
===================================================================
--- trunk/Master/texmf-dist/source/latex/footnotehyper/footnotehyper.ins 2016-10-04 21:33:49 UTC (rev 42204)
+++ trunk/Master/texmf-dist/source/latex/footnotehyper/footnotehyper.ins 2016-10-04 21:33:59 UTC (rev 42205)
@@ -1,16 +1,16 @@
%%
%% Package: footnotehyper
-%% Version: 0.9e (2016/04/30)
+%% Version: 0.9f (2016/10/03)
%% License: LPPL 1.3c
%% Copyright (C) 2016 Jean-Francois Burnol <jfbu at free dot fr>.
%%
\def\pkgname {footnotehyper}
-\def\pkgdate {2016/04/30}
-\def\docdate {2016/04/30}
-\def\pkgversion {v0.9e}
+\def\pkgdate {2016/10/03}
+\def\docdate {2016/10/03}
+\def\pkgversion {v0.9f}
\def\pkgdescription {hyperref aware footnote.sty (JFB)}
%%
-%% Run etex on this file to extract from footnotehyper.dtx:
+%% Run tex on this file to extract from footnotehyper.dtx:
%% footnotehyper.sty, footnotehyper.tex, and README.md
%%
%% Refer to README.md for installation instructions, if needed.
@@ -42,11 +42,6 @@
\Msg{* Happy TeXing!}
\Msg{*}
\Msg{************************************************************************}
-\ifx\numexpr\undefined
-\Msg{* warning: to get correct utf-8 encoded README.md}%
-\Msg{* do 'etex \pkgname.ins' and not 'tex \pkgname.ins'}%
-\Msg{************************************************************************}
-\fi
\endbatchfile
\endinput
%%
Modified: trunk/Master/texmf-dist/tex/latex/footnotehyper/footnotehyper.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/footnotehyper/footnotehyper.sty 2016-10-04 21:33:49 UTC (rev 42204)
+++ trunk/Master/texmf-dist/tex/latex/footnotehyper/footnotehyper.sty 2016-10-04 21:33:59 UTC (rev 42205)
@@ -23,10 +23,10 @@
%%
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{footnotehyper}%
- [2016/04/30 v0.9e hyperref aware footnote.sty (JFB)]
+ [2016/10/03 v0.9f hyperref aware footnote.sty (JFB)]
%%
%% Package: footnotehyper
-%% Version: 0.9e (2016/04/30)
+%% Version: 0.9f (2016/10/03)
%% License: LPPL 1.3c
%% Copyright (C) 2016 Jean-Francois Burnol <jfbu at free dot fr>.
%%
@@ -33,49 +33,57 @@
\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.}}
+ {\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\FNH at fn@footnote \footnote
-\let\FNH at fn@footnotetext\footnotetext
-\let\footnote \fn at latex@@footnote
-\let\footnotetext\fn at latex@@footnotetext
+\let\fnparbox\parbox\let\parbox\fn at parbox
+\let\FNH at fn@footnote \footnote % footnote.sty's \footnote will get
+\let\FNH at fn@footnotetext\footnotetext % redefined later. We preserve also
+\let\footnote \fn at latex@@footnote % the meaning of \footnote from prior
+\let\footnotetext\fn at latex@@footnotetext % to the loading of footnote.sty
+\def\fn at endnote {\color at endgroup}%
\AtBeginDocument {%
- \let\fn at latex@@footnote \footnote
+ \let\fn at latex@@footnote \footnote % meaning of \footnote at end of preamble
\let\fn at latex@@footnotetext\footnotetext
- \let\footnote \FNH at fn@footnote
- \let\footnotetext\FNH at fn@footnotetext
}%
\AtBeginDocument{\@ifpackageloaded{hyperref}
{\ifHy at hyperfootnotes
- \let\fn at fntext \FNH at fn@fntext
- \let\spewnotes \FNH at spewnotes
+ \let\fn at fntext \FNH at hyper@fntext
+ \let\spewnotes \FNH at hyper@spewnotes
\let\endsavenotes\spewnotes
- \let\fn at endfntext\FNH at fn@endfntext
+ \let\fn at endfntext\FNH at fixed@endfntext
+ \let\footnote \FNH at fixed@footnote
+ \let\footnotetext\FNH at fixed@footnotetext
\else
\FNH at inactive
- \fi }\FNH at inactive
+ \fi }{\FNH at inactive}%
\let\endfootnote\fn at endfntext
\let\endfootnotetext\endfootnote
}%
-\def\FNH at fixendfntext\@finalstrut\strutbox\fn at postfntext
+\def\FNH at fix@endfntext\@finalstrut\strutbox\fn at postfntext
{\@finalstrut\strutbox\fn at postfntext\fn at endnote}%
\def\FNH at inactive {%
+ \let\footnote \FNH at fn@footnote
+ \let\footnotetext\FNH at fn@footnotetext
\expandafter\expandafter\expandafter\def
\expandafter\expandafter\expandafter\fn at endfntext
\expandafter\expandafter\expandafter
- {\expandafter\FNH at fixendfntext\fn at 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 at fn@fntext {\ifx\ifmeasuring@\undefined\expandafter\@secondoftwo
+ {\expandafter\FNH at fix@endfntext\fn at 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 at hyper@fntext {\ifx\ifmeasuring@\undefined\expandafter\@secondoftwo
\else\expandafter\@firstofone\fi
{\ifmeasuring@\expandafter\@gobbletwo\fi}%
- \FNH at fn@fntext at i }%
-\long\def\FNH at fn@fntext at i #1{\global\setbox\fn at notes\vbox
+ \FNH at hyper@fntext at i }%
+\long\def\FNH at hyper@fntext at i #1{\global\setbox\fn at notes\vbox
{\unvbox\fn at notes
\fn at startnote
\@makefntext
@@ -93,7 +101,7 @@
\@finalstrut\strutbox }%
\fn at endnote }%
}%
-\def\FNH at spewnotes {\endgroup
+\def\FNH at hyper@spewnotes {\endgroup
\if at savingnotes\else\ifvoid\fn at notes\else
\begingroup\let\@makefntext\@empty
\let\@finalstrut\@gobble
@@ -101,31 +109,46 @@
\H@@footnotetext{\unvbox\fn at notes}%
\endgroup\fi\fi
}%
-\def\fn at endnote {\color at endgroup}%
-\def\FNH at fn@endfntext{%
+\def\FNH at fixed@endfntext {%
\@finalstrut\strutbox
\fn at postfntext
\fn at endnote
- \egroup
- \begingroup
- \let\@makefntext\@empty
- \let\@finalstrut\@gobble
- \let\rule\@gobbletwo
- \H@@footnotetext
- {\ifHy at nesting\expandafter\ltx at firstoftwo
- \else\expandafter\ltx at secondoftwo
- \fi
- {\expandafter\hyper@@anchor
- \expandafter{\Hy at footnote@currentHref}{\unvbox\z@}}%
- {\Hy at raisedlink
- {\expandafter\hyper@@anchor\expandafter{\Hy at footnote@currentHref}%
- {\relax}}%
- \let\@currentHref\Hy at footnote@currentHref
- \let\@currentlabelname\@empty
- \unvbox\z@}%
- }%
+ \egroup\FNH at endfntext@next % will decide if link or no link
+}%
+\def\FNH at endfntext@link {\begingroup
+ \let\@makefntext\@empty\let\@finalstrut\@gobble\let\rule\@gobbletwo
+ \@footnotetext {\unvbox\z@}%
\endgroup
}%
+\def\FNH at endfntext@nolink {\begingroup
+ \let\@makefntext\@empty\let\@finalstrut\@gobble
+ \let\rule\@gobbletwo
+ \if at savingnotes\expandafter\fn at fntext\else\expandafter\H@@footnotetext\fi
+ {\unvbox\z@}\endgroup
+}%
+\def\FNH at fixed@footnote {\ifx\@currenvir\fn at footnote
+ \expandafter\FNH at footnoteenv\else\expandafter\fn at latex@@footnote\fi }%
+\def\FNH at footnoteenv {\@ifnextchar[\FNH at xfootnoteenv%]
+ {\stepcounter\@mpfn
+ \protected at xdef\@thefnmark{\thempfn}\@footnotemark
+ \def\FNH at endfntext@next{\FNH at endfntext@link}\fn at startfntext}}%
+\def\FNH at xfootnoteenv [#1]{%
+ \begingroup
+ \csname c@\@mpfn\endcsname #1\relax
+ \unrestored at protected@xdef\@thefnmark{\thempfn}%
+ \endgroup\@footnotemark\def\FNH at endfntext@next{\FNH at endfntext@link}%
+ \fn at startfntext}%
+\def\FNH at fixed@footnotetext {\ifx\@currenvir\fn at footnotetext
+ \expandafter\FNH at footnotetextenv\else\expandafter\fn at latex@@footnotetext\fi}%
+\def\FNH at footnotetextenv {\@ifnextchar[\FNH at xfootnotetextenv%]
+ {\protected at xdef\@thefnmark{\thempfn}%
+ \def\FNH at endfntext@next{\FNH at endfntext@link}\fn at startfntext}}%
+\def\FNH at xfootnotetextenv [#1]{%
+ \begingroup
+ \csname c@\@mpfn\endcsname #1\relax
+ \unrestored at protected@xdef\@thefnmark{\thempfn}%
+ \endgroup\def\FNH at endfntext@next{\FNH at endfntext@nolink}%
+ \fn at startfntext }%
\ifx\FNH@@makefntext\undefined\expandafter\@gobble
\else\expandafter\AtBeginDocument\fi
{%
@@ -150,11 +173,10 @@
\def\FNH at check@c #11.2!3?4,#2#3\relax
{\ifx\FNH at check@c#2\expandafter\@gobble\fi\FNH at bad@footnote at env}%
\def\FNH at bad@footnote at 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:}%
+{\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:}%
\typeout{\meaning\@makefntext}%
\let\fn at prefntext\@empty\let\fn at postfntext\@empty
}%
More information about the tex-live-commits
mailing list