pgf-tikz / pgf

A Portable Graphic Format for TeX
https://pgf-tikz.github.io/
1.15k stars 108 forks source link

pgfpages layout "two screens with optional second" with "second top" do not show shading picture correctly #1333

Open lrtfm opened 6 months ago

lrtfm commented 6 months ago

Brief outline of the bug

In the following MWE, a shading colour is created firstly, and then used in pgfpicture to show it in the top of the second logical page. When using option "second right" for the layout "two screens with optional second", everything is OK. However, changing "second right" to "second top" the shading colour also disappear. How to make the option "second top" show the shading picture correctly?

The result pdf with option:"second right"

The result pdf with option:"second top"

Minimal working example (MWE)

\documentclass[a5paper, landscape]{article}
\usepackage{pgf}
\usepackage{pgfpages}

% WITH OPTION "second right", everything is OK.
\pgfpagesuselayout{two screens with optional second}[second top]

\pgfdeclareverticalshading{headfade}{\paperwidth}%
{%
  rgb(0cm)=(0.9, 0.9, 0.9);
  rgb(3cm)=(0.8, 0.8, 0.9)%
}

\begin{document}

{\Huge Text for main page.}
\clearpage

\pgfpagescurrentpagewillbelogicalpage{2}
{\Huge Text that goes to second page.}

\pgfrememberpicturepositiononpagetrue
\begin{pgfpicture}
  \pgfusepath{use as bounding box}
  \pgftransformshift{\pgfpointanchor{current page}{north west}}
  \pgftext[top, left]{\pgfuseshading{headfade}}
\end{pgfpicture}

\end{document}
muzimuzhi commented 6 months ago

Works well with pdflatex and lualatex. Problem only reproduces with xelatex. So may be similar to #960.