sphinx-doc / sphinx-doc/sphinx
LaTeX: footnote marks behaviour regarding page indicators is not consistent
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 8k
- Forks
- 2.6k
- PR merge metrics
- No merged PRs in 30d
Description
Describe the bug
In pdf output, footnote marks sometimes indicate the page number of where the footnote is located, if not on the same page, but the behaviour is not systematic, in particular from inside long tables.
A general solution however will be hard to come by, due to phenomenon described in https://github.com/sphinx-doc/sphinx/pull/10191#issuecomment-1038807448
How to Reproduce
Create project with this index.rst:
Welcome to FOO's documentation!
===============================
Test footnotes in a longtable
-----------------------------
.. raw:: latex
\vspace{13cm}
.. list-table:: LongTable caption
:header-rows: 1
:class: longtable
* - first ref to B [#b]_
- auto-numbered 1 [#]_
* - second ref to B [#b]_
- only ref to C [#c]_
* - auto-numbered 2 [#]_
- first ref to D [#d]_
* - second ref to D [#d]_
- b
* - a
- b
* - a
- b
* - a
- b
* - a
- b
* - a
- b
* - a
- b
* - a
- b
* - a
- b
* - a
- b
* - a
- b
* - a
- b
* - a
- b
* - a
- b
* - a
- b
* - a
- b
.. rubric:: Footnotes
.. [#b] B
.. [#c] C
.. [#d] D
.. [#] auto-numbered 1
.. [#] auto-numbered 2
and make latexpdf
Expected behavior
Footnote marks should coherently use or not the page number of footnote.
But in screenshot below we see various problems:
- footnote from header correctly indicates target page numbers, but for that part of table on last page, it depends whether the footnote was auto-numbered if it detects to be on same page as footnote (without #10191 merged also auto-numbered footnote do not detect they are on same page)
- footnote from table cells behave differently if they are mutlply referred to or not, or are auto-numbered
Your project
N/A
Screenshots
This is with current 4.x:

And this is with merge of #10191:

OS
Mac
Python version
3.8
Sphinx version
4.x at b8789b4cb6c or with #10191 merged
Sphinx extensions
No response
Extra tools
No response
Additional context
Relates #10175
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the case from index.rst with make latexpdf, then compare the current 4.x output with the behavior described for the merge of #10191. Trace how footnote marks from long tables and repeated or auto-numbered references determine their target page. Done means footnote marks use page indicators consistently, while accounting for the limitation described in the linked discussion.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- latex, python
- Domain
- documentation
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100