3

My question is: is there a way to color text despite that text spilling over into the next page on the output PDF (and with a footnote at the bottom of the first page)?

I am colour-coding an 80-page text document (converting from LaTeX to PDF using pdflatex).

Whether I use the color or xcolor package, most of my document renders exactly as I want. For example,

... of that \textcolor{blue}{I myself can only be judge in my own conscience, as I will answer it}, at the great day, to ...

renders the relevant text in blue. This is true even when that text spills from one page to the next.

However, when there is a footnote at the bottom of the page, the colored text stops prematurely and does not continue on to the next page.

This sounds like the known issue mentioned in the xcolor manual, section 2.15.2 (p. 30); however, the suggested fix (\usepackage[fixpdftex]{xcolor}) "does not support several independent text streams like footnotes", so does not work for my issue.

Does anyone know of a fix which works despite footnotes? Or a different, possibly simpler, color package that avoids this? (The issue occurs for me both with color and xcolor.)

Many thanks in advance.

  • actually it's really hard to do this in tex, I assume you are using pdftex? If you make some simplifying assumptions such as "footnotes never split over a page" or "footnotes are not coloured" or ...then it's usually possible to do something – David Carlisle Jun 5 '18 at 11:23
  • Thank you, @DavidCarlisle. Yes, I am using pdftex. You are right -- I can now see that the issue was caused by the fact that the footnote too was coloured. Mandating that footnotes not be coloured is a bit of a compromise, but not too onerous. Thanks again for your help. – Srdgh Jun 5 '18 at 12:23
3

You can try the pdfcolfoot. It implements an independant color stack for footnotes:

\documentclass{article}
\usepackage{xcolor}
\usepackage{lipsum}
\usepackage{pdfcolfoot}

\begin{document}
\lipsum[1-4]\footnote{\color{red}\lipsum[1-2]}
\textcolor{blue}{\lipsum*[1]}

\end{document}

Output with the package

enter image description here

Output without it

enter image description here

| improve this answer | |
  • Thank you. This is exactly what I was hoping for. As you say, it works perfectly. (To anyone else reading this: it is part of the oberdiek collection of packages, so bundled with TexLive and MikTex.) – Srdgh Jun 5 '18 at 20:49
  • @ulrikefischer Is there a similar package for hyperlinks? – Lupino Feb 25 at 9:29

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.