From 1546b21f89e5596ebe85dd7f879d75829f897c18 Mon Sep 17 00:00:00 2001 From: Takeshi KOMIYA Date: Sun, 6 Feb 2022 14:54:21 +0900 Subject: [PATCH 1/2] Fix #9529: LaTeX: named footnotes are converted to "?" 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. --- CHANGES | 2 + sphinx/builders/latex/transforms.py | 31 ++++++------ sphinx/writers/latex.py | 4 +- tests/roots/test-footnotes/index.rst | 9 ++++ tests/test_build_latex.py | 71 ++++++++++++++++------------ 5 files changed, 72 insertions(+), 45 deletions(-) diff --git a/CHANGES b/CHANGES index a1b2479a3c..2dc01faf8e 100644 --- a/CHANGES +++ b/CHANGES @@ -24,6 +24,8 @@ Bugs fixed ---------- * #10133: autodoc: Crashed when mocked module is used for type annotation +* #9529: LaTeX: named auto numbered footnote (ex. ``[#named]``) that is referred + multiple times was rendered to a question mark * #10122: sphinx-build: make.bat does not check the installation of sphinx-build command before showing help diff --git a/sphinx/builders/latex/transforms.py b/sphinx/builders/latex/transforms.py index b12882df68..621c6a7cf4 100644 --- a/sphinx/builders/latex/transforms.py +++ b/sphinx/builders/latex/transforms.py @@ -237,7 +237,8 @@ class LaTeXFootnoteTransform(SphinxPostTransform): blah blah blah ... * Replace second and subsequent footnote references which refers same footnote definition - by footnotemark node. + by footnotemark node. Additionally, the footnote definition node is marked as + "referred". Before:: @@ -258,7 +259,7 @@ class LaTeXFootnoteTransform(SphinxPostTransform): After:: blah blah blah - +