diff options
author | Karl Berry <karl@freefriends.org> | 2016-04-22 21:23:32 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2016-04-22 21:23:32 +0000 |
commit | 39d9750a2998eddcc9f174b3e6944f7bacb37234 (patch) | |
tree | b42d8f2ccea3ffb8fded290e75dd082965756bc6 /Master/texmf-dist/source | |
parent | 1d4ee543b346c4fa8d9219405dc4062fdfee288a (diff) |
footnotehyper (22apr16)
git-svn-id: svn://tug.org/texlive/trunk@40686 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source')
-rw-r--r-- | Master/texmf-dist/source/latex/footnotehyper/footnotehyper.dtx | 189 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/footnotehyper/footnotehyper.ins | 8 |
2 files changed, 131 insertions, 66 deletions
diff --git a/Master/texmf-dist/source/latex/footnotehyper/footnotehyper.dtx b/Master/texmf-dist/source/latex/footnotehyper/footnotehyper.dtx index 1607e8cc50e..50070788e13 100644 --- a/Master/texmf-dist/source/latex/footnotehyper/footnotehyper.dtx +++ b/Master/texmf-dist/source/latex/footnotehyper/footnotehyper.dtx @@ -1,20 +1,20 @@ % -*- coding: utf-8; time-stamp-format: "%02d-%02m-%:y at %02H:%02M:%02S %Z" -*- %<*none> -\def\dtxtimestamp {Time-stamp: <19-04-2016 at 21:02:03 CEST>} +\def\dtxtimestamp {Time-stamp: <21-04-2016 at 11:40:54 CEST>} %</none> %<*!readme> %% %% Package: footnotehyper -%% Version: 0.9c (2016/04/19) +%% Version: 0.9d (2016/04/21) %% License: LPPL 1.3c %% Copyright (C) 2016 Jean-Francois Burnol <jfbu at free dot fr>. %% %</!readme> %<*insfile|tex> \def\pkgname {footnotehyper} -\def\pkgdate {2016/04/19} -\def\docdate {2016/04/19} -\def\pkgversion {v0.9c} +\def\pkgdate {2016/04/21} +\def\docdate {2016/04/21} +\def\pkgversion {v0.9d} \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.9c (2016/04/19) +% Version: 0.9d (2016/04/21) % License: LPPL 1.3c % Copyright (C) 2016 Jean-Francois Burnol <jfbu at free dot fr>. % @@ -54,7 +54,7 @@ %<*readme> <!-- --> - Source: footnotehyper.dtx (v0.9c 2016/04/19) + Source: footnotehyper.dtx (v0.9d 2016/04/21) Author: Jean-Francois Burnol Info: hyperref aware footnote.sty License: LPPL 1.3c or later @@ -68,11 +68,7 @@ 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. It is barely tested and its state is what I found sufficiently well-working on a current LaTeX document of -mine, I have not attempted any in-depth analysis of all possible -situations. As version number is at `v0.9c`, there is room for -incorporating suggestions until reaching final `v1.0`. I promise -not to find a mathematical constant in-between and I will -certainly not play the `999..9` game à la XeTeX. +mine. For those who don't know: the `footnote` package allows via `\savenotes` to gather footnotes and later release them via @@ -90,7 +86,8 @@ This package provides no facility for handling footnotes from floating environments. Some issues from `footnote.sty` made it incompatible with the -`color` and `xcolor` packages; this is corrected by `footnotehyper`. +`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. @@ -343,7 +340,7 @@ pdftitle={The \pkgname\space package},% pdfsubject={\pkgdescription},% pdfkeywords={LaTeX, footnotes},% pdfstartview=FitH,% -pdfpagemode=UseOutlines} +pdfpagemode=UseNone} % added usage of package bookmark 2013/10/10 \usepackage{bookmark} @@ -359,7 +356,8 @@ pdfpagemode=UseOutlines} \begin{document}\thispagestyle{empty} % the \MacroFont valid at begin document will be the one used in Implementation -\def\MacroFont{\ttfamily} +% the one defined here will be used by verbatim (not by \verb) +\def\MacroFont{\ttfamily\small} \rmfamily \bookmark[named=FirstPage,level=1]{Title page} @@ -378,11 +376,7 @@ pdfpagemode=UseOutlines} has not been made `hyperref` compatible. The aim of the present package is to do that. It is barely tested and its state is what I found sufficiently well-working on a current LaTeX document of - mine, I have not attempted any in-depth analysis of all possible - situations. As version number is at `v0.9c`, there is room for - incorporating suggestions until reaching final `v1.0`. I promise - not to find a mathematical constant in-between and I will - certainly not play the `999..9` game à la Xe\TeX. + mine. For those who don't know: the `footnote` package allows via `\savenotes` to gather footnotes and later release them via @@ -402,8 +396,8 @@ approach, which anyhow is not immediately `hyperref` compatible. The do the `\savenotes/\spewnotes` automatically. Some issues from `footnote.sty` made it incompatible with the -`color` and `xcolor` packages; this is corrected by -\fnh. +`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. @@ -412,13 +406,23 @@ but left to the user. \section{License} -\begingroup\ttfamily\small\hyphenchar\font -1 +\begingroup\ttfamily\footnotesize\hyphenchar\font -1 \parindent0pt \obeyspaces\obeylines % \pkgLicense\endgroup \section{Usage} +Do \emph{not} load |footnote|, leave that job to \fnh. You \emph{must} load +|hyperref|. + +Then you can use |\savenotes/\spewnotes| or the equivalent |savenotes| +environment; there is also a |footnote| environment, but its set-up during +\fnh loading is more delicate and it could well fail depending on how +|\@makefntext| has been customized by the class or other packages; a warning +is issued in that case. A functional |footnote| environment allows footnotes +with verbatim material. + \savenotes \begin{framed} Please refer to the documentation of the |footnote| package.% @@ -433,18 +437,18 @@ We can try some normal footnote.\footnote{Here it is.} \begin{savenotes} \begin{framed} -\DeleteShortVerb{\|}% +\DeleteShortVerb{\|}\MakeShortVerb{\*}% {\centering \begin{tabular}{|c|c|} \hline \strut The above\footnote{Notice that if the present frame extended to next page, - the \cs{spewnotes} command would then (try to) deliver its + the end of the *savenotes* environment would then (try to) deliver its footnotes to that page.} was & coded\footnote{Alternatively a savenotes environment could have been used.} as:\\\hline \end{tabular}\par} -\MakeShortVerb{\|}% +\DeleteShortVerb{\*}\MakeShortVerb{\|}% \begin{verbatim} \savenotes \begin{framed} @@ -456,30 +460,52 @@ We can try some normal footnote.\footnote{Here it is.} \end{framed} \spewnotes \end{verbatim} -and the present frame has \cs{footnote}'s from inside a -|tabular| and is inside a |savenotes| environment. Let's -test an |amsmath| environment with |\intertext|. As +and the present frame has \cs{footnote}'s from inside a |tabular| and is +inside a |savenotes| environment.% +% +% plus maintenant, \small pour le \MacroFont utilisé par verbatim +%\footnote{Well, I end up on next page. Not +% much I can do about this, ask why to |framed.sty| and the output routine I +% guess.} +% +\footnote{Here is an issue which has nothing (as I finally figured out) to do + with |footnote|, and only indirectly with \LaTeX: if you embed a + \emph{full-width} minipage (with initial \cs{noindent}) in any environment + not doing \cs{ignorespacesafterend}, be careful to add a \% after the + minipage (or after the surrounding environment; or a \cs{par} immediately), + else the output will have an extra blank line if the source has itself a + blank line there. I hesitated adding that to + \cs{spewnotes}/\cs{endsavenotes}. Finally I left as is.} Let's test an +|amsmath| environment with |\intertext|. As \begin{align} E&=mc^2\;, -\intertext{was too easy,\footnote{there is also $E=h\nu$.}, let's +\intertext{was too easy,\footnote{There is also $E=h\nu$.}, let's try:} F&=nd^3\;. \end{align} \end{framed} \end{savenotes} -One more normal footnote\footnote{Nothing left to say?} and finally a use -of |footnote| environment with some verbatim material.% +Use of the \texttt{footnote} \emph{environment} with some verbatim material% \begin{footnote} - |&$^%\[}$| + \verb|&$^%\[}$| \end{footnote} +which was coded as: +\begin{verbatim} +Use of the \texttt{footnote} \emph{environment} with some verbatim material% +\begin{footnote} + \verb|&$^%\[}$| +\end{footnote} +\end{verbatim} +And one more normal footnote.\footnote{You didn't want a footnote from + \emph{inside} the verbatim I hope ...} \StopEventually{\end{document}\endinput} \makeatletter \let\check@percent\original@check@percent \makeatother -\clearpage +%\clearpage \section{Implementation} \small @@ -525,11 +551,14 @@ of |footnote| environment with some verbatim material.% \ProcessOptions\relax % \end{macrocode} % \end{macro} -% We load |footnote| but leave the |hyperref| handling to the user. -% % \begin{macro}{\@makefntext} % \begin{macro}{\footnote} % \begin{macro}{\footnotetext} +% We load |footnote| but leave the |hyperref| handling to the user. +% +% As we need to intercept some re-definitions done by |footnote| 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 @@ -538,16 +567,20 @@ of |footnote| environment with some verbatim material.% % We also postpone to at begin document the redefinitions of \cs{footnote} and % \cs{footnotetext}. % \begin{macrocode} -\let\FNH@@makefntext\@makefntext\let\@makefntext\@firstofone -\RequirePackage{footnote}% -\let\@makefntext\FNH@@makefntext -\let\FNH@footnote \footnote -\let\FNH@footnotetext\footnotetext +\@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}\relax + \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{\@ifpackageloaded{hyperref}{}{\PackageError{footnotehyper}% - {hyperref package not loaded!^^JThat's not easily forgiven..}% - {I am sure you know what to do. Else, think hard: yes you can!}}}% + {hyperref package not loaded!^^Jhow many errors will you get ?...}% + {...I am sure you know what to do next time!}}}% % \end{macrocode} % \end{macro}\end{macro}\end{macro} % \begin{macro}{\fn@fntext} @@ -587,9 +620,10 @@ of |footnote| environment with some verbatim material.% % \end{macrocode} % \end{macro} % \begin{macro}{\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}. +% \begin{macro}{endsavenotes} +% 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}. % \begin{macrocode} \def\spewnotes {\endgroup \if@savingnotes\else\ifvoid\fn@notes\else @@ -599,8 +633,9 @@ of |footnote| environment with some verbatim material.% \H@@footnotetext{\unvbox\fn@notes}% \endgroup\fi\fi }% +\let\endsavenotes\spewnotes % \end{macrocode} -% \end{macro} +% \end{macro}\end{macro} % \begin{macro}{\fn@endfntext} % \begin{macro}{\fn@endnote} % We now take care of |footnote.sty|'s |footnote| environment. The original @@ -609,7 +644,8 @@ of |footnote| environment with some verbatim material.% % \cs{fn@endnote} was |\let| to |\color@endgroup| which is wrong. % % And we need our usual replacement of \cs{@footnotetext} by -% \cs{H@@footnotetext}. +% \cs{H@@footnotetext}. And this time (|v0.9d|) let's not forget the hyperlink +% target. % \begin{macrocode} \def\fn@endnote {\color@endgroup}% \def\fn@endfntext{% @@ -621,7 +657,19 @@ of |footnote| environment with some verbatim material.% \let\@makefntext\@empty \let\@finalstrut\@gobble \let\rule\@gobbletwo - \H@@footnotetext{\unvbox\z@}% + \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 }% \let\endfootnote \fn@endfntext @@ -634,8 +682,8 @@ of |footnote| environment with some verbatim material.% \AtBeginDocument {% \let\fn@latex@@footnote \footnote \let\fn@latex@@footnotetext\footnotetext - \let\footnote \FNH@footnote - \let\footnotetext\FNH@footnotetext + \let\footnote \FNH@fn@footnote + \let\footnotetext\FNH@fn@footnotetext }% % \end{macrocode} % \begin{macro}{\@makefntext} @@ -643,25 +691,42 @@ of |footnote| environment with some verbatim material.% % \begin{macro}{\fn@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, or is used multiple times. Let's figure -% it out. +% 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|. % \begin{macrocode} -\AtBeginDocument - {\expandafter\FNH@check@a\@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\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}% - {\long\def\fn@prefntext{#1}\long\def\fn@postfntext{#2}\FNH@check@b}% + \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 +\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...)}% +\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 diff --git a/Master/texmf-dist/source/latex/footnotehyper/footnotehyper.ins b/Master/texmf-dist/source/latex/footnotehyper/footnotehyper.ins index 7bc6512b2a4..8f344f2c063 100644 --- a/Master/texmf-dist/source/latex/footnotehyper/footnotehyper.ins +++ b/Master/texmf-dist/source/latex/footnotehyper/footnotehyper.ins @@ -1,13 +1,13 @@ %% %% Package: footnotehyper -%% Version: 0.9c (2016/04/19) +%% Version: 0.9d (2016/04/21) %% License: LPPL 1.3c %% Copyright (C) 2016 Jean-Francois Burnol <jfbu at free dot fr>. %% \def\pkgname {footnotehyper} -\def\pkgdate {2016/04/19} -\def\docdate {2016/04/19} -\def\pkgversion {v0.9c} +\def\pkgdate {2016/04/21} +\def\docdate {2016/04/21} +\def\pkgversion {v0.9d} \def\pkgdescription {hyperref aware footnote.sty (JFB)} %% %% Run etex on this file to extract from footnotehyper.dtx: |