12

I am typesetting a book with long footnotes, and some phrases or words in footnotes are colored. I ran into a problem for which I have an MWE below.

\documentclass{article}
\usepackage{lipsum}
\usepackage{xcolor}
\usepackage[colorlinks=true]{hyperref}
\begin{document}
\lipsum[1-2]
\lipsum[3]\footnote{\textcolor{red}{\lipsum[1-5]}}
\lipsum[4-20]
\end{document}

Whats wrong here? The textcolor work fine for the footnote text on the first page, but the continued footnote on the second page is not affected?

I am using XeTeX, Version 3.1415926-2.4-0.9998 (TeX Live 2012/W32TeX).

Edited at 10:20 PM on Friday, 9 May, 2014 (GMT):

Thanks for the responses, using bigfoot helped. One minor thing which I think does not need a new question. Redefining \thefootnote seems to have no effect with bigfoot. How to make the following work?

\documentclass{article}
\usepackage{lipsum}
\usepackage{xcolor}
\usepackage{bigfoot}
% The line below has no effect
\renewcommand{\thefootnote}{\textcolor{red}{\fnsymbol{footnote}}}
\usepackage[colorlinks=true]{hyperref}
\begin{document}
\lipsum[1-2]
\lipsum[3]\footnote{\textcolor{red}{\lipsum[1-5]}}
\lipsum[4-20]
\end{document}
  • 2
    Not an explanation but adding \usepackage{bigfoot} might/should help – clemens May 9 '14 at 13:13
  • the problem is that "original" tex had no control over colour; there were colour packages before the present color/``xcolor` packages, but none of them aspired to offer a general solution. the latex packages deal with most things, but not footnotes splitting under the direct influence of something other than the page maker. – wasteofspace May 9 '14 at 13:29
12

pdfTeX

This is a typical case, where multiple colorstacks are needed, one for the main text and one for footnotes. This is provided by pdfTeX and package pdfcolfoot adds support for an additional color stack for foonotes (basic footnotes of LaTeX):

\documentclass{article}
\usepackage{lipsum}
\usepackage{xcolor}
\usepackage[colorlinks=true]{hyperref}
\usepackage{pdfcolfoot}
\begin{document}
\lipsum[1-2]
\lipsum[3]\footnote{\textcolor{red}{\lipsum[1-5]}}
\lipsum[4-20]
\end{document}

LuaTeX

LuaTeX has a new concept: attributes. Package luacolor implements color via an attribute:

\documentclass{article}
\usepackage{lipsum}
\usepackage{xcolor}
\usepackage{luacolor}
\usepackage[colorlinks=true]{hyperref}
\begin{document}
\lipsum[1-2]
\lipsum[3]\footnote{\textcolor{red}{\lipsum[1-5]}}
\lipsum[4-20]
\end{document}

Package bigfoot

It's a great package with many features, from its documentation:

You can use color in footnotes. If a footnote gets broken across pages, the color at the point of the break will get resumed on the next page. Actually, the whole color stack will get reinstated.

However, if I remember correctly, there might be problems with hyperrefs footnote linking.

Others

Out of luck.

  • As @cgneider mentioned, one of bigfoot's improvements over regular footnoting is that it is aware of the colour stack and breaks/reinstates it when footnotes are broken across pages. Thus, you could use it for XeTeX-produced documents (or, of course, pdfTeX and LuaTeX ones). (Good to learn of pdfcolfoot and luacolor, though!) – jon May 9 '14 at 14:35
  • @jon: However it does not work well with hyperref. But I can add it to the list. – Heiko Oberdiek May 9 '14 at 14:40
  • @jon: Try it. I do not remember the details. – Heiko Oberdiek May 9 '14 at 14:46
  • The footnotemark --> footnote link is disabled under all engines. (Relying on your example files, but modified for use with bigfoot and without pdfcolfoot and with/without luacolor.) I don't have time to perform more extensive tests right now, unfortunately. – jon May 9 '14 at 14:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.