# Multi-page footnote disrupts main text color, and pdfcolfoot not helpful

Original situation: I have several documents with text color changging in various frequency (few lines to many pages for each color). There are numerous footnotes in between, that should be colored identical to from where they are referenced. Recolor text, such that floats and footnotes are affected correctly points to a way how to accomplish this.

This does work in principle, unless a footnote is wrapped to the next page: then, both the color of the footnote and the main text get lost on the next page.

Color and pagebreaks with footnotes points to the pdfcolfoot package, that should fix this issue (via an extra pdftex color register for footnotes). But even if I do use it, the next page after the end of the footnote loses its colors.

The (inevitably Kantian) MWE:

\documentclass[a6paper,12pt]{article}
\usepackage{kantlipsum}
\usepackage{xcolor}
%\usepackage{pdfcolfoot} % Un-commented for the figure below.

\begin{document}
\color{blue}
\kant[3-4]
foo\footnote{\color{red}\kant[9-11]}
\kant[4-5]
\color{.}
\kant[5]
foo\footnote{\color{red}\kant[9-11]}
\kant[4-6]
\end{document}


Expected result: the text on page 3 (and 5) should be in all blue. Text color nowhere got reset. It's only when I add a \color{.} (which should be a no-op), the engine remembers that text should be actually colored.

Obviously, the promise of pdfcolfoot is not satisfied, so this might also be a bug over there.

My low-level question: Is there some (proper or hacky) way to convince pdftex to start every page with active text coloration, irrespective on how many footnotes ended on the previous page?

A semantic solution would be some code or package that automagically synchronises footnotes with the font formatting state of the main text.

• it's pretty tricky to get this right in tex, as the low level support just isn't there, luatex has more tools, or failing that you can get the right output if you are prepared to do some hand tuning of the markup, stopping and re-starting the footnote colour at the split point.. – David Carlisle Jan 13 '19 at 0:08
• this is issue 1 raised on latex (by Frank, who's the leader of the latex project) the discussion there suggests that you might try the bigfoot package github.com/latex3/latex2e/issues/1 – David Carlisle Jan 13 '19 at 22:01