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
Problems with footnotes in LaTeX #10175
Comments
Thanks for report Also With So both targets have problems, but of opposite nature... |
This patch appears to fix it: $ git diff
diff --git a/sphinx/writers/latex.py b/sphinx/writers/latex.py
index a2905e807..84986af71 100644
--- a/sphinx/writers/latex.py
+++ b/sphinx/writers/latex.py
@@ -653,6 +653,8 @@ class LaTeXTranslator(SphinxTranslator):
short = ''
if any(node.findall(nodes.image)):
short = ('[%s]' % self.escape(' '.join(clean_astext(node).split())))
+ if self.sectionlevel == self.top_sectionlevel:
+ self.body.append(r'\sphinxstepscope' + CR)
try:
self.body.append(r'\%s%s{' % (self.sectionnames[self.sectionlevel], short)) @tk0miya As you see above, the fix can be obtained by inserting I tested using this One
----
========== ===
Test [#a]_
========== ===
1 One
========== ===
.. [#a] Footnote one.
sous-section
^^^^^^^^^^^^
========== ===
Test [#b]_
========== ===
1b Oneb
========== ===
.. [#b] Footnote oneb. |
I fixed it myself by monkey-patching |
And for the page detection, see https://gitlab.com/Molcas/OpenMolcas/-/blob/db84fd20654312ff9d224697916b0b6ab526bafc/doc/source/conf.py#L454 ( |
Let's wait for @tk0miya opinion if issuing
I will look into it. The LaTeX shipout routines assigns a correct value to |
The sample above is a problematic case. For me, there are two footnote marks in page 4, one says |
@Jellby thanks can you raise separate issue about |
I can raise a new issue, but note that the problem with |
Allright, let's keep one issue. But there is one aspect whose resolution I will prefer to delay to later which is about colliding footnote marks originating in named or explicit mark-up in sources spread across files, a problem which is made worse from adding Also, I pointed out your example also has sub-optimal outcome with the |
Looks good. The |
@tk0miya Ok, I will incorporate this to fix of #10188. I am expecting to drop entirely the business with But there will be a change in our Sphinx LaTeX mark-up for I started looking into this and I observe that The |
I just posted #10190 to fix this. Please reject it if you'll post another work.
You can do it by modifying
I think putting |
…rent_files Fix #10175: LaTeX: named footnote ref is linked to an incorrect footnote
Describe the bug
These are a couple of issues with LaTeX footnotes, which may be related to #9529 and possibly partially fixed by #10169.
How to Reproduce
Default new project, with
latex_elements = {'fontpkg': r'\usepackage[notextcomp]{kpfonts}'}
and these two files:one.rst
two.rst
Expected behavior
[#a]
, they're in different files).Page 3, 1
.Your project
See "How to Reproduce" above
Screenshots
No response
OS
Linux Ubuntu 20.04
Python version
3.6.9
Sphinx version
4.4.0
Sphinx extensions
No response
Extra tools
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: