# problem of colors with \AtBeginShipoutBox command

When I compile this code

\documentclass{article}
\usepackage{blindtext}

\usepackage{color}
\usepackage{picture}
\usepackage{atbegshi}
\AtBeginShipoutInit

\AtBeginShipout{%
\AtBeginShipoutUpperLeft{%
\put(0,-\paperheight){{\color{red}\box\AtBeginShipoutBox}}%
}%
}

\begin{document}
\blinddocument
\end{document}


I get (page 2)

Question: why labels are in black?

• Interesting how color is a little more forgiving than xcolor. Loading the latter makes \color{red} not influence the \box\AtBeginShipoutBox. Dec 31 '15 at 18:40
• @Werner yes, this may be will the next question I find that with xcolor the color change starting from page 2! Jan 1 '16 at 8:43

In order to obtain the appropriate alignment in lists (specifically for itemize and enumerate), LaTeX boxes the item labels. And once things are boxed, it's fixed and your \color command doesn't reach it.

Here's a minimal example replicating the behaviour using the temporary box \@tempboxa:

\documentclass{article}

\usepackage{color,picture,atbegshi}

\AtBeginShipout{%
\AtBeginShipoutUpperLeft{%
\put(0,-\paperheight){{\color{red}\box\AtBeginShipoutBox}}%
}%
}

\begin{document}
\makeatletter
% Since this is boxed, it will remain black
\sbox\@tempboxa{this is some text}\usebox\@tempboxa
\makeatother

\begin{itemize}
\item First
\item Second
\item Last
\end{itemize}

\end{document}


If you are using pdflatex you can set the color using a \pdfliteral which affects everything, because the color is rendered in the viewer and TeX doesn't know about it.

\documentclass{article}
\usepackage{blindtext}
\usepackage{picture}
\usepackage{atbegshi}
\AtBeginShipoutInit

\AtBeginShipout{%
\AtBeginShipoutUpperLeft{%
\put(0,-\paperheight){%
% Color code:        R G B
\pdfliteral direct{q 1 0 0 rg}%
\box\AtBeginShipoutBox%
\pdfliteral direct{Q}%
}%
}%
}

\begin{document}
\blinddocument
\end{document}