Typevia
Figures and Images

Introduction to Watermarks and Backgrounds

In professional document preparation, you often need to overlay information that exists "behind" your main content. This is typically done using watermarks or backgrounds.

A watermark is usually a semi-transparent text or image (like "DRAFT" or a company logo) that appears on every page or specific pages of a document. It serves several purposes:

  • Status Indication: Marking a document as a "Draft," "Confidential," or "Internal Use Only."
  • Branding: Adding a subtle corporate logo to the background of a report.
  • Security: Discouraging unauthorized copying by including the recipient's name or a copyright notice.

In LaTeX, watermarks are not part of the standard text flow. Instead, they are placed in a separate layer, ensuring they don't interfere with your margins, headers, or paragraphs. This guide will walk you through the two most popular methods for achieving this: the simple draftwatermark package and the highly customizable background package.


Method 1: Quick Watermarks with draftwatermark

If you need a simple text watermark with minimal setup, the draftwatermark package is the best place to start. It is designed to be "plug-and-play."

Basic Usage

To add a default "DRAFT" watermark to every page of your document, simply add this to your preamble:

\usepackage{draftwatermark}

Customizing the Text and Appearance

You can customize the text, color, scale, and transparency using specific commands in the preamble.

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{xcolor} % Required for colored watermarks
\usepackage{draftwatermark}

% Customization commands
\SetWatermarkText{CONFIDENTIAL}
\SetWatermarkScale{4}
\SetWatermarkColor{red!20} % Light red (20% opacity appearance)

\begin{document}
\section{Project Alpha}
This document contains sensitive information regarding Project Alpha.
\newpage
This is the second page, and the watermark persists here as well.
\end{document}

Key Commands:

  • \SetWatermarkText{...}: Changes the default "DRAFT" text to your choice.
  • \SetWatermarkScale{...}: Changes the size of the watermark (default is 1).
  • \SetWatermarkColor{...}: Sets the color. It is highly recommended to use a lightened color (e.g., gray!25) so the main text remains readable.
  • \SetWatermarkAngle{45}: Changes the rotation of the text.

Method 2: Advanced Backgrounds with the background Package

While draftwatermark is easy, the background package offers significantly more control. It allows you to position elements precisely, use images, and toggle watermarks on specific pages more easily.

Basic Setup

The background package uses a "key-value" system for configuration.

\usepackage[pages=all]{background}

\backgroundsetup{
  scale=3,
  color=blue,
  opacity=0.2,
  angle=45,
  contents={Internal Use Only}
}

Positioning and Content

One of the main advantages of the background package is the position key. You can place the watermark in the center, at the bottom, or at specific coordinates using the TikZ engine (which the package uses internally).

\documentclass{article}
\usepackage[pages=all]{background}

\backgroundsetup{
  scale=1,
  color=black,
  opacity=0.1,
  angle=0,
  placement=bottom,
  vshift=2cm, % Move it 2cm up from the bottom
  contents={Copyright \copyright\ 2023 My Company}
}

\begin{document}
\section{Introduction}
The watermark is now placed at the bottom of every page as a subtle footer.
\end{document}

Note: The background package depends on TikZ. If you are already using TikZ in your document, ensure there are no version conflicts by loading background after other TikZ-related packages.


Using Images as Backgrounds

Sometimes text isn't enough; you may need a company logo or a full-page decorative background. You can achieve this by placing an \includegraphics command inside the contents key of the background package.

\documentclass{article}
\usepackage{graphicx}
\usepackage[pages=all]{background}

\backgroundsetup{
  scale=1,
  opacity=0.15,
  angle=0,
  contents={\includegraphics[width=0.5\textwidth]{logo.png}}
}

\begin{document}
\section{Company Report}
The logo is now centered behind the text on every page.
\end{document}

Full-Page Backgrounds

If you have a pre-designed background PDF or image that should cover the entire page, set the scale and opacity accordingly:

\backgroundsetup{
  scale=1,
  opacity=1,
  angle=0,
  contents={\includegraphics[width=\paperwidth,height=\paperheight]{background-image.pdf}}
}

Best Practice: When using images as watermarks, ensure the image itself has a high resolution but a low file size (compressed) to prevent your final PDF from becoming unnecessarily large.


Selective Watermarking: Specific Pages Only

You may not want a watermark on your title page or your table of contents.

Using background for Specific Pages

When you load the package, set pages=some. This prevents the watermark from appearing automatically. You then trigger it on specific pages using \BgThispage.

\usepackage[pages=some]{background}

% ... in the document body ...

\begin{document}
\maketitle % No watermark here

\newpage
\BgThispage % Watermark will appear only on this page
\section{Specific Content}
This page is marked.

\newpage
% No watermark here unless \BgThispage is called again
\end{document}

Using draftwatermark for Specific Pages

To turn off the watermark for the first few pages and then turn it on:

  1. Load the package: \usepackage{draftwatermark}.
  2. Use \DraftwatermarkOptions{manual} in the preamble.
  3. Use \DraftwatermarkPage on every page you want it to appear.

Best Practices and Common Pitfalls

To create professional-looking documents with backgrounds, keep these tips in mind:

  1. Readability First: The primary goal of your document is to be read. If your watermark is too dark (opacity too high) or the font is too busy, it will distract the reader. Aim for an opacity between 0.1 and 0.2.
  2. Color Selection: Light grays (gray!20) or light blues are standard for watermarks. Avoid vibrant colors unless they are essential for branding.
  3. Check Your Layers: In LaTeX, the background is usually drawn "under" the text. However, if you use solid colored boxes (like highlighted code blocks or colored tables), they might cover the watermark.
  4. Compilation Speed: If you use complex vector graphics as backgrounds on every page of a 100-page document, your PDF viewer might lag while scrolling. Use optimized PDFs or low-res placeholders during the writing phase.
  5. Placement: Ensure your watermark doesn't clash with page numbers or headers. If your watermark is a footer-style text, adjust the vshift (vertical shift) or hshift (horizontal shift) to keep it clear of the page footer.

Common Mistake: Forgetting to load xcolor. If you try to use \SetWatermarkColor{red!20} without the xcolor package, LaTeX will throw an error. Always include \usepackage{xcolor} when working with colors.