Closed pbreheny closed 3 months ago
Thanks for the report! I can reproduce.
We are probably not handling something correctly when detecting footnote to move when r-katex
is used.
I think our regex in https://github.com/rstudio/bookdown/blob/f244cf12bf2c2d7106ac6322b2b2a5796d4ef0c8/R/html.R#L1027-L1037
does not take into account the SVG content resulting from r-katex or something else 🤔
I think the issue that with KaTeX processing we get
<a href=\"#fnref2\" class=\"footnote-back\">↩︎</a></p></li>
where without we get
<a href=\"#fnref2\" class=\"footnote-back\">↩︎</a></p></li>
Not the difference between single unicode chars and several HTML sequence characters.
So <a href="#fnref\\1"[^>]*?>\\X</a></p></li>
is not adapated here. Maybe using \\X+
is enough, or we need something more tailored to what we want to match.
@yihui hope it helps do the right thing. Thanks!
@cderv Thanks for the investigation!
@pbreheny It should be fixed now, but I don't have time to verify it. Please let us know if the problem persists. Thanks! You can install the development version via
remotes::install_github('rstudio/bookdown')
Works for me! :tada:
I recently switched my book over to using Katex as the math engine by adding the following to
_output.yml
:The math looks wonderful, everything renders correctly, but it screws up the footnotes -- all footnotes now appear on the last page, as in this issue: #793.
You can reproduce this in any book (so far as I can tell), but here's an explicit example:
then add
math_method: r-katex
as in the above.