4

Question

My MWE document below has three pages, numbered with 1, 2 and 3, respectively. It contains a long tcolorbox environment, which spans all three pages. The box contains a sentence with a footnote. The sentence ends up at page 1. I want to display the corresponding footnote on page 1. How to do that?

Nearly the same question was asked a few years ago, but unfortunately it seems to be misunderstood by people who tried to answer it. For that reason, I am asking it again.

Failed attempts

  1. Just use \footnote{ ... }. This approach fails, because the footnote is printed in the middle of page 3, within the box, and it also uses a different counter for numbering. To test that, comment out lines 9-10 in the MWE.
  2. Slightly improved approach taken from this answer: use the footnotes package. The footnote gets printed at the end of page 3.
  3. Forget about tcolorbox and use less invasive frame drawing method that I came up with. This avoids the problem with footnotes, but adds a number of other ones, which tcolorbox handled (e.g., I do not know how to insert exactly the amount of \vspace I need, my question remains unanswered).

Picture

The picture from the question asked a few years ago seems to be fitting. Footnotemark is the place where the sentence annotated by footnote is located. In turn, my footnotetext is the desired location of the footnote. picture borrowed from the previous question

Code

\documentclass[10pt,a4paper]{article}
\usepackage[english]{babel}
\usepackage[T1]{fontenc}
\usepackage[most]{tcolorbox}
\usepackage{lipsum}

\usepackage{tcolorbox}
\usepackage{footnote}
\BeforeBeginEnvironment{tcolorbox}{\savenotes}
\AfterEndEnvironment{tcolorbox}{\spewnotes}
\begin{document}
    \begin{tcolorbox}[breakable]
        \lipsum[1]
        
        {\color{red}The text ends up on page 1, but the footnote does not\footnote{it is incorrectly placed on page 3}.}
        
        \lipsum[2-13]
    \end{tcolorbox}
\end{document}
1

0

You must log in to answer this question.

Browse other questions tagged .