2

I'm trying to make a fading background using tikz. It works great with pdflatex, but when I use xelatex it doesn't work properly.

As I noticed the problem is because of \pgfpagesuselayout command. I need it because I want to make a poster and its size should more and more larger than the original size like a4paper or something like that. In below example I've used a4paper just for showing the problem:

\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}

the correct result that is produced with pdflatex: enter image description here

and the odd result with ‍‍‍‍‍‍xelatex: enter image description here

I don't know it is a bug for xelatex or xelatex driver of tikz?!

P.S. I use TeXLive2015. Someone else that tested this code with TeXLive2012 had not such a problem!

  • Welcome to TeX.SX! – egreg Aug 24 '15 at 9:36
  • 1
    I can confirm this is a regression from TL 2012; with TL 2013 the colored box is shifted down, with TL 2014 and 2015 the result is as you show. With TL 2012 I get the warning Your graphic driver pgfsys-xetex.def does not support fadings. that disappears with later versions. – egreg Aug 24 '15 at 9:55
  • What should I do? Who can help to fix it? – javadr Aug 24 '15 at 10:47
  • If it is of any help, I find that this works correctly with LuaLaTeX. – sgmoye Aug 24 '15 at 12:27
  • thanks for the test with LuaLaTeX, but because of some packages,e.g. bidi, I just need the xelatex. – javadr Aug 24 '15 at 13:09
1

A similar output as that of pdflatex is obtained by xelatex with the following for your special example. Don't expect that it is applicable to other cases.

%
% 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}
  • I think pgfsys-dvipdfmx.def, which is called by pgfsys-xetex.def, should be updated by someone who knows details on tikz, xetex, xdvipdfmx,... – Akira Kakuto Jan 10 '17 at 3:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.