33 Comments

  1. It’s a really good tip, but I have a question.

    How can I add a image watermark?.

    I need to make a template letter for company, but need the logo behind the text.

    Thank you for your posts.

    Best regards.

    • Hi Thanatos,

      Thanks for that question. Yes, you can add an image instead of text using includegraphics:

      \SetWatermarkText{\includegraphics[width=\textwidth]{figure.file}}

      The graphicx package is required by draftwatermark and therefore, you won’t need to load it again.

      Best, Tom.

  2. Sarvesh

    Dear Tom, Thanks for this.
    Could you please help me What command should i use in order to place text message i.e. “Under Review” in the every page background in my IEEE survey paper.

    Thanks and Regards
    Sarvesh

    • (Moved here by Tom.)

      Hi Sarvesh,

      The draftwatermark package (documentation) would be one way to add watermarks. Here is some sample code to play with:

      \usepackage{draftwatermark}
      \SetWatermarkText{Under Review}
      \SetWatermarkScale{5}

      Cheers,
      Tom.

  3. Sarvesh

    Dear Tom,

    Today i have tried these code:

    \usepackage{graphicx}
    \usepackage{type1cm}
    \usepackage{eso-pic}
    \usepackage{color}
    
    \makeatletter
    \AddToShipoutPicture{%
                \setlength{\@tempdimb}{.5\paperwidth}%
                \setlength{\@tempdimc}{.5\paperheight}%
                \setlength{\unitlength}{1pt}%
                \put(\strip@pt\@tempdimb,\strip@pt\@tempdimc){%
            \makebox(0,0){\rotatebox{45}{\textcolor[gray]{0.75}%
            {\fontsize{6cm}{6cm}\selectfont{DRAFT}}}}%
                }%
    }
    \makeatother

    Draft is appearing for every pages but while compiling it was showing following types of Latex Warning and so failed to display all my tables and figures.
    LaTex Warning: Reference ‘table:nonlin’ on page 1 undefined on input line 168.
    ! Too many }’s.
    \color@endbox ->\color@endgroup \egroup
    1.99 \end{table}
    ?

    Please help me to short out the above mention problems.

    With regards
    Sarvesh

    • Hi Sarvesh,

      You probably just have to make sure you get the number of curly brackets right. Count how many you opening and closing brackets. It seems that you don’t need the last two “}”, just try.
      Also you seem to reference a table that has either no label or the spelling is different (warning).

      I will move your comments to a post where they seem to fit and block comments for this page. This is to benefit others who are having the same or similar problems.

      Best, Tom.

  4. Hi Tom, Your blog is awesome!!!

    When I was compiling my water.tex, I get this error:

    “Undefined control sequence”

    The mistake is in this line:

    \SetWatermarkColor[rgb]{0.7,0,0}

    I don’t know why? I have read through Google, but I haven’t found any answer. Well, Here is my source code for water.tex

    \documentclass[a4paper,11pt]{report}
    \usepackage[T1]{fontenc}
    \usepackage[utf8]{inputenc}
    \usepackage{lmodern}
    \usepackage{blindtext}
    \usepackage{draftwatermark}
    \SetWatermarkText{WaterMark}
    \SetWatermarkScale{1}
    \SetWatermarkColor[rgb]{0.7,0,0}
    \title{Watermarks}
    \author{All the blogs}
    \begin{document}
    \maketitle
    \tableofcontents
    \chapter{This is a test}
    In this document, you can see a watermark :D
    \end{document}

    Greetings

    • Hi Raul,

      Thanks for your command and the minimum working example. Running the code does not produce an error in my editor though. I suspect you don’t have the latest version of the package. According to the documentation colored watermarks were only added at the beginning of this year (Jan 2012). I suggest updating your LaTeX distribution.

      Let me know if that didn’t help.

      Best, Tom.

      • Hi Tom!

        I didn’t read the documentation, but in your comment, I can see the date of the update (Jan 2012). I think that’s my problem. I’m using Debian GNU/Linux, sqeeze. I’m going to try update my packages manually because with a ‘apt-get update’ doesn’t find any update.

        Thanks for your rapid answer.

        Greetings from Mexico

  5. Lan

    Hi,
    I tried to use this package with a “letter” class (actually “lettre”) instead of an “article” class but it did not work.
    Any idea to solve the problem?
    Thanks!
    Lan

    • Hi there,

      There seems to be a problem indeed. The class lettre somehow uses a different page layout. I can see the watermark, but its shifted to the top-right corner. It works with the letter documentclass, so maybe you want to consider changing documentclass. I will get back to you if I can think of any work-around.

      Cheers, Tom.

      \documentclass[11pt]{lettre}
      
      \usepackage[latin1]{inputenc}
      \usepackage[T1]{fontenc}
      \usepackage[french]{babel}
      \usepackage{draftwatermark}
      \SetWatermarkText{Draft}
      \SetWatermarkScale{15}
      \SetWatermarkAngle{45}
      
      \begin{document}
      \begin{letter}{}
      Letter goes here
      \end{letter}
      \end{document}
  6. sai kiran

    Dear Sir Tom Could u pls tell me how how to make latex to make use of entire page,I mean it is leaving some space at the bottom of every page and I was not able to fill it up.I had even kept \pagebreak after 6-7 lines (the space is such that 6-7 lines could fit in it.Even then it is writing only those 6-7 lines in another new page and remaining in another page(3rd).

    How can I avoid this

    • tom

      Thanks for your request. If you are not satisfied with the margins defined by default, you can change these through the geometry package.

      \documentclass[11pt]{article}
      \usepackage[margin=1in]{geometry}
      \usepackage{blindtext}
      \begin{document}
      \Blindtext
      \end{document}
    • tom

      Hi Panha,

      Thanks for your question. In the example below, the watermark is only printed on odd pages greater 1. With that, you should be able derive the two scenarios you were interested in.

      Best wishes,
      Tom

      \documentclass{article}
      \usepackage{draftwatermark, blindtext}
      
      \makeatletter
      \SetWatermarkText{%
      	\ifodd\c@page
      		\ifnum\value{page} > 1
      		% for specific pages, use: \ifnum\value{page} = 5
      			Odd page $>$ 1
      		\fi
      	\fi
      }
      \makeatother
      
      \begin{document}
      \blinddocument
      \end{document}
  7. Alejandro Feged-Rivadeneira

    Great code, thanks! I’m trying to fit “Under Review: do not cite or copy without author’s permission”, is there a way to do a line break? \\ doesn’t seem to work…

    • tom

      Hi Alejandro

      Thanks, that’s an interesting question. The draftwatermark package has some limitations. Below is a possible solution using background. Just ask if you need help with the code. I adapted the code from here.

      \documentclass[11pt]{article}
      \usepackage{blindtext}
      \usepackage[scale=5,opacity=0.4,color=red]{background}
      \usepackage{varwidth}
      \backgroundsetup{
      contents={%
      	\begin{varwidth}{8cm}{%
        		\centering{}Under Review: do no\\cite or copy without\\author's permission
      	}
      	\end{varwidth}
      }
      }
      \begin{document}
      \Blindtext
      \end{document}
    • Hi LN,

      Thanks for your question. You can’t do that with the draftwatermark package. However, the xwatermark package provides a starred version of the newwatermark macro that prints the watermark on top of the regular content. Here’s an example:

      \documentclass{article}
      \usepackage[printwatermark]{xwatermark}
      \usepackage{xcolor}
      \usepackage{blindtext}
      \newwatermark*[allpages,color=red!50,angle=45,scale=3,xpos=0,ypos=0]{Watermark}
      \begin{document}
      \blindtext
      \begin{figure}[!ht]
      \centering
      \color{gray}\rule{8cm}{8cm}
      \end{figure}
      \end{document}
  8. Vlad Inculet

    true, however the xwatermark package suppresses the watermark from all the pages after the toc, if the line \pagenumbering{gobble} is used in the toc section (page numbering suppression). I would highly appreciate a work around in that regards. I would like to use xwatermark with page numbering suppression in the toc

  9. Sam Nelson

    Is it possible to do multi line water mark?
    For example
    Line 1: ” Draft document”
    Line 2: ” Confidential”

    • Hi Sam,

      The \parbox macro adds line breaks. However, the behavior seems a little unpredictable. I included a reasonably looking example below.

      Best, Tom

      \documentclass[11pt]{article}
      \usepackage[english]{babel}
      \usepackage{blindtext}
      \usepackage{draftwatermark}
      \SetWatermarkText{\parbox{16cm}{\begin{center}\Large{}Draft document\\Confidential\end{center}}}
      \SetWatermarkScale{5}
      \SetWatermarkColor{red}
      \begin{document}
      \blindtext[10]
      \end{document}

Leave a Reply