1

The command \pagecolor{white} produces a solid white background using pdflatex and lualatex, but a transparent background with xelatex.

A minimal example:

\documentclass{article}

\usepackage[svgnames]{xcolor}
\usepackage{lipsum}

\begin{document}
    \lipsum[1-3]
    \newpage\pagecolor{white}
    \lipsum[1-3]
\end{document}

With both pdflatex and lualatex, the first page has a transparent background and the second page is solid white, but with xelatex both pages have transparent background. When using other colors, all seem to work as expected (including xelatex).

If this is in fact a bug, where to report it? Thanks.

1

1 Answer 1

4

With xetex the background color is created with a \special. In your case this is inserted in the output:

 \special{background gray 1}

Normally this creates a second content stream with a rectangle filled with the color, but if the value is 1 (or 1,1,1 if rgb is used), xetex (xdvipdfmx) seems to optimize this away. It is probably not a bug but intended, but if you want to report it anyway, write to the dvipdfmx mailing list: https://tug.org/mailman/listinfo/dvipdfmx

You can fool xetex by using a "nearlywhite" color:

\documentclass{article}

\usepackage{xcolor}
\usepackage{lipsum}
%\definecolor{nearlywhite}{rgb}{0.999999,0.999999,0.999999}
\definecolor{nearlywhite}{gray}{0.999999}
\begin{document}
    a
    \newpage\pagecolor{nearlywhite}
    b
\end{document}

xetex will not drop this but round up the number to 1, so you will actually get real white.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .