I want to define an environment redout
, that causes all text defined inside to be typeset in a changed color. However, I can't find a way to consistently recolor floats.
- If recoloring is performed with just
\color{red}
, it doesn't affect floats and footnotes, and depending on the document class, may not affect headings either. - When adding
\let\default@color\current@color
, it affects floats and footnotes wrongly based on when they are typeset, rather than when they are defined.
I can imagine making this work by redefining all footnote/float commands, but that is error-prone. Is there any more elegant version to achieve coloring based on the position in the source-code?
\documentclass{article} \usepackage[paperwidth=8cm,paperheight=3cm,scale=0.9]{geometry} \usepackage{xcolor} \begin{document} This text is black. \footnote{This footnote should be black, but is red.} \begingroup \color{red} \makeatletter \let\default@color\current@color % required to affect footnotes. This text is red. \footnote{This footnote is red, as intended.} \clearpage This text is still red. \footnote{This footnote should be red, but being \emph{typeset} after the \texttt{\string\endgroup}, it isn't.} \endgroup This text is correctly black again. \end{document}