Document ClassesPage background customization

Information and discussion about specific document classes and how to create your own document classes.
Post Reply
meho_r
Posts: 823
Joined: Tue Aug 07, 2007 5:28 pm

Page background customization

Post by meho_r »

I really would like to know is there a way to make some customizations of background of a document in LaTeX. In DTP tools there are "master" pages which can be applied to specific pages in a document. Is there something similar in LaTeX? To be more specific, I need advice regarding the following:

I'm making a fancy book (for kids) which have to contain some fancy border with some ornaments, graphics etc. around (and/or below) the text on every page. Is there a way to put, let say, a pdf document containing borders/graphics which will be in the background of every page (some sort of pattern that will ve reoccuring through the document)?

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

Stefan Kottwitz
Site Admin
Posts: 10335
Joined: Mon Mar 10, 2008 9:44 pm

Page background customization

Post by Stefan Kottwitz »

Hi meho_r,

I did something similar using the eso-pic package like this:

Code: Select all

\usepackage{eso-pic}
\usepackage{graphicx}
\AddToShipoutPicture*{%
\put(0,0){\includegraphics{backgroundpage}}%
}
where backgroundpage.pdf was created by LaTeX too using the same papersize.

Stefan
LaTeX.org admin
meho_r
Posts: 823
Joined: Tue Aug 07, 2007 5:28 pm

Re: Page background customization

Post by meho_r »

Thank you, thank you, thank you, thank you, thank you :) This solves so many problems and questions I had. But I have one more: I've learned how to put an image as background of one page and how to make it appear on all pages using eso-pic. But, how can I use picture "A" for first chapter or section, picture "B" for second etc.? Is there some kind of "break" mechanism? All parameters/commands in eso-pic seem to work globally only.
User avatar
Stefan Kottwitz
Site Admin
Posts: 10335
Joined: Mon Mar 10, 2008 9:44 pm

Page background customization

Post by Stefan Kottwitz »

Hi meho_r,

use \ClearShipoutPicture. Or write just \AddToShipoutPicture*, that's affecting only the current page. See
eso-pic documentation.

Stefan
LaTeX.org admin
meho_r
Posts: 823
Joined: Tue Aug 07, 2007 5:28 pm

Page background customization

Post by meho_r »

Thanks again. I did read the documentation for eso-pic but missed the point :roll: Now I've tested it on a new (and clean) document because I got strange results previously. So, I concluded that:

1. \ClearShipoutPicture does clear picture from background from the place where it is declared onward, while previous pages remain the same.

2. If immediately after \ClearShipoutPicture new \AddToShipoutPicture is declared, then the new picture is in effect from the current page onward. Without \ClearShipoutPicture before it the new \AddToShipoutPicture doesn't have any effect.

Finally got it :D

Thank you for your help, Stefan_K. You're the man ;)
Post Reply