LaTeX: possible duplicated footnote in PDF from object signatures if with intersphinx and latex_show_urls='footnote' (original) (raw)
Describe the bug
PDF output may contain a duplicated footnote showing URL if intersphinx and latex_show_urls='footnote' are both used.
How to Reproduce
index.rst:
.. highlight:: rst
====== TEST
The C Domain
.. c:function:: PyObject *PyType_GenericAlloc(PyTypeObject *type, Py_ssize_t nitems)
bla
conf.py:
master_doc = 'index'
project = 'Test LaTeX warning bout footnote multiply defined'
extensions = [
'sphinx.ext.intersphinx',
]
latex_show_urls = 'footnote'
intersphinx_mapping = {
'python': ('https://docs.python.org/3/', None),
}
Then execute make latexpdf. The console output will show near end:
Latexmk: ====Undefined refs and citations with line #s in .tex file:
Label `0.footnote.1' multiply defined
Latexmk: All targets (testlatexwarningboutfootnotemultiplydefined.pdf) are up-to-date
and the PDF is indeed with a double footnote 1:
Environment Information
Sphinx version: 8.3.0+/2b7e3adf2
Python version: 3.13.3 (CPython)
Docutils version: 0.21.2
Pygments version: 2.19.1
Jinja2 version: 3.1.6
Sphinx extensions
['sphinx.ext.intersphinx']
Additional context
The LaTeX mark-up shows only once the footnote.
\begin{savenotes}\begin{fulllineitems} \phantomsection\label{\detokenize{index:c.PyType_GenericAlloc}} \pysigstartsignatures \pysigstartmultiline \pysiglinewithargsret {\sphinxhref{https://docs.python.org/3/c-api/structures.html\#c.PyObject}{\DUrole{n}{PyObject}}% \begin{footnote}[1]\sphinxAtStartFootnote \sphinxnolinkurl{https://docs.python.org/3/c-api/structures.html\#c.PyObject} % \end{footnote}\DUrole{w}{ }\DUrole{p}{}\sphinxbfcode{\sphinxupquote{\DUrole{n}{PyType_GenericAlloc}}}} {\sphinxhref{https://docs.python.org/3/c-api/type.html\#c.PyTypeObject}{\DUrole{n}{PyTypeObject}}% \begin{footnote}[2]\sphinxAtStartFootnote \sphinxnolinkurl{https://docs.python.org/3/c-api/type.html\#c.PyTypeObject} % \end{footnote}\DUrole{w}{ }\DUrole{p}{}\DUrole{n}{type}\sphinxparamcomma \sphinxhref{https://docs.python.org/3/c-api/intro.html\#c.Py\_ssize\_t}{\DUrole{n}{Py\_ssize\_t}}% \begin{footnote}[3]\sphinxAtStartFootnote \sphinxnolinkurl{https://docs.python.org/3/c-api/intro.html\#c.Py\_ssize\_t} % \end{footnote}\DUrole{w}{ }\DUrole{n}{nitems}} {} \pysigstopmultiline \pysigstopsignatures \sphinxAtStartPar bla
\end{fulllineitems}\end{savenotes}
so the the bug is in the interactions of savenotex, fulllineitems, footnote LaTeX environments and LaTeX commands such as \pysiglinewithargsret.
The problem shows in our own PDF docs currently at bottom of page 166:

