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
Fix #9529: LaTeX: named footnotes are converted to "?" #10169
Fix #9529: LaTeX: named footnotes are converted to "?" #10169
Conversation
Named auto numbered footnote (ex. ``[#named]``) that is referred multiple times was rendered to a question mark. This calls `\sphinxstepexplicit` for every footnote node that is referred multiple times.
00c3519
to
1546b21
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed you are right that what was needed was to know which footnotes are multiply referred too, so LGTM!
small nits: The macro \sphinxstepexplicit
is now a bit misnamed, let's however stick with its current name. But at some point a comment in texinputs/sphinx.sty
may need update like this:
index 4d42199a7..6c9f1606e 100644
--- a/sphinx/texinputs/sphinx.sty
+++ b/sphinx/texinputs/sphinx.sty
@@ -300,9 +300,9 @@
% Support scopes for footnote numbering
\newcounter{sphinxscope}
\newcommand{\sphinxstepscope}{\stepcounter{sphinxscope}}
-% Explicitly numbered footnotes may be referred to, and for this to be
-% clickable we need to have only one target. So we will step this at each
-% explicit footnote and let \thesphinxscope take it into account
+% Some footnotes are multiply referred-to. For unique hypertarget in pdf,
+% we need an additional counter. It is called "sphinxexplicit" for legacy
+% reasons as "explicitly" numbered footnotes may be multiply referred-to.
\newcounter{sphinxexplicit}
\newcommand{\sphinxstepexplicit}{\stepcounter{sphinxexplicit}}
% Some babel/polyglossia languages fiddle with \@arabic, so let's be extra
This extra patch may be postponed to later occaion.
edited: what follows was based on some confused memory, the situation described below with multiple sources may still lead to wrong hyperlinks even with this PR (related #10175).
I have noticed that this PR gives correct hyperlinks even in situation where named footnotes originate in multiple documents, and so may use for example both 1
as footnote mark, which in pdf single document output may be confusing if on same page, but at least with this PR the hyperlink is ok. For example
========== ===
Test [#a]_
========== ===
1 One
========== ===
.. [#a] Footnote one.
in document doc1.rst
and
========== ===
Test [#a]_
========== ===
1 Two
========== ===
.. [#a] Footnote two.
in doc2.rst
, both in toctree of index.rst
. In future there is potential using the sphinxscope
apparatus in sphinx.sty
to create in PDF a disambiguating footnote mark, but at any rate already hyperlink will point to correct footnote, even if on same page in PDF.
Thank you for reviewing. Updated the comment now. Let's discuss the problem with multiple sources in #10175. Thanks as always! |
Feature or Bugfix
Purpose
[#named]
) that is referredmultiple times was rendered to a question mark.
\sphinxstepexplicit
for every footnote node that isreferred multiple times.