lvjr / tabularray

Typeset tabulars and arrays with LaTeX3
https://ctan.org/pkg/tabularray
247 stars 22 forks source link

Support for "automatic" page footnotes #336

Open mateusfccp opened 1 year ago

mateusfccp commented 1 year ago

This issue depends on #179.

Currently, if we try to use \footnote inside a tblr environment, the footnotes goes mental.

Sample code:

\documentclass{article}
\usepackage{tabularray}
\usepackage[language=english]{lipsum}

\title{Footnote Example}
\author{Mateus Felipe}
\date{December 2022}

\begin{document}

\maketitle

\section{Introduction}

\lipsum[1]\footnote{\lipsum[2]}

\begin{tblr}{c|c}
     Lorem\footnote{\lipsum[3]} & Ipsum  \\
     Dolor & Sit\footnote{\lipsum[4]}
\end{tblr}

\lipsum[5]\footnote{\lipsum[6]}

\end{document}

Result:

image

This is actually a common problem with tabular environments in LaTeX. To solve this, I usually use tabularx, which simply works with footnotes. However, I prefer tabularray API way more. The only thing making me still use tabularx sometimes is this limitation.

muzimuzhi commented 1 year ago

Support for table footnotes (footnotes typeset right after table, not in normal page footnote area) is introduced in tabularray 2021L (see changelog), and used in several examples in package manual, but not documented yet.

Just search for footnote in the package manual and you'll see option note and command \TblrNote in examples.

mateusfccp commented 1 year ago

Support for table footnotes (footnotes typeset right after table, not in normal page footnote area) is introduced in tabularray 2021L (see changelog), and used in several examples in package manual, but not documented yet.

Just search for footnote in the package manual and you'll see option note and command \TblrNote in examples.

I may be wrong, but isn't \TblrNote for table footnotes? Instead of regular footnotes? The issue proposes support for regular \footnote supporte.

Note that in the provided sample, the footnotes counter jumps from 1 to 9, then 12 and then 14, and only the ones that were in the text (1 and 14) are printed in the bottom of the page. The expected behavior is that all of them are printed in the bottom, and the numeration is sequential (1, 2, 3, 4).

muzimuzhi commented 1 year ago

Ah you want page footnotes. Then you may have to use \footnotemark and \footnotetext, and manage footnote counter manually.

\documentclass{article}
\usepackage{tabularray}

\textheight=5cm % for screenshot

\begin{document}
Text\footnote{before tblr}

\begin{tblr}{colspec=lll, hlines, vlines}
  a\footnotemark[\numexpr\value{footnote}+1] & b \\
  c\footnotemark[\numexpr\value{footnote}+2] & d \\
\end{tblr}
\footnotetext[\numexpr\value{footnote}+1]{tabularray footnote}
\footnotetext[\numexpr\value{footnote}+2]{another tabularray footnote}
\addtocounter{footnote}{2}

Text\footnote{after tblr}
\end{document}

image

Automatic avoidance of counter jumping depends on the implementation of

mateusfccp commented 1 year ago

Ah you want page footnotes. Then you may have to use \footnotemark and \footnotetext, and manage footnote counter manually.

Yeah, I am aware of this way of making footnotes. The issue is precisely a request to be able to simply use the regular \footnote command inside it, like we can in tabularx. I am going to try to make the issue clearer about what it is about.

Automatic avoidance of counter jumping depends on the implementation of

Thanks for the info, I am going to keep this one open as its related to it but not exactly the same thing.

lvjr commented 1 year ago

@mateusfccp You may have a look at the following answer of mine:

https://tex.stackexchange.com/questions/645421/tabularray-with-footnotes/645453#645453