forked from sphinx-doc/sphinx
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow hyperlinked footnotes in tables and topics of pdf output
Using an updated footnote.sty package, it is possible to have footnotes in tables (be it tabular, tabulary, threeparttable, or longtable) without \footnotemark/\footnotetext which anyhow do not create working hyper-footnotes. This partially reverts commit 9b958b6 (Fix sphinx-doc#2291). The fixes to footnote.sty to make it hyperref aware are in the small shipped "footnotehyper-sphinx" package.
- Loading branch information
Showing
3 changed files
with
89 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
\NeedsTeXFormat{LaTeX2e} | ||
\ProvidesPackage{footnotehyper-sphinx}% | ||
[2016/04/22 v0.9d-sphinx hyperref aware footnote.sty (JFB)] | ||
\DeclareOption*{}% | ||
\ProcessOptions\relax | ||
%% | ||
%% Package: footnotehyper-sphinx | ||
%% Version: 0.9d-sphinx (2016/04/22) | ||
%% License: LPPL 1.3c (http://www.latex-project.org/lppl/lppl-1-3c.txt) | ||
%% Copyright (C) 2016 Jean-Francois Burnol <jfbu at free dot fr>. | ||
%% | ||
%% Trimmed variant of footnotehyper v0.9d (2016/04/21) | ||
%% Sphinx does not use the `footnote` environment defined by footnote.sty. The | ||
%% loading of footnote.sty may crash if the user has other footnote related | ||
%% packages loaded first. Thus to make sure no such crash can happen, we | ||
%% deactivate this construction of footnote environment and take care only | ||
%% of \footnote command. | ||
\let\FNHS@@makefntext\@makefntext\let\@makefntext\@firstofone | ||
\let\FNHS@endfootnote\endfootnote % probably \undefined | ||
\let\FNHS@endfootnotetext\endfootnotetext | ||
\RequirePackage{footnote}\relax | ||
\let\@makefntext\FNHS@@makefntext | ||
\let\footnote \fn@latex@@footnote | ||
\let\footnotetext\fn@latex@@footnotetext | ||
\let\endfootnote \FNHS@endfootnote | ||
\let\endfootnotetext\FNHS@endfootnotetext | ||
\def\fn@fntext {\ifx\ifmeasuring@\undefined\expandafter\@secondoftwo | ||
\else\expandafter\@firstofone\fi | ||
{\ifmeasuring@\expandafter\@gobbletwo\fi}% | ||
\FNHS@fn@fntext }% | ||
\long\def\FNHS@fn@fntext #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\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 | ||
}% | ||
\let\endsavenotes\spewnotes | ||
\def\fn@endnote {\color@endgroup}% | ||
\AtBeginDocument {% | ||
\let\fn@latex@@footnote \footnote | ||
\let\fn@latex@@footnotetext\footnotetext | ||
\let\footnote \FNHS@fn@footnote | ||
\let\footnotetext\FNHS@fn@footnotetext | ||
}% | ||
\endinput | ||
%% | ||
%% End of file `footnotehyper-sphinx.sty'. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters