当使用带有 \pgfpagesuselayout 的 pgfpage 时,xelatex 无法与 tikz 正常工作!

当使用带有 \pgfpagesuselayout 的 pgfpage 时,xelatex 无法与 tikz 正常工作!

我正在尝试使用 tikz 制作渐变背景。它与 配合使用效果很好pdflatex,但当我使用xelatex它时,它无法正常工作。

我注意到问题出在\pgfpagesuselayout命令上。我需要它是因为我想制作一张海报,它的尺寸应该比原始尺寸大很多,比如 a4paper 或类似的东西。在下面的例子中,我使用了 a4paper 只是为了展示问题:

\documentclass{article}

\usepackage[cmyk]{xcolor}%
\usepackage{tikz}%
\usepackage{pgf}%
\usetikzlibrary{fadings}%

\usepackage{pgfpages}%
\pgfpagesuselayout{resize to}[a4paper]

\begin{document}

\begin{tikzpicture}[remember picture,overlay]
    \shade [top color=yellow,bottom color=red!50] (current page.north west) rectangle (current page.south east);%
\end{tikzpicture}

\centerline{\Huge Hi Parsi\LaTeX{}}
\end{document}

产生的正确结果pdflatex在此处输入图片描述

奇怪的结果是xelatex在此处输入图片描述

我不知道这是 xelatex 还是 tikz 的 xelatex 驱动程序的错误?!

PS 我使用 TeXLive2015。使用 TeXLive2012 测试此代码的其他人没有遇到这样的问题!

答案1

xelatex 的输出与 pdflatex 类似,下面是您的特例。不要指望它适用于其他情况。

%
% xelatex
%
\documentclass{article}
\usepackage[cmyk]{xcolor}
%
\def\pdftexversion{140}
\def\pgfsysdriver{pgfsys-dvipdfm.def}
%
\usepackage{tikz}
\usepackage{pgf}
%
\makeatletter
\def\pgfsys@papersize#1#2{%
  \pdfpageheight#2\relax%
  \pdfpagewidth#1\relax}
\makeatother
%
\usetikzlibrary{fadings}

\usepackage{pgfpages}
\pgfpagesuselayout{resize to}[a4paper]

\begin{document}

\begin{tikzpicture}[remember picture,overlay]
    \shade [top color=yellow,bottom color=red!50] (current page.north west) rectangle (current page.south east);%
\end{tikzpicture}

\centerline{\Huge Hi Parsi\LaTeX{}}
\end{document}

相关内容