LaTeX writer: don't use footnotehyper for notes in longtable.

Instead, generate them manually as we do for floating tables.

This removes our dependency on footnotehyper, and solves a
compatibility problem with `endfloat`.

Closes #11857.
This commit is contained in:
John MacFarlane
2026-09-20 11:33:39 -07:00
parent 09146f82af
commit 57272eab32
4 changed files with 12 additions and 13 deletions
-3
View File
@@ -88,9 +88,6 @@ $else$
\makeatletter
\patchcmd\longtable{\par}{\if@noskipsec\mbox{}\fi\par}{}{}
\makeatother
% Allow footnotes in longtable head/foot
\IfFileExists{footnotehyper.sty}{\usepackage{footnotehyper}}{\usepackage{footnote}}
\makesavenoteenv{longtable}
$endif$
$endif$
$--
+1 -6
View File
@@ -53,7 +53,6 @@ tableToLaTeX inlnsToLaTeX blksToLaTeX tbl = do
$ lookup "latex-placement" kvs
-- if the float class is included in table attributes, we generate a floating
-- table environment; otherwise we use longtable
beamer <- gets stBeamer
let float = "float" `elem` classes
let renderTable = do
let unnumbered = "unnumbered" `elem` classes
@@ -83,11 +82,7 @@ tableToLaTeX inlnsToLaTeX blksToLaTeX tbl = do
then makeUnnumbered
else id) <$>
makeTable colDesc mkHead mkRow capt thead tbodies tfoot
-- See #5367 -- footnotehyper/footnote don't work in beamer,
-- so we need to produce the notes outside the table...
if float || beamer
then ($$) <$> withExternalNotes renderTable <*> getAccumulatedNotes
else renderTable
($$) <$> withExternalNotes renderTable <*> getAccumulatedNotes
tableToLaTeXTable :: PandocMonad m
=> Doc Text
+2 -1
View File
@@ -14,7 +14,7 @@ is used.
\begin{longtable}[]{@{}ll@{}}
\caption{a table}\tabularnewline
\toprule\noalign{}
x & y\footnote{a footnote} \\
x & y\footnotemark{} \\
\midrule\noalign{}
\endfirsthead
\toprule\noalign{}
@@ -25,4 +25,5 @@ x & y{} \\
\endlastfoot
1 & 2 \\
\end{longtable}
\footnotetext{a footnote}
```
+9 -3
View File
@@ -22,10 +22,10 @@ hello\footnote{doc footnote}
\begin{longtable}[]{@{}
>{\centering\arraybackslash}p{(\linewidth - 0\tabcolsep) * \real{0.1667}}@{}}
\caption[Sample table.]{Sample table.\footnote{caption footnote}}\tabularnewline
\caption[Sample table.]{Sample table.\footnotemark{}}\tabularnewline
\toprule\noalign{}
\begin{minipage}[b]{\linewidth}\centering
Fruit\footnote{header footnote}
Fruit\footnotemark{}
\end{minipage} \\
\midrule\noalign{}
\endfirsthead
@@ -37,8 +37,14 @@ Fruit{}
\endhead
\bottomrule\noalign{}
\endlastfoot
Bans\footnote{table cell footnote} \\
Bans\footnotemark{} \\
\end{longtable}
\addtocounter{footnote}{-2}
\footnotetext{caption footnote}
\addtocounter{footnote}{1}
\footnotetext{header footnote}
\addtocounter{footnote}{1}
\footnotetext{table cell footnote}
dolly\footnote{doc footnote}
```