Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I'm seeing odd behavior when trying to use a watermark with tikz and eso-pic.

Here is my example document:

\documentclass[10pt]{article}
\usepackage{eso-pic}
\usepackage{tikz}

\newcommand{\addwatermark}[1]
{
    \makeatletter
    \newlength{\wmoffset}
    \setlength{\wmoffset}{4cm}
    \def\wmscale{5}
    \def\wmopacity{0.05}
    \AddToShipoutPicture
    {

        \begin{tikzpicture}[remember picture, overlay]
          \node [shift={(\wmoffset,-\wmoffset)}]  at (current page.north west)
          {
              \begin{tikzpicture}
                \node [rotate=45,scale=\wmscale,text opacity=\wmopacity]
                {\textrm{\normalsize{\textbf{#1}}}};
              \end{tikzpicture}
          };
        \end{tikzpicture}
        \begin{tikzpicture}[remember picture, overlay]
          \node [shift={(-\wmoffset,\wmoffset)}]  at (current page.south east)
          {
              \begin{tikzpicture}
                \node [rotate=45,scale=\wmscale,text opacity=\wmopacity]
                {\textrm{\normalsize{\textbf{#1}}}};
              \end{tikzpicture}
          };
        \end{tikzpicture}
    }
    \makeatother
}

\addwatermark{DRAFT}

\begin{document}

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris elit est,
laoreet ac pellentesque eu, fringilla tempor lectus. Cras ultricies sem sed enim
scelerisque non molestie augue congue. Nullam aliquam dignissim posuere. Nunc
dapibus arcu eu ligula scelerisque faucibus malesuada turpis viverra. Praesent
sed dui mauris, vel tincidunt est. Ut vitae purus mauris. Aliquam commodo nunc
id ante venenatis venenatis. Sed gravida vehicula ante, in volutpat tortor
molestie at. Sed eu felis ac tortor auctor vulputate. Nullam nulla quam, varius
malesuada ultricies tristique, porttitor eget tellus. Praesent at urna
risus. Suspendisse potenti. Nulla facilisi. In nisi ipsum, imperdiet sit amet
cursus non, iaculis quis nunc. Duis nunc ligula, feugiat quis auctor sit amet,
rutrum in dolor. Nullam quis justo leo.

\newpage

In euismod tristique arcu, nec suscipit arcu aliquet eget. Cras vitae risus a
turpis gravida placerat suscipit nec mi. Donec tincidunt iaculis magna, sed
bibendum tellus ultricies vel. Donec posuere dignissim tempus. Maecenas felis
eros, interdum at imperdiet ut, dapibus eget mi. Nunc ullamcorper augue et lorem
ultrices ut laoreet dolor imperdiet. Suspendisse imperdiet lectus quis ipsum
fringilla suscipit. Nunc luctus ullamcorper ligula eu rhoncus. Aliquam lectus
leo, interdum non faucibus nec, imperdiet sed turpis. Duis vehicula sollicitudin
accumsan. Nulla pulvinar vulputate sodales. Nullam interdum sodales mi, vel
pulvinar mauris molestie eu. Vivamus sed eros sapien. Curabitur dapibus dictum
elit eget convallis. Maecenas eleifend sagittis augue.

\newpage

In molestie eros eu purus auctor ut aliquet nunc lacinia. Lorem ipsum dolor sit
amet, consectetur adipiscing elit. Sed consectetur, tortor ac consectetur
lobortis, sem nulla malesuada libero, eget imperdiet mi lorem vitae quam. Nam
viverra porta tristique. Donec ut enim at est eleifend luctus vitae id
magna. Morbi auctor dapibus odio, quis bibendum mauris ultricies sit
amet. Suspendisse eleifend diam congue nunc porttitor laoreet. Lorem ipsum dolor
sit amet, consectetur adipiscing elit. Quisque eu sagittis dolor.

\newpage
Ut velit magna, mattis id sodales vel, eleifend quis turpis. Nulla volutpat
pretium sapien sit amet consequat. Etiam gravida, risus sollicitudin egestas
semper, lorem nunc facilisis sem, ut tristique purus nunc ut sapien. Quisque
quis metus ac risus aliquam aliquet vulputate ut nisi. Aliquam sit amet ipsum
neque. Vivamus sodales placerat enim imperdiet malesuada. Donec et lectus vitae
mi posuere fringilla nec a metus. Etiam hendrerit, lacus sed interdum sagittis,
neque turpis fermentum erat, a tempus sapien velit vel velit. Morbi euismod
tempor dapibus. Integer ullamcorper pulvinar tincidunt. In hac habitasse platea
dictumst. Integer dapibus sollicitudin massa a porttitor. Curabitur blandit mi
tellus. Nulla scelerisque nunc aliquam risus adipiscing ac tristique orci
feugiat. Ut consequat elementum mauris nec hendrerit. 

\end{document}

This yielded the expected result (a faint watermark at the top left and bottom right of each page) prior to upgrading from MacTex 2010 to 2011. However, after upgrading, I'm seeing the watermarks on the first page are appearing opaque, with watermarks on pages 2-N appearing as they should in the PDF output.

Does anyone know anything that could have caused this? Perhaps some recent updates to eso-pic or tikz that would have changed this behavior? Any workarounds? I'd be okay with leaving the watermark off of the first page entirely if there were an easy way to do that, but I'd prefer to fix the transparency problem if possible.

share|improve this question
1  
Welcome to TeX.SE. It is always best to provide a full MWE and not just code snippets, that illustrates the problem including the \documentclass so that those trying to help don't have to recreate it. –  Peter Grill Oct 20 '11 at 18:32
    
@PeterGrill: OK, I've updated my question with a complete document that exhibits the problem on my system. –  tonycpsu Oct 20 '11 at 19:11
2  
With XeTeX and TeXLive2010 or TeXLive2011 I see a black mark on the first page and transparent ones on the other. However, with TeXLive2010 and TeXLive2011 with pdflatex I don't see a difference, but the top mark on the first page appear not as transparent, but still not even close to black as with XeTeX. So, seems to be a XeTeX specific problem. –  Peter Grill Oct 20 '11 at 19:20
1  
@tonycpsu: You can use the advantages of fontspec with lualatex. –  Marco Daniel Oct 21 '11 at 13:14
1  
First, I can confirm this in TeXLive 2011 on Linux. Second, it does seem to work fine with luatex, so you can still use your system fonts using fontspec. Third, I am not sure if it is related, but when viewing the xelatex compiled pdf in zathura, every time the first page is displayed, I get ` Error: ExtGState 'pgf@ca0.05' is unknown` message on my terminal. It does not happen when viewing pdf created with pdflatex or lualatex. Not sure if it is related, but if it is, it may help tracing the problem. –  Jan Hlavacek Oct 23 '11 at 2:04
show 7 more comments

1 Answer

This looks like a bug in tikz: The content stream of the first pages references the two Graphic States pgf@ca0.05 and pgf@CA0.05 (these specify the transparency), but these are not included in the resources of the first page (but on all other pages), so they are unknown there. Tested with TL2011.

You should report the bug here.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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