0

I want to add different text watermarks to my document, starting on the second page. The watermarks will be two-lines long, and each page will have a different watermark, as follows:

--- Page 2 ---
     US
United States
--- Page 3 ---
     BR
   Brazil
--- Page 4 ---
     CA
   Canada

The number of pages in the document is not limited to three.

Any help is appreciated.

2
  • I believed that there are no default supports, you have to create based on \if or \ifnum
    – MadyYuvi
    Oct 9, 2023 at 9:23
  • I'd suggest eso-pic package. Use \AddToShipoutPicture and \ClearShipoutPicture macros to set a range of pages with/without watermarks. Alternatively, LaTeX's hook management provides info about hooks, s.a. \AddToHook or \AddToHookNext. When used with the hook shipout/background the effect is the same as with eso-pic. Here is The ltshipout documentation for more info to understand shipout-related hooks.
    – Celdor
    Oct 9, 2023 at 9:59

1 Answer 1

1

Here's an example based on eso-pic. \AddToSipoutPictureBG adds watermarks to every page from the current page onward whereas the starred version \AddToSipoutPictureBG* (see example with Brazil) adds one watermark only on the current page. The consecutive pages are not affected. \ClearShipoutPictureBG resets any picture currently used, which also has to be used in order to change a watermark unless you want to overlap multiple pictures.

I added tikz and xcolor packages. The former positions watermarks on a page and adds a few other options, such as scale, opacity or colour. The xcolor is to use customised colours and the [svgnames] option provides a great number of predefined colours (see page 39 of documentation).

\documentclass{report}
\usepackage[svgnames]{xcolor}
\usepackage{eso-pic}
\usepackage{tikz}
\usepackage{blindtext}   % For dummy texts

\title{\bfseries The title}
\date{}
\author{First Last}

\newcommand\wm[1]{%
  \tikz[overlay]
  \node at (current page.center)
  [rotate=45, Gray, scale=5, opacity=0.35]
  {\bfseries\vbox{\centering #1}};}


\begin{document}
\maketitle

\clearpage
\blindtext

\clearpage
\AddToShipoutPictureBG{\wm{US\\United States}}
\Blindtext

\clearpage
\ClearShipoutPictureBG
\AddToShipoutPictureBG*{\wm{BR\\Brazil}}
\Blindtext

\clearpage
\ClearShipoutPictureBG
\AddToShipoutPictureBG{\wm{CA\\Canada}}
\Blindtext
\end{document}

enter image description here

2
  • Thank you! I had already solved my problem using the "background" package before I saw your answer. Anyways, I will try your solution soon!
    – sahin
    Oct 9, 2023 at 19:07
  • 1
    Use whatever works for you. There are multiple solutions to your problem. However, background was not updated since 2014 whereas eso-pic was still maintained up to 2020. This means backgraound may break sooner in future modern LaTeX.
    – Celdor
    Oct 10, 2023 at 8:00

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .