Contents

LaTeX Document Background

In some documents, the author may want to add a background to create a certain visual mood. In LaTeX, this can be done either with a full-page image or with a simple page color.

LaTeX document background

In LaTeX, we can add various backgrounds that cover the full page of the document.

Before starting, note the following:

  1. Include the background package in the document preamble.
  2. Save the background image in the same folder as the .tex file.
  3. Write the document content as usual.

Besides images, we can also set a page color using the command \pagecolor{color}.

Open your LaTeX editor, either offline or online such as Overleaf.

Use the desired document class. In this example, the article class is used.

\documentclass[a4paper,11pt]{article}

In the preamble, include graphicx, xcolor, and background.

\usepackage{graphicx}
\usepackage{xcolor}
\usepackage{background}

Then configure the background with the following command.

\backgroundsetup{
  scale=1,
  angle=0,
  opacity=90,
  contents={\includegraphics[width=\paperwidth,height=\paperheight]{kertaskuno}}
}

In this part we can adjust the scale, rotation, and transparency of the background image.

Begin the document body with:

\begin{document}

Write the document content as needed. In this example, a song lyric excerpt is used as the sample text.

\begin{center}
  \color{blue}{\Huge CINTA DAN KALIMAH\\
  \medskip
  \Large Iklim}
\end{center}
\begin{verse}
Kasih sayang tak terpadam\\
Rindu pun tak terbilang\\
Bak malam dan siang\\
Hanya engkau kurindu\\
\hskip 8mm Bukan kerna kata-kata\\
\hskip 8mm Cinta yang subur di minda\\
\hskip 8mm Sucinya cintamu\\
\hskip 8mm Di cermin hati\\
Salji yang putih hitam mendidih\\
Andai kulupa padamu\\
Langit yang pijar kembali ceria\\
Indah kukecup keningmu\\
\hskip 8mm Dengan ratapan kutelan bisa\\
\hskip 8mm Pahit-manis madah pujangga\\
\hskip 8mm Menguntum rindu seiras wajahmu\\
\hskip 8mm Relung cinta dan kalimah\\
Terbuka pintu saujana kemaafan\\
Kau tersenyum mengirai mimpi\\
Salju terasa bersamamu, kekasih\\
Menyulamkan keindahan\\
Cinta dan kalimah\\
\end{verse}

Close the document with:

\end{document}

Compile the document and check the result.

Below is an example output from the steps above.

If you want to use a background that does not fully cover the page while preserving the image proportion, use keepaspectratio. You can also add a page background color using \pagecolor.

\documentclass{article}
\usepackage{background}
\backgroundsetup{
  scale=1,
  angle=0,
  opacity=0.9,
  contents={\includegraphics[width=\paperwidth,height=\paperheight,keepaspectratio]{root.png}}
}
\usepackage{lipsum}
\begin{document}
\pagecolor{blue!40}
\lipsum[1-5]
\end{document}

The result will look like this.

Background in LaTeX

That is the guide to adding a background to a LaTeX document using the background package. If you have corrections or suggestions, please leave them in the comments.

Related Content