2

I have a simple Latex code

\documentclass[oneside]{book}

\usepackage{titletoc}

\begin{document}

\tableofcontents


\chapter{Chapter One}
\section{Section One One}
\section{Section One Two}
\section{Section One Three}
\section{Section One Four}

\chapter{Chapter Two}
\section{Section Two One}
\section{Section Two Two}
\section{Section Two Three}

\chapter{Chapter Three}
\section{Section Three One}
\section{Section Three Two}
\section{Section Three Three}
\section{Section Three Four}
\section{Section Three Five}

\chapter{Chapter 4}
\section{Section 4 One}
\section{Section 4 Two}
\section{Section 4 Three}
\section{Section 4 Four}
\section{Section 4 Five}

\chapter{Chapter 5}
\section{Section 5 One}
\section{Section 5 Two}
\section{Section 5 Three}
\section{Section 5 Four}
\section{Section 5 Five}

\chapter{Chapter 6}
\section{Section 6 One}
\section{Section 6 Two}
\section{Section 6 Three}
\section{Section 6 Four}
\section{Section 6 Five}

\chapter{Chapter 7}
\section{Section 7 One}
\section{Section 7 Two}
\section{Section 7 Three}
\section{Section 7 Four}
\section{Section 7 Five}

\end{document} 

How I can put image (across the whole page) in background of all content pages (if there are more pages) like this:

enter image description here

If someone knows the solution and makes an example, I will be very grateful. I would like that the solution to be with Tikz package.

  • You can use the background package (based on TikZ) as in, e.g., tex.stackexchange.com/questions/167719/… (and use \backgroundsetup{contents={}} to switch off the background after the TOC). – Marijn Aug 13 '18 at 21:21
  • You should take a look at the eso-pic package. – Bernard Aug 13 '18 at 21:54
2

With eso-pic:

enter image description here

\documentclass{book}

\usepackage{titletoc}

\usepackage{eso-pic,graphicx}

\begin{document}

\AddToShipoutPictureBG*{%
  \AtPageLowerLeft{%
    % Your background image here
    \includegraphics[width=\paperwidth,height=\paperheight]{example-image}%
  }%
}%
\tableofcontents

\chapter{Chapter One}
\section{Section One One}
\section{Section One Two}
\section{Section One Three}
\section{Section One Four}

\chapter{Chapter Two}
\section{Section Two One}
\section{Section Two Two}
\section{Section Two Three}

\chapter{Chapter Three}
\section{Section Three One}
\section{Section Three Two}
\section{Section Three Three}
\section{Section Three Four}
\section{Section Three Five}

\chapter{Chapter 4}
\section{Section 4 One}
\section{Section 4 Two}
\section{Section 4 Three}
\section{Section 4 Four}
\section{Section 4 Five}

\chapter{Chapter 5}
\section{Section 5 One}
\section{Section 5 Two}
\section{Section 5 Three}
\section{Section 5 Four}
\section{Section 5 Five}

\chapter{Chapter 6}
\section{Section 6 One}
\section{Section 6 Two}
\section{Section 6 Three}
\section{Section 6 Four}
\section{Section 6 Five}

\chapter{Chapter 7}
\section{Section 7 One}
\section{Section 7 Two}
\section{Section 7 Three}
\section{Section 7 Four}
\section{Section 7 Five}

\end{document} 

\AddToShipoutPictureBG*{<stuff>} adds <stuff> to the BackGround of the current page while the unstarred version \AddToShipoutPictureBG{<stuff>} adds <stuff> to the current as well as subsequent pages. You can remove any BackGround material using \ClearShipoutPictureBG.

  • Note that the OP asked for a background picture in all pages of the TOC, which I think can be done with your suggestion of the unstarred \AddtoShipoutPictureBG followed by a \ClearShipoutPictureBG after the TOC. – Marijn Aug 14 '18 at 10:53
  • @Marijn: Exactly like I suggest at the end of my answer. – Werner Aug 14 '18 at 14:14
  • indeed, I just tried to point out to the OP that this part of your answer would fit his needs (whereas the MWE and the screenshot only show a background for the first page). – Marijn Aug 14 '18 at 16:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.