Le 14/05/2024 à 23:04, Nguyen Thanh Nhut a écrit :
> Thanks, JF B.
> *The \renewcommand\sphinxthefootnotemark[2]{#1} really helps.🙏*
>
> Here is the code that produced the issue:
> -------------------
> # Container With Most Water
> % Medium
> ## [Problem statement](
>
https://leetcode.com/problems/container-with-most-water/)
>
> You are given an integer array `height` of length `n`. There are `n`
> vertical lines drawn such that the two endpoints of the `i-th` line are
> `(i, 0)` and `(i, height[i])`.
>
> -------------------------
> After running "sphinx -T -b latex", I ran "latexmk -r latexmkrc -pdf -f
> -dvi- -ps- " only once to build the pdf.
>
> (I do not know how to build *many runs *this way. It seems I have to delete
> the pdf folder to rebuild for many runs.)
latexmk is fine, it is supposed to run enough many times the pdflatex binary
(or lualatex, xelatex, uplatex for Japanese documents)
>
> I might prepare a small example to open a bug.
Ok, I could reproduce. I realized you must have been using
``latex_show_urls = 'footnote'``
I used an index.rst with
```
.. toctree::
index1
index2
```
and index1.rst being
```
CHAPITRE
========
Test [1]_
---------
.. [1] note de bas de page
```
whereas index2.md is the contents in markdown you provided.
I also added ``extensions = ['myst_parser']`` to conf.py
I see now the problem on Page 3 with the url as footnote.
Running additional `pdflatex` on the tex file does not change things.
Ok I investigated a bit but the Sphinx LaTeX code for footnotes
was written quite a few years back, it does look as if there is
a bug (inside file sphinxpackagefootnote.sty in the definition
of macro \sphinxfootref, it looks as if the code \sphinx@xdef@thefnmark{#1}
is not executed at the correct time, if I move it to after the
\refstepcounter that is two lines below, so to be executed
only when \@makefnmark is, it seems problem goes away in your MWE).
I will need to wait for having some free time to understand again what
all these complex LaTeX code are supposed to do;
as it stands it does look something has always been wrong there...
so if you have time to make the issue report, that would be much
appreciated; if not I will do it myself once I get the some time
to investigate this problem. There seems to be some commented
out code in the file, which located the \refstepcounter elsewhere
but was abandoned due to
https://github.com/sphinx-doc/sphinx/pull/10191#issuecomment-1038807448 which was in February 2022, I would have said more like
5 years ago, but I must have aged a lot since 2022 ;-)
Best,
Jean-François B.