Why is the footnote text repeated several times at the bottom of the page?
How to get the footnote text only once? (and not 6 times as in the following example)
\documentclass{article}
\usepackage[a4paper,margin=1mm]{geometry}
\usepackage{lipsum}
\usepackage{tabularray}
% https://tex.stackexchange.com/questions/645421/tabularray-with-footnotes/712683#712683
\UseTblrLibrary{counter}
\UseTblrLibrary{functional}
\makeatletter
\IgnoreSpacesOn
\tlNew \gFootNoteTl
\intNew \gFootNoteInt
\prgNewFunction \footNote {m}
{
\tlPutRight \gFootNoteTl
{
\stepcounter{footnote}
\footnotetext{#1}
}
\prgReturn {\footnotemark{}}
}
\AddToHook{env/longtblr/before}{
\intSetEq \gFootNoteInt \c@footnote
\tlClear \gFootNoteTl
}
\AddToHook{env/longtblr/after}{
\intSetEq \c@footnote \gFootNoteInt
\tlUse \gFootNoteTl
}
\IgnoreSpacesOff
\makeatother
\begin{document}
\begin{longtblr}[
presep=-4pt,postsep=0pt
]{
colspec = {lX},
colsep=4pt,
hline{odd}={solid},
row{odd}={belowsep=0pt},
row{even}={abovesep=0pt},
cell{even}{1} = {c=2}{wd=\textwidth-8pt,halign=j}
}
01/01/2020 $-$ 31/12/2022 & \textbf{First}\\
\lipsum[2] &\\
01/01/2018 $-$ 31/12/2019 \footNote{my footnote} & \textbf{Second}\\
\lipsum[2] &\\
01/01/2016 $-$ 31/12/2017 & \textbf{Third}\\
\lipsum[2] &\\
\end{longtblr}
\end{document}
EDITED after the comments of @daleif and @gusbrs, who I thank a lot!
The moving of \prgReturn {\footnotemark{}}
outside the \IfBooleanF
condition, impedes the footnote symbol to go down to the following line in the table:
\documentclass{article}
\usepackage[a4paper,margin=1mm]{geometry}
\usepackage{lipsum}
\usepackage{tabularray}
% https://tex.stackexchange.com/questions/645421/tabularray-with-footnotes/712683#712683
\UseTblrLibrary{counter}
\UseTblrLibrary{functional}
\makeatletter
\IgnoreSpacesOn
\tlNew \gFootNoteTl
\intNew \gFootNoteInt
\prgNewFunction \footNote {m}
{
\IfBooleanF { \lTblrMeasuringBool }
{
\tlPutRight \gFootNoteTl
{
\stepcounter{footnote}
\footnotetext{#1}
}
%\prgReturn {\footnotemark{}} % <-- Before
}
\prgReturn {\footnotemark{}} % <-- Now
}
\AddToHook{env/longtblr/before}{
\intSetEq \gFootNoteInt \c@footnote
\tlClear \gFootNoteTl
}
\AddToHook{env/longtblr/after}{
\intSetEq \c@footnote \gFootNoteInt
\tlUse \gFootNoteTl
}
\IgnoreSpacesOff
\makeatother
\begin{document}
\begin{longtblr}[
presep=-4pt,postsep=0pt
]{
colspec = {lX},
colsep=4pt,
hline{odd}={solid},
row{odd}={belowsep=0pt},
row{even}={abovesep=0pt},
cell{even}{1} = {c=2}{wd=\textwidth-8pt,halign=j}
}
01/01/2020 $-$ 31/12/2022 & \textbf{First}\\
\lipsum[2] &\\
01/01/2018 $-$ 31/12/2019 \footNote{my footnote} & \textbf{Second}\\
\lipsum[2] &\\
01/01/2016 $-$ 31/12/2017 & \textbf{Third}\\
\lipsum[2] &\\
\end{longtblr}
\end{document}
\typeout{foo}
to\footNote
you can see that it gets executed 6 times. Presumably for measuring etc.align
fromamsmath
does something similar (runs twice) but has a setting one can test for to see if we are in a measuring state. Perhaps this has something similar (have not checked)