-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
LaTeX builder: pdflatex "Counter too large" error from footnotes inside tables of contents #2291
Comments
Fixed at 9b958b6. Thank you for reporting! |
@tk0miya This has solved the problem also for the original project where I first encountered it. Thanks. |
This works from the LaTeX point of view, the footnotes are gathered and put at bottom of page like any other footnote. Applies to local tables of contents and more generally topic directives which use the same SphinxShadowBox, and applies also to the warning type boxes. (in case of box contents on two or more pages, the footnotes appear on last one) The problem is that footnote.sty is not compatible with hyperref. What happens is that in case of multiple footnotes in a topic box, only the last one has a correct hyperlink to footnote text at bottom of page. The others point to document start. This is unrecoverable apart from re-writing footnote package (which dates back to 1997) and make it hyperref compatible. Hyperref package simply says to disable hyperfootnotes in case of use of package footnote... http://tex.stackexchange.com/questions/194255/is-there-a-way-to-make-the-footnote-package-work-correctly-with-hyperref This partially reverted 9b958b6 Fix sphinx-doc#2291: pdflatex "Counter too large" error from footnotes inside tables of contents. Test files not updated. modified: sphinx/texinputs/sphinx.sty modified: sphinx/writers/latex.py
I have made an attempt at
to reenable footnotes in topic directives. This is on top of current PR #2453. This uses package footnote already loaded by sphinx.sty. Unfortunately this package is very old (1997) and is definitely not hyperlink aware. Thus, the produced PDF is correct if printed but the hyperlinks are not functional (only the last one in each shadowed box or warning box works).
By the way, I see that footnote package is used by Sphinx for footnotes in tables rendered in LaTeX by use of package tabulary. Testing shows that hyperlinks do no work. As this is already "feature" of Sphinx, perhaps nevertheless my branch could be considered for potential merge, as it does bring some extra functionality.
Here is my test file ==============
TEST FOOTNOTES
==============
.. toctree::
:maxdepth: 2
index.rst
=====================
Testing footnotes (A)
=====================
.. contents::
:local:
Using :py:meth:`int.bit_length`
-------------------------------
Hyperlinks work when there is **only one footnote** involved in the topic or
warning box. With more footnotes there is no problem from the purely LaTeX
point of view. But hyperlinks fail. This is an intrinsic incompatiblity of
footnote package with hyperref which can't be fixed easily, one would need a
completely rewritten approach, taking into account package hyperref.
.. topic:: Test de topic
I want to use :py:meth:`int.bit_length`
.. warning::
I want to use :py:meth:`int.bit_length`
This does not work anymore:
.. topic:: Test de topic
I want to use :py:meth:`int.bit_length`
I want to use :py:meth:`int.bit_length`
.. warning::
I want to use :py:meth:`int.bit_length`
I want to use :py:meth:`int.bit_length`
=======================
Testing footnotes (B)
=======================
.. contents::
:local:
aaaa
----
.. topic:: First test of topic
Not much to say here apart that I want to use :py:meth:`int.bit_length`
I want to use :py:meth:`int.bit_length`
I want to use :py:meth:`int.bit_length`
I want to use :py:meth:`int.bit_length`
I want to use :py:meth:`int.bit_length`
I want to use :py:meth:`int.bit_length`
I want to use :py:meth:`int.bit_length`
I want to use :py:meth:`int.bit_length`
I want to use :py:meth:`int.bit_length`
bbbb
----
I want to use :py:meth:`int.bit_length`
I want to use :py:meth:`int.bit_length`
.. topic:: Second test of topic
I want to use :py:meth:`int.bit_length`
I want to use :py:meth:`int.bit_length`
I want to use :py:meth:`int.bit_length`
I want to use :py:meth:`int.bit_length`
I want to use :py:meth:`int.bit_length`
I want to use :py:meth:`int.bit_length`
I want to use :py:meth:`int.bit_length`
I want to use :py:meth:`int.bit_length`
I want to use :py:meth:`int.bit_length`
I want to use :py:meth:`int.bit_length`
I want to use :py:meth:`int.bit_length`
I want to use :py:meth:`int.bit_length`
I want to use :py:meth:`int.bit_length`
I want to use :py:meth:`int.bit_length`
I want to use :py:meth:`int.bit_length`
cccc
----
I want to use :py:meth:`int.bit_length`
I want to use :py:meth:`int.bit_length`
I want to use :py:meth:`int.bit_length`
I want to use :py:meth:`int.bit_length`
I want to use :py:meth:`int.bit_length`
I want to use :py:meth:`int.bit_length`
.. warning::
I want to use :py:meth:`int.bit_length`
I want to use :py:meth:`int.bit_length`
I want to use :py:meth:`int.bit_length`
I want to use :py:meth:`int.bit_length`
I want to use :py:meth:`int.bit_length`
I want to use :py:meth:`int.bit_length`
I want to use :py:meth:`int.bit_length`
I want to use :py:meth:`int.bit_length`
I want to use :py:meth:`int.bit_length`
I want to use :py:meth:`int.bit_length`
I want to use :py:meth:`int.bit_length`
I want to use :py:meth:`int.bit_length`
I want to use :py:meth:`int.bit_length`
I want to use :py:meth:`int.bit_length`
I want to use :py:meth:`int.bit_length`
I want to use :py:meth:`int.bit_length`
I want to use :py:meth:`int.bit_length`
I want to use :py:meth:`int.bit_length`
I want to use :py:meth:`int.bit_length`
=================
Testing in tables
=================
False [#f1]_
Seems Sphinx does not handle either hyperfootnotes in tables ?
(no supprise as footnote package used by sphinx.sty for tabulary)
===== ===== =======
A B A and B
===== ===== =======
False False False [#f2]_
True False False
False True False
True True True
===== ===== =======
.. raw:: latex
\clearpage
make a last page to better check if hypertargets ok
.. rubric:: Footnotes
.. [#f1] Hello
.. [#f2] are you sure? with extensions = [
# 'sphinx.ext.autodoc',
'sphinx.ext.intersphinx',
# 'sphinx.ext.mathjax',
]
intersphinx_mapping = {'python': ('http://docs.python.org/3', None),
# 'numpy': ('http://docs.scipy.org/doc/numpy/', None),
# 'scipy': ('http://docs.scipy.org/doc/scipy/reference/', None),
# 'matplotlib': ('http://matplotlib.sourceforge.net/', None)
} |
@tk0miya It seems I have found a way to patch LaTeX package footnote to be hyperref-compatible, at least for the footnotes as produces by Sphinx
I tested that it now works to remove that restriction, also when the table will be handled by Works fine in my brief testing ... where can I find |
This works from the LaTeX point of view, the footnotes are gathered and put at bottom of page like any other footnote. Applies to local tables of contents and more generally topic directives which use the same SphinxShadowBox, and applies also to the warning type boxes. (in case of box contents on two or more pages, the footnotes appear on last one) The problem is that footnote.sty is not compatible with hyperref. What happens is that in case of multiple footnotes in a topic box, only the last one has a correct hyperlink to footnote text at bottom of page. The others point to document start. This is unrecoverable apart from re-writing footnote package (which dates back to 1997) and make it hyperref compatible. Hyperref package simply says to disable hyperfootnotes in case of use of package footnote... http://tex.stackexchange.com/questions/194255/is-there-a-way-to-make-the-footnote-package-work-correctly-with-hyperref This partially reverted 9b958b6 Fix sphinx-doc#2291: pdflatex "Counter too large" error from footnotes inside tables of contents. Test files not updated. modified: sphinx/texinputs/sphinx.sty modified: sphinx/writers/latex.py
Oh, I'd overlooked the So we have two actions to fix this:
On the other hand, about the footnotes on tables, we have to consider carefully. We already have some troubles in representations tables; for example #1574 and #1681. BTW, these themes are already far from the issue. Could you file new issues please? |
done at #2461, sorry for inconvenience. |
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.
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.
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.
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.
The issue sphinx-doc#2291 which was fixed at 9b958b6 (1.3.6) is now alleviated in another way since PR sphinx-doc#3022 (b8e0e93).
With
issues arise when URLs make their ways in tables of contents. Indeed currently the
\footnote
command ends up as\footnote[xx]
with some numberxx
. Whenxx>26
an error arise, because LaTeX inside minipages wants to use alphabetical footnotes. And tables of contents are done inside such minipages.To create the problem (zip archive attached, without
build/
to make it smaller), two files:File
test1.rst
:and file
test2.rst
and file
index.rst
:and inside
conf.py
:and
One does then
make latex
and tries to compile the resultingtex
file withpdflatex
.This issue does not arise with Sphinx 1.3.1. It does on Sphinx 1.3.5. The issue is with using
\footnote[xx]
systematically rather than\footnote
. I did not yet look for the commit which introduced the\footnote[xx]
things.tocfootnotelatexsphinx.zip
The text was updated successfully, but these errors were encountered: