Generaldraftwatermark not on top of pictures

LaTeX specific issues not fitting into one of the other forums of this category.
User avatar
Cham
Posts: 937
Joined: Sat Apr 02, 2011 4:06 pm

draftwatermark not on top of pictures

Post by Cham »

I'm experiencing a little problem with a diagonal warning on each page of a document : the mark appears behind the pictures (and a few other elements, like gray rectangles around equations). Most of my pictures have a white rectangle included in them, to get a proper size in the document. I would like to have the warning to be shown on top of everything, with a transparency effect (so we could still see the text, pictures and elements behind it).

The draftwatermark package documentation doesn't seem to give an option for this. Any suggestion about how to set the diagonal warning to be visible on top ?

Here's a MWE to work with (there is no picture attached to this code, though) :

Code: Select all

\documentclass[10pt,letterpaper]{revtex4}
\usepackage{lmodern}
\usepackage{amsmath}
\usepackage{graphicx}
\usepackage{xcolor}
\usepackage{here}
\usepackage{blindtext}

\usepackage[]{draftwatermark}
\SetWatermarkAngle{45}
\SetWatermarkScale{1.75}
\SetWatermarkColor{red!15}
\SetWatermarkFontSize{42pt}
\SetWatermarkText{\bfseries\sffamily TOP SECRET !}

\begin{document}

\blindtext

	\begin{equation}
		y(x) = a + b x + c x^2.
	\end{equation}

	\begin{figure}[H]
		\centering
		\includegraphics[height=6cm]{figure.pdf}
		\caption{Some useless text.}
	\end{figure}

\Blindtext

\end{document}

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

Cham
Posts: 937
Joined: Sat Apr 02, 2011 4:06 pm

draftwatermark not on top of pictures

Post by Cham »

Hmm, the package xwatermark may do the trick :

Code: Select all

\usepackage[printwatermark]{xwatermark} % Option : firstpage
\newwatermark*[allpages,color=red!15,angle=45,scale=2.7,xpos=0,ypos=0]{\bfseries\sffamily TOP SECRET!}
I'll have to add some transparency, though, since the text is illisible under the watermark.
User avatar
Cham
Posts: 937
Joined: Sat Apr 02, 2011 4:06 pm

draftwatermark not on top of pictures

Post by Cham »

Grrr, I'm unable to get a transparent top watermark. I need help on this. :(
User avatar
Cham
Posts: 937
Joined: Sat Apr 02, 2011 4:06 pm

draftwatermark not on top of pictures

Post by Cham »

I may have found a solution, but it feels like an hack to me :

Code: Select all

\usepackage{tikz}
\usepackage[printwatermark]{xwatermark}
\newsavebox\mybox
\savebox\mybox{\tikz[color=red,opacity=0.1]\node{\bfseries\sffamily TOP SECRET!};}
\newwatermark*[allpages,angle=45,scale=8,xpos=-25,ypos=20
]{\usebox\mybox}
And I don't understand the xpos and ypos values. The numbers have been selected by trial and error, by eyes. I don't understand these coordinates. How can I set the mark exactly in the middle of the page ?
User avatar
Cham
Posts: 937
Joined: Sat Apr 02, 2011 4:06 pm

draftwatermark not on top of pictures

Post by Cham »

Is there another way in adding a transparent diagonal warning on top of the text and pictures ? The code above is giving me problems with the revtex4 document class, and I'm unable to create a MWE to show the problem. The issue appears to be complicated (three way conflict ?) and is related to footnotes.

So I need another way of adding the warning on top of the text/pictures/equations.

Any suggestions ?
User avatar
Cham
Posts: 937
Joined: Sat Apr 02, 2011 4:06 pm

draftwatermark not on top of pictures

Post by Cham »

Here's another code that do the same as the one above, without (apparently) using Tikz. However, I'm experiencing the same problem with some footnotes :

Code: Select all

\usepackage{transparent}
\usepackage[printwatermark]{xwatermark}
\newwatermark*[allpages,angle=45,color=red,scale=2.5,textalign=center,height=\paperheight,width=\paperwidth,xpos=0,ypos=0
]{\transparent{0.1} \bfseries\sffamily TOP SECRET!}
User avatar
Stefan Kottwitz
Site Admin
Posts: 10345
Joined: Mon Mar 10, 2008 9:44 pm

draftwatermark not on top of pictures

Post by Stefan Kottwitz »

No idea, what "the same problem with some footnotes" means, without MWE I don't see anything. Also above, "The issue appears to be complicated (three way conflict ?) and is related to footnotes." doesn't show me something to test and to fix.

Stefan
LaTeX.org admin
User avatar
Cham
Posts: 937
Joined: Sat Apr 02, 2011 4:06 pm

draftwatermark not on top of pictures

Post by Cham »

Sorry Stefan, I discussed the issue on another topic : http://latex.org/forum/viewtopic.php?f=5&t=29750

I'm unable to reproduce clearly the problem with a MWE. The cause appears to be related to at least three things : the revtex4 class, footnotes, and the xwatermark package.

Removing the foreground watermark solves the issue (doh !)

I usually don't use revtex4, and don't add a watermark. But I need them in a specific work today.
User avatar
Stefan Kottwitz
Site Admin
Posts: 10345
Joined: Mon Mar 10, 2008 9:44 pm

draftwatermark not on top of pictures

Post by Stefan Kottwitz »

You still can make an MWE. Even if it's the whole document (not yet an MWE) but a copy can be reduced.

Stefan
LaTeX.org admin
User avatar
Cham
Posts: 937
Joined: Sat Apr 02, 2011 4:06 pm

draftwatermark not on top of pictures

Post by Cham »

I'll try, but it's not easy !

More later, I'm too tired to continue working on this right now.
Post Reply