0

If I run pdflatex twice on the file below the entire background is colored, if I run xelatex twice only 1/4 of the page is colored. Anyone can explain why?

\documentclass{report}
\usepackage{xcolor}
\usepackage{background}
\backgroundsetup{scale=1,
                 angle=0,
                 opacity=1,
                 contents={\begin{tikzpicture}[remember picture,overlay]
                 \path [bottom color = red,middle color = red!30, top color = blue] (current page.south west) rectangle (current page.north east);
                          \end{tikzpicture}
                          }
                }

\begin{document}
 This is a test page!
\end{document}
  • background puts its content in a node in a tikzpicture. So you are actually nesting two tikzpictures, both using remember picture. In general this is simply problematic. See e.g. tex.stackexchange.com/a/66037/2388. I ran in various occasions into problems when doing this and so I prefer to use eso-pic if I want to place tikzpictures in the background. – Ulrike Fischer Sep 16 '16 at 7:15
  • @Ulrike Fisher, I do understand the problem is a nesting of pictures, what I don't understand is the different behavior of the same package with pdflatex and xelatex. – Paulo Ney Sep 16 '16 at 17:13
  • 1
    On the system layer they use different methods to set page nodes, execute graphics code etc, it is always possible that something works with pdflatex and not with xelatex. – Ulrike Fischer Sep 16 '16 at 17:17

Your Answer

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

Browse other questions tagged or ask your own question.