From 94d26d48b869cbc9dcbe501df3929ab137c14f64 Mon Sep 17 00:00:00 2001 From: Takeshi KOMIYA Date: Wed, 2 Mar 2016 12:21:18 +0900 Subject: [PATCH 1/3] Fix CHANGES --- CHANGES | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGES b/CHANGES index 06bd5e803..3769ebea2 100644 --- a/CHANGES +++ b/CHANGES @@ -4,6 +4,9 @@ Release 1.3.7 (in development) Bugs fixed ---------- +* #2358: Fix user-preamble could not override the tocdepth definition. +* #2358: Redece tocdepth if ``part`` or ``chapter`` is used for top_sectionlevel. + Release 1.3.6 (released Feb 29, 2016) ===================================== @@ -30,8 +33,6 @@ Bugs fixed * #1565, #2229: Revert new warning; the new warning will be triggered from version 1.4 on. * #2329: Refresh environment forcely if source directory has changed. * #2019: Fix the domain objects in search result are not escaped -* #2358: Fix user-preamble could not override the tocdepth definition. -* #2358: Redece tocdepth if ``part`` or ``chapter`` is used for top_sectionlevel. Release 1.3.5 (released Jan 24, 2016) ===================================== From 6efdd07d946c2b6a26b0eac773f09e7b3609ba4e Mon Sep 17 00:00:00 2001 From: Takeshi KOMIYA Date: Wed, 2 Mar 2016 12:22:05 +0900 Subject: [PATCH 2/3] #2351: Fix footnote spacing --- CHANGES | 1 + sphinx/writers/latex.py | 4 +- tests/test_build_latex.py | 78 +++++++++++++++++++++++---------------- 3 files changed, 49 insertions(+), 34 deletions(-) diff --git a/CHANGES b/CHANGES index 3769ebea2..4c39742d4 100644 --- a/CHANGES +++ b/CHANGES @@ -6,6 +6,7 @@ Bugs fixed * #2358: Fix user-preamble could not override the tocdepth definition. * #2358: Redece tocdepth if ``part`` or ``chapter`` is used for top_sectionlevel. +* #2351: Fix footnote spacing Release 1.3.6 (released Feb 29, 2016) diff --git a/sphinx/writers/latex.py b/sphinx/writers/latex.py index a87d6bee3..d5afa3565 100644 --- a/sphinx/writers/latex.py +++ b/sphinx/writers/latex.py @@ -905,9 +905,9 @@ class LaTeXTranslator(nodes.NodeVisitor): def visit_collected_footnote(self, node): self.in_footnote += 1 if 'footnotetext' in node: - self.body.append('\\footnotetext[%s]{' % node['number']) + self.body.append('\\footnotetext[%s]{\\mbox{ }%%' % node['number']) else: - self.body.append('\\footnote[%s]{' % node['number']) + self.body.append('\\footnote[%s]{\\mbox{ }%%' % node['number']) def depart_collected_footnote(self, node): self.body.append('}') diff --git a/tests/test_build_latex.py b/tests/test_build_latex.py index 28ae183ca..d491168ad 100644 --- a/tests/test_build_latex.py +++ b/tests/test_build_latex.py @@ -323,9 +323,9 @@ def test_footnote(app, status, warning): print(result) print(status.getvalue()) print(warning.getvalue()) - assert '\\footnote[1]{\nnumbered\n}' in result - assert '\\footnote[2]{\nauto numbered\n}' in result - assert '\\footnote[3]{\nnamed\n}' in result + assert '\\footnote[1]{\\mbox{ }%\nnumbered\n}' in result + assert '\\footnote[2]{\\mbox{ }%\nauto numbered\n}' in result + assert '\\footnote[3]{\\mbox{ }%\nnamed\n}' in result assert '{\\hyperref[footnote:bar]{\\emph{{[}bar{]}}}}' in result assert '\\bibitem[bar]{bar}{\\phantomsection\\label{footnote:bar} ' in result assert '\\bibitem[bar]{bar}{\\phantomsection\\label{footnote:bar} \ncite' in result @@ -333,8 +333,8 @@ def test_footnote(app, status, warning): assert '\\capstart\\caption{Table caption \\protect\\footnotemark[4]}' in result assert 'name \\protect\\footnotemark[5]' in result assert ('\\end{threeparttable}\n\n' - '\\footnotetext[4]{\nfootnotes in table caption\n}' - '\\footnotetext[5]{\nfootnotes in table\n}' in result) + '\\footnotetext[4]{\\mbox{ }%\nfootnotes in table caption\n}' + '\\footnotetext[5]{\\mbox{ }%\nfootnotes in table\n}' in result) @with_app(buildername='latex', testroot='footnotes') @@ -351,15 +351,18 @@ def test_reference_in_caption(app, status, warning): assert '\\paragraph{The rubric title with a reference to {[}AuthorYear{]}}' in result assert ('\\chapter{The section with a reference to \\protect\\footnotemark[4]}\n' '\\label{index:the-section-with-a-reference-to}' - '\\footnotetext[4]{\nFootnote in section\n}' in result) + '\\footnotetext[4]{\\mbox{ }%\nFootnote in section\n}' in result) assert ('\\caption{This is the figure caption with a footnote to ' '\\protect\\footnotemark[6].}\end{figure}\n' - '\\footnotetext[6]{\nFootnote in caption\n}')in result + '\\footnotetext[6]{\\mbox{ }%\nFootnote in caption\n}')in result assert ('\\caption{footnote \\protect\\footnotemark[7] ' 'in caption of normal table}') in result - assert '\\end{threeparttable}\n\n\\footnotetext[7]{\nFoot note in table\n}' in result - assert '\\caption{footnote \\protect\\footnotemark[8] in caption of longtable}' in result - assert '\end{longtable}\n\n\\footnotetext[8]{\nFoot note in longtable\n}' in result + assert ('\\end{threeparttable}\n\n\\footnotetext[7]{\\mbox{ }%\nFoot note in table\n}' + in result) + assert ('\\caption{footnote \\protect\\footnotemark[8] in caption of longtable}' + in result) + assert ('\end{longtable}\n\n\\footnotetext[8]{\\mbox{ }%\nFoot note in longtable\n}' + in result) @with_app(buildername='latex', testroot='footnotes', @@ -370,8 +373,10 @@ def test_latex_show_urls_is_inline(app, status, warning): print(result) print(status.getvalue()) print(warning.getvalue()) - assert 'Same footnote number \\footnote[1]{\nfootnote in bar\n} in bar.rst' in result - assert 'Auto footnote number \\footnote[1]{\nfootnote in baz\n} in baz.rst' in result + assert ('Same footnote number \\footnote[1]{\\mbox{ }%\nfootnote in bar\n} in bar.rst' + in result) + assert ('Auto footnote number \\footnote[1]{\\mbox{ }%\nfootnote in baz\n} in baz.rst' + in result) assert ('\\phantomsection\\label{index:id26}{\\hyperref[index:the\\string-section' '\\string-with\\string-a\\string-reference\\string-to\\string-authoryear]' '{\\emph{The section with a reference to \\phantomsection\\label{index:id1}' @@ -379,16 +384,17 @@ def test_latex_show_urls_is_inline(app, status, warning): assert ('\\phantomsection\\label{index:id27}{\\hyperref[index:the\\string-section' '\\string-with\\string-a\\string-reference\\string-to]{\\emph{The section ' 'with a reference to }}}' in result) - assert 'First footnote: \\footnote[2]{\nFirst\n}' in result - assert 'Second footnote: \\footnote[1]{\nSecond\n}' in result + assert 'First footnote: \\footnote[2]{\\mbox{ }%\nFirst\n}' in result + assert 'Second footnote: \\footnote[1]{\\mbox{ }%\nSecond\n}' in result assert '\\href{http://sphinx-doc.org/}{Sphinx} (http://sphinx-doc.org/)' in result - assert 'Third footnote: \\footnote[3]{\nThird\n}' in result + assert 'Third footnote: \\footnote[3]{\\mbox{ }%\nThird\n}' in result assert ('\\href{http://sphinx-doc.org/~test/}{URL including tilde} ' '(http://sphinx-doc.org/\\textasciitilde{}test/)' in result) assert ('\\item[{\\href{http://sphinx-doc.org/}{URL in term} (http://sphinx-doc.org/)}] ' '\\leavevmode\nDescription' in result) assert ('\\item[{Footnote in term \\protect\\footnotemark[5]}] ' - '\\leavevmode\\footnotetext[5]{\nFootnote in term\n}\nDescription' in result) + '\\leavevmode\\footnotetext[5]{\\mbox{ }%\nFootnote in term\n}\nDescription' + in result) assert ('\\item[{\\href{http://sphinx-doc.org/}{Term in deflist} ' '(http://sphinx-doc.org/)}] \\leavevmode\nDescription' in result) assert ('\\href{https://github.com/sphinx-doc/sphinx}' @@ -405,8 +411,10 @@ def test_latex_show_urls_is_footnote(app, status, warning): print(result) print(status.getvalue()) print(warning.getvalue()) - assert 'Same footnote number \\footnote[1]{\nfootnote in bar\n} in bar.rst' in result - assert 'Auto footnote number \\footnote[2]{\nfootnote in baz\n} in baz.rst' in result + assert ('Same footnote number \\footnote[1]{\\mbox{ }%\nfootnote in bar\n} in bar.rst' + in result) + assert ('Auto footnote number \\footnote[2]{\\mbox{ }%\nfootnote in baz\n} in baz.rst' + in result) assert ('\\phantomsection\\label{index:id26}{\\hyperref[index:the\\string-section' '\\string-with\\string-a\\string-reference\\string-to\\string-authoryear]' '{\\emph{The section with a reference to \\phantomsection\\label{index:id1}' @@ -414,20 +422,24 @@ def test_latex_show_urls_is_footnote(app, status, warning): assert ('\\phantomsection\\label{index:id27}{\\hyperref[index:the\\string-section' '\\string-with\\string-a\\string-reference\\string-to]{\\emph{The section ' 'with a reference to }}}' in result) - assert 'First footnote: \\footnote[3]{\nFirst\n}' in result - assert 'Second footnote: \\footnote[1]{\nSecond\n}' in result + assert 'First footnote: \\footnote[3]{\\mbox{ }%\nFirst\n}' in result + assert 'Second footnote: \\footnote[1]{\\mbox{ }%\nSecond\n}' in result assert ('\\href{http://sphinx-doc.org/}{Sphinx}' - '\\footnote[4]{\nhttp://sphinx-doc.org/\n}' in result) - assert 'Third footnote: \\footnote[6]{\nThird\n}' in result + '\\footnote[4]{\\mbox{ }%\nhttp://sphinx-doc.org/\n}' in result) + assert 'Third footnote: \\footnote[6]{\\mbox{ }%\nThird\n}' in result assert ('\\href{http://sphinx-doc.org/~test/}{URL including tilde}' - '\\footnote[5]{\nhttp://sphinx-doc.org/\\textasciitilde{}test/\n}' in result) + '\\footnote[5]{\\mbox{ }%\nhttp://sphinx-doc.org/\\textasciitilde{}test/\n}' + in result) assert ('\\item[{\\href{http://sphinx-doc.org/}{URL in term}\\protect\\footnotemark[8]}] ' - '\\leavevmode\\footnotetext[8]{\nhttp://sphinx-doc.org/\n}\nDescription' in result) + '\\leavevmode\\footnotetext[8]{\\mbox{ }%\nhttp://sphinx-doc.org/\n}\nDescription' + in result) assert ('\\item[{Footnote in term \\protect\\footnotemark[10]}] ' - '\\leavevmode\\footnotetext[10]{\nFootnote in term\n}\nDescription' in result) + '\\leavevmode\\footnotetext[10]{\\mbox{ }%\nFootnote in term\n}\nDescription' + in result) assert ('\\item[{\\href{http://sphinx-doc.org/}{Term in deflist}\\protect' '\\footnotemark[9]}] ' - '\\leavevmode\\footnotetext[9]{\nhttp://sphinx-doc.org/\n}\nDescription' in result) + '\\leavevmode\\footnotetext[9]{\\mbox{ }%\nhttp://sphinx-doc.org/\n}\nDescription' + in result) assert ('\\href{https://github.com/sphinx-doc/sphinx}' '{https://github.com/sphinx-doc/sphinx}\n' in result) assert ('\\href{mailto:sphinx-dev@googlegroups.com}' @@ -442,8 +454,10 @@ def test_latex_show_urls_is_no(app, status, warning): print(result) print(status.getvalue()) print(warning.getvalue()) - assert 'Same footnote number \\footnote[1]{\nfootnote in bar\n} in bar.rst' in result - assert 'Auto footnote number \\footnote[1]{\nfootnote in baz\n} in baz.rst' in result + assert ('Same footnote number \\footnote[1]{\\mbox{ }%\nfootnote in bar\n} in bar.rst' + in result) + assert ('Auto footnote number \\footnote[1]{\\mbox{ }%\nfootnote in baz\n} in baz.rst' + in result) assert ('\\phantomsection\\label{index:id26}{\\hyperref[index:the\\string-section' '\\string-with\\string-a\\string-reference\\string-to\\string-authoryear]' '{\\emph{The section with a reference to \\phantomsection\\label{index:id1}' @@ -451,15 +465,15 @@ def test_latex_show_urls_is_no(app, status, warning): assert ('\\phantomsection\\label{index:id27}{\\hyperref[index:the\\string-section' '\\string-with\\string-a\\string-reference\\string-to]{\\emph{The section ' 'with a reference to }}}' in result) - assert 'First footnote: \\footnote[2]{\nFirst\n}' in result - assert 'Second footnote: \\footnote[1]{\nSecond\n}' in result + assert 'First footnote: \\footnote[2]{\\mbox{ }%\nFirst\n}' in result + assert 'Second footnote: \\footnote[1]{\\mbox{ }%\nSecond\n}' in result assert '\\href{http://sphinx-doc.org/}{Sphinx}' in result - assert 'Third footnote: \\footnote[3]{\nThird\n}' in result + assert 'Third footnote: \\footnote[3]{\\mbox{ }%\nThird\n}' in result assert '\\href{http://sphinx-doc.org/~test/}{URL including tilde}' in result assert ('\\item[{\\href{http://sphinx-doc.org/}{URL in term}}] ' '\\leavevmode\nDescription' in result) assert ('\\item[{Footnote in term \\protect\\footnotemark[5]}] ' - '\\leavevmode\\footnotetext[5]{\nFootnote in term\n}\nDescription' in result) + '\\leavevmode\\footnotetext[5]{\\mbox{ }%\nFootnote in term\n}\nDescription' in result) assert ('\\item[{\\href{http://sphinx-doc.org/}{Term in deflist}}] ' '\\leavevmode\nDescription' in result) assert ('\\href{https://github.com/sphinx-doc/sphinx}' From 92934ebe79b681a5ba5ebe79524e85cc175f0362 Mon Sep 17 00:00:00 2001 From: Takeshi KOMIYA Date: Thu, 3 Mar 2016 00:19:48 +0900 Subject: [PATCH 3/3] Add ``\sphinxAtStartFootnote`` macro --- sphinx/texinputs/sphinx.sty | 2 + sphinx/writers/latex.py | 4 +- tests/test_build_latex.py | 89 +++++++++++++++++++------------------ 3 files changed, 49 insertions(+), 46 deletions(-) diff --git a/sphinx/texinputs/sphinx.sty b/sphinx/texinputs/sphinx.sty index a5425e542..549048c98 100644 --- a/sphinx/texinputs/sphinx.sty +++ b/sphinx/texinputs/sphinx.sty @@ -145,6 +145,8 @@ \newcommand{\bfcode}[1]{\code{\bfseries#1}} \newcommand{\email}[1]{\textsf{#1}} +\newcommand*{\sphinxAtStartFootnote}{\mbox{ }} + % Redefine the Verbatim environment to allow border and background colors. % The original environment is still used for verbatims within tables. \let\OriginalVerbatim=\Verbatim diff --git a/sphinx/writers/latex.py b/sphinx/writers/latex.py index d5afa3565..98c2477f4 100644 --- a/sphinx/writers/latex.py +++ b/sphinx/writers/latex.py @@ -905,9 +905,9 @@ class LaTeXTranslator(nodes.NodeVisitor): def visit_collected_footnote(self, node): self.in_footnote += 1 if 'footnotetext' in node: - self.body.append('\\footnotetext[%s]{\\mbox{ }%%' % node['number']) + self.body.append('\\footnotetext[%s]{\sphinxAtStartFootnote%%' % node['number']) else: - self.body.append('\\footnote[%s]{\\mbox{ }%%' % node['number']) + self.body.append('\\footnote[%s]{\sphinxAtStartFootnote%%' % node['number']) def depart_collected_footnote(self, node): self.body.append('}') diff --git a/tests/test_build_latex.py b/tests/test_build_latex.py index d491168ad..ccb16c4a3 100644 --- a/tests/test_build_latex.py +++ b/tests/test_build_latex.py @@ -323,9 +323,9 @@ def test_footnote(app, status, warning): print(result) print(status.getvalue()) print(warning.getvalue()) - assert '\\footnote[1]{\\mbox{ }%\nnumbered\n}' in result - assert '\\footnote[2]{\\mbox{ }%\nauto numbered\n}' in result - assert '\\footnote[3]{\\mbox{ }%\nnamed\n}' in result + assert '\\footnote[1]{\sphinxAtStartFootnote%\nnumbered\n}' in result + assert '\\footnote[2]{\sphinxAtStartFootnote%\nauto numbered\n}' in result + assert '\\footnote[3]{\sphinxAtStartFootnote%\nnamed\n}' in result assert '{\\hyperref[footnote:bar]{\\emph{{[}bar{]}}}}' in result assert '\\bibitem[bar]{bar}{\\phantomsection\\label{footnote:bar} ' in result assert '\\bibitem[bar]{bar}{\\phantomsection\\label{footnote:bar} \ncite' in result @@ -333,8 +333,8 @@ def test_footnote(app, status, warning): assert '\\capstart\\caption{Table caption \\protect\\footnotemark[4]}' in result assert 'name \\protect\\footnotemark[5]' in result assert ('\\end{threeparttable}\n\n' - '\\footnotetext[4]{\\mbox{ }%\nfootnotes in table caption\n}' - '\\footnotetext[5]{\\mbox{ }%\nfootnotes in table\n}' in result) + '\\footnotetext[4]{\sphinxAtStartFootnote%\nfootnotes in table caption\n}' + '\\footnotetext[5]{\sphinxAtStartFootnote%\nfootnotes in table\n}' in result) @with_app(buildername='latex', testroot='footnotes') @@ -351,18 +351,18 @@ def test_reference_in_caption(app, status, warning): assert '\\paragraph{The rubric title with a reference to {[}AuthorYear{]}}' in result assert ('\\chapter{The section with a reference to \\protect\\footnotemark[4]}\n' '\\label{index:the-section-with-a-reference-to}' - '\\footnotetext[4]{\\mbox{ }%\nFootnote in section\n}' in result) + '\\footnotetext[4]{\sphinxAtStartFootnote%\nFootnote in section\n}' in result) assert ('\\caption{This is the figure caption with a footnote to ' '\\protect\\footnotemark[6].}\end{figure}\n' - '\\footnotetext[6]{\\mbox{ }%\nFootnote in caption\n}')in result + '\\footnotetext[6]{\sphinxAtStartFootnote%\nFootnote in caption\n}')in result assert ('\\caption{footnote \\protect\\footnotemark[7] ' 'in caption of normal table}') in result - assert ('\\end{threeparttable}\n\n\\footnotetext[7]{\\mbox{ }%\nFoot note in table\n}' - in result) + assert ('\\end{threeparttable}\n\n\\footnotetext[7]{\sphinxAtStartFootnote%\n' + 'Foot note in table\n}' in result) assert ('\\caption{footnote \\protect\\footnotemark[8] in caption of longtable}' in result) - assert ('\end{longtable}\n\n\\footnotetext[8]{\\mbox{ }%\nFoot note in longtable\n}' - in result) + assert ('\end{longtable}\n\n\\footnotetext[8]{\sphinxAtStartFootnote%\n' + 'Foot note in longtable\n}' in result) @with_app(buildername='latex', testroot='footnotes', @@ -373,10 +373,10 @@ def test_latex_show_urls_is_inline(app, status, warning): print(result) print(status.getvalue()) print(warning.getvalue()) - assert ('Same footnote number \\footnote[1]{\\mbox{ }%\nfootnote in bar\n} in bar.rst' - in result) - assert ('Auto footnote number \\footnote[1]{\\mbox{ }%\nfootnote in baz\n} in baz.rst' - in result) + assert ('Same footnote number \\footnote[1]{\sphinxAtStartFootnote%\n' + 'footnote in bar\n} in bar.rst' in result) + assert ('Auto footnote number \\footnote[1]{\sphinxAtStartFootnote%\n' + 'footnote in baz\n} in baz.rst' in result) assert ('\\phantomsection\\label{index:id26}{\\hyperref[index:the\\string-section' '\\string-with\\string-a\\string-reference\\string-to\\string-authoryear]' '{\\emph{The section with a reference to \\phantomsection\\label{index:id1}' @@ -384,17 +384,17 @@ def test_latex_show_urls_is_inline(app, status, warning): assert ('\\phantomsection\\label{index:id27}{\\hyperref[index:the\\string-section' '\\string-with\\string-a\\string-reference\\string-to]{\\emph{The section ' 'with a reference to }}}' in result) - assert 'First footnote: \\footnote[2]{\\mbox{ }%\nFirst\n}' in result - assert 'Second footnote: \\footnote[1]{\\mbox{ }%\nSecond\n}' in result + assert 'First footnote: \\footnote[2]{\sphinxAtStartFootnote%\nFirst\n}' in result + assert 'Second footnote: \\footnote[1]{\sphinxAtStartFootnote%\nSecond\n}' in result assert '\\href{http://sphinx-doc.org/}{Sphinx} (http://sphinx-doc.org/)' in result - assert 'Third footnote: \\footnote[3]{\\mbox{ }%\nThird\n}' in result + assert 'Third footnote: \\footnote[3]{\sphinxAtStartFootnote%\nThird\n}' in result assert ('\\href{http://sphinx-doc.org/~test/}{URL including tilde} ' '(http://sphinx-doc.org/\\textasciitilde{}test/)' in result) assert ('\\item[{\\href{http://sphinx-doc.org/}{URL in term} (http://sphinx-doc.org/)}] ' '\\leavevmode\nDescription' in result) assert ('\\item[{Footnote in term \\protect\\footnotemark[5]}] ' - '\\leavevmode\\footnotetext[5]{\\mbox{ }%\nFootnote in term\n}\nDescription' - in result) + '\\leavevmode\\footnotetext[5]{\sphinxAtStartFootnote%\n' + 'Footnote in term\n}\nDescription' in result) assert ('\\item[{\\href{http://sphinx-doc.org/}{Term in deflist} ' '(http://sphinx-doc.org/)}] \\leavevmode\nDescription' in result) assert ('\\href{https://github.com/sphinx-doc/sphinx}' @@ -411,10 +411,10 @@ def test_latex_show_urls_is_footnote(app, status, warning): print(result) print(status.getvalue()) print(warning.getvalue()) - assert ('Same footnote number \\footnote[1]{\\mbox{ }%\nfootnote in bar\n} in bar.rst' - in result) - assert ('Auto footnote number \\footnote[2]{\\mbox{ }%\nfootnote in baz\n} in baz.rst' - in result) + assert ('Same footnote number \\footnote[1]{\sphinxAtStartFootnote%\n' + 'footnote in bar\n} in bar.rst' in result) + assert ('Auto footnote number \\footnote[2]{\sphinxAtStartFootnote%\n' + 'footnote in baz\n} in baz.rst' in result) assert ('\\phantomsection\\label{index:id26}{\\hyperref[index:the\\string-section' '\\string-with\\string-a\\string-reference\\string-to\\string-authoryear]' '{\\emph{The section with a reference to \\phantomsection\\label{index:id1}' @@ -422,24 +422,24 @@ def test_latex_show_urls_is_footnote(app, status, warning): assert ('\\phantomsection\\label{index:id27}{\\hyperref[index:the\\string-section' '\\string-with\\string-a\\string-reference\\string-to]{\\emph{The section ' 'with a reference to }}}' in result) - assert 'First footnote: \\footnote[3]{\\mbox{ }%\nFirst\n}' in result - assert 'Second footnote: \\footnote[1]{\\mbox{ }%\nSecond\n}' in result + assert 'First footnote: \\footnote[3]{\sphinxAtStartFootnote%\nFirst\n}' in result + assert 'Second footnote: \\footnote[1]{\sphinxAtStartFootnote%\nSecond\n}' in result assert ('\\href{http://sphinx-doc.org/}{Sphinx}' - '\\footnote[4]{\\mbox{ }%\nhttp://sphinx-doc.org/\n}' in result) - assert 'Third footnote: \\footnote[6]{\\mbox{ }%\nThird\n}' in result + '\\footnote[4]{\sphinxAtStartFootnote%\nhttp://sphinx-doc.org/\n}' in result) + assert 'Third footnote: \\footnote[6]{\sphinxAtStartFootnote%\nThird\n}' in result assert ('\\href{http://sphinx-doc.org/~test/}{URL including tilde}' - '\\footnote[5]{\\mbox{ }%\nhttp://sphinx-doc.org/\\textasciitilde{}test/\n}' - in result) + '\\footnote[5]{\sphinxAtStartFootnote%\n' + 'http://sphinx-doc.org/\\textasciitilde{}test/\n}' in result) assert ('\\item[{\\href{http://sphinx-doc.org/}{URL in term}\\protect\\footnotemark[8]}] ' - '\\leavevmode\\footnotetext[8]{\\mbox{ }%\nhttp://sphinx-doc.org/\n}\nDescription' - in result) + '\\leavevmode\\footnotetext[8]{\sphinxAtStartFootnote%\n' + 'http://sphinx-doc.org/\n}\nDescription' in result) assert ('\\item[{Footnote in term \\protect\\footnotemark[10]}] ' - '\\leavevmode\\footnotetext[10]{\\mbox{ }%\nFootnote in term\n}\nDescription' - in result) + '\\leavevmode\\footnotetext[10]{\sphinxAtStartFootnote%\n' + 'Footnote in term\n}\nDescription' in result) assert ('\\item[{\\href{http://sphinx-doc.org/}{Term in deflist}\\protect' '\\footnotemark[9]}] ' - '\\leavevmode\\footnotetext[9]{\\mbox{ }%\nhttp://sphinx-doc.org/\n}\nDescription' - in result) + '\\leavevmode\\footnotetext[9]{\sphinxAtStartFootnote%\n' + 'http://sphinx-doc.org/\n}\nDescription' in result) assert ('\\href{https://github.com/sphinx-doc/sphinx}' '{https://github.com/sphinx-doc/sphinx}\n' in result) assert ('\\href{mailto:sphinx-dev@googlegroups.com}' @@ -454,10 +454,10 @@ def test_latex_show_urls_is_no(app, status, warning): print(result) print(status.getvalue()) print(warning.getvalue()) - assert ('Same footnote number \\footnote[1]{\\mbox{ }%\nfootnote in bar\n} in bar.rst' - in result) - assert ('Auto footnote number \\footnote[1]{\\mbox{ }%\nfootnote in baz\n} in baz.rst' - in result) + assert ('Same footnote number \\footnote[1]{\sphinxAtStartFootnote%\n' + 'footnote in bar\n} in bar.rst' in result) + assert ('Auto footnote number \\footnote[1]{\sphinxAtStartFootnote%\n' + 'footnote in baz\n} in baz.rst' in result) assert ('\\phantomsection\\label{index:id26}{\\hyperref[index:the\\string-section' '\\string-with\\string-a\\string-reference\\string-to\\string-authoryear]' '{\\emph{The section with a reference to \\phantomsection\\label{index:id1}' @@ -465,15 +465,16 @@ def test_latex_show_urls_is_no(app, status, warning): assert ('\\phantomsection\\label{index:id27}{\\hyperref[index:the\\string-section' '\\string-with\\string-a\\string-reference\\string-to]{\\emph{The section ' 'with a reference to }}}' in result) - assert 'First footnote: \\footnote[2]{\\mbox{ }%\nFirst\n}' in result - assert 'Second footnote: \\footnote[1]{\\mbox{ }%\nSecond\n}' in result + assert 'First footnote: \\footnote[2]{\sphinxAtStartFootnote%\nFirst\n}' in result + assert 'Second footnote: \\footnote[1]{\sphinxAtStartFootnote%\nSecond\n}' in result assert '\\href{http://sphinx-doc.org/}{Sphinx}' in result - assert 'Third footnote: \\footnote[3]{\\mbox{ }%\nThird\n}' in result + assert 'Third footnote: \\footnote[3]{\sphinxAtStartFootnote%\nThird\n}' in result assert '\\href{http://sphinx-doc.org/~test/}{URL including tilde}' in result assert ('\\item[{\\href{http://sphinx-doc.org/}{URL in term}}] ' '\\leavevmode\nDescription' in result) assert ('\\item[{Footnote in term \\protect\\footnotemark[5]}] ' - '\\leavevmode\\footnotetext[5]{\\mbox{ }%\nFootnote in term\n}\nDescription' in result) + '\\leavevmode\\footnotetext[5]{\sphinxAtStartFootnote%\n' + 'Footnote in term\n}\nDescription' in result) assert ('\\item[{\\href{http://sphinx-doc.org/}{Term in deflist}}] ' '\\leavevmode\nDescription' in result) assert ('\\href{https://github.com/sphinx-doc/sphinx}'