Conflict between hyperref and footmisc in RMarkdown

I'm running into issues where including a \pagebreak in RMarkdown causes footnotes to be moved to be "glued" to the text, instead of to the bottom of the page.

A solution to this is to use footmisc to push the footnotes back down, but doing so sort of breaks the footnote link so that it links to the TOC (i.e., doesn't link at all), instead of to the footnote text.

This is a know LaTeX problem and peoples' solutions are to load hyperref after footmisc to avoid the conflict: https://tex.stackexchange.com/questions/169102/set-latex-footnote-hanging-without-using-footmisc-package and https://tex.stackexchange.com/questions/71664/why-are-all-of-my-footnotes-hyperlinked-to-the-titlepage

However, looks like maybe hyperref is loaded by default already by... bookdown? pandoc? (my knowledge of the internals stops here!) so I get conflicts when I try to load hyperref afterwards.

If I wanted to disable the footnote link, I'd have to do so in the initial load of hyperref, so I can't even set the option to disable them overall: https://tex.stackexchange.com/questions/300764/lyx-disable-footnote-links

I guess my question is... how can I ensure that the footnotes are at the bottom of the page and that they don't link to the TOC? Ideally would link to the actual footnote, but it's okay-ish if the links just don't work at all. Is there a way to load footmisc before hyperref (since it's loaded behind the scenes)?

Here's some concrete reprexes of what I'm looking at:

No pagebreak, no issues with footnotes

output: https://www.docdroid.net/CwXSBfX/1.pdf

---
output: bookdown::pdf_document2
---

# Section 1

Some text^[Some footnote]

# Section 2

Pagebreak causes footnotes to be glued to text instead of bottom of page

output: https://www.docdroid.net/QlUSVKZ/2.pdf

---
output: bookdown::pdf_document2
---

\pagebreak

# Section 1

Some text^[Some footnote]

\pagebreak

# Section 2

footmisc pushes footnotes down, but breaks link

output: https://www.docdroid.net/9X4EAV3/3.pdf

---
output: bookdown::pdf_document2
header-includes:
  - \usepackage[bottom]{footmisc}
---

\pagebreak

# Section 1

Some text^[Some footnote]

\pagebreak

# Section 2

Attempts to disable footnotes


---
output: bookdown::pdf_document2
header-includes:
  - \usepackage{hyperfootnotes=false}{hyperref}
  - \usepackage[bottom]{footmisc}
---

\pagebreak

# Section 1

Some text^[Some footnote]

\pagebreak

# Section 2

produces the error:

! LaTeX Error: Option clash for package hyperref.

Error: Failed to compile test.tex. See https://yihui.name/tinytex/r/#debugging for debugging tips. See test.log for more info.
Execution halted

Maybe I just needed to learn the difference between \pagebreak and \newpage :flushed: vertical alignment - \pagebreak vs \newpage - TeX - LaTeX Stack Exchange

This works just fine, without gluing the footnote to the bottom of the text -- so I didn't really need to go down the whole footmisc hyperref rabbit hole :roll_eyes: :rabbit:

---
output: bookdown::pdf_document2
---

\newpage

# Section 1

Some text^[Some footnote]

\newpage

# Section 2

Output: https://www.docdroid.net/KhsW7OA/newpage.pdf

Thanks for being my rubber :duck: y'all!

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.