I've got a LaTeX document, and I've been given a PNG file consisting of a page border with a big transparent section in the middle.

Is it possible to use LaTeX to add that image to every page, with the actual content in the transparent section; or will I have to create the PDF with LaTeX and then manually add the border in some other way?


One option would be to use the background package to place the image as a background image; the geometry package can be used to adjust the text area. A little example:




An image of the first page of the resulting document:

enter image description here

Here's the code I used toproduce the border used:



\begin{tikzpicture}[remember picture,overlay] 
\coordinate (a) at ( $ (current page.north west) +  (1cm,-1cm)$); 
\coordinate (b) at ( $ (current page.south west) +  (1cm,1cm)$); 
\coordinate (c) at ( $ (current page.south east) +  (-1cm,1cm)$); 
\coordinate (d) at ( $ (current page.north east) +  (-1cm,-1cm)$); 
\fill[Maroon] (current page.south west) rectangle ( $ (current page.north west) + (2cm,0) $);
\fill[Maroon] (current page.south east) rectangle ( $ (current page.north east) + (-2cm,0) $);
\fill[Maroon] (current page.north west) rectangle ( $ (current page.north east) + (0,-2cm) $);
\fill[Maroon] (current page.south west) rectangle ( $ (current page.south east) + (0,2cm) $);
  • Do you know why this fails if babel is loaded with french? – cfr Apr 13 '14 at 20:32
  • @cfr is the problem of some babel modules making active some characters that TikZ uses. The quickest solution is to use the babel library: \usetikzlibrary{babel} (for version 3.0.0 of TikZ); other wise, you will need to use every picture/.append style to invoke \shorthandoff for the problematic charcater(s). – Gonzalo Medina Apr 13 '14 at 20:38
  • Thanks! Normally I only use 2 languages with babel and one is English while the other is, let's say, minimal in its support of anything. (Hyphenation patterns and a very few translations many of which are non-optimal is about it.) But I was trying to answer a question which used French and so surprised that turned out to be the problem. I guess there are advantages to using a radically under-supported language which does next-to-nothing after all! – cfr Apr 13 '14 at 20:56
  • @cfr yes; the spanish module, for example, tries to implement a lot of the Spanish rules dictated by our Real Academia and in doing so generates many incompatibilities with some packages (with TikZ, for example, but also with lipsum!); a non-experienced user can become really clueless as to where the problem might be. – Gonzalo Medina Apr 13 '14 at 21:06
  • I, on the other hand, have yet to come across a problem created by welsh other than mistranslations ;). Then again, the fact that the language is not supported by the T1 encoding, that translations are non-existent in most cases and that nothing else has ever heard of it is not unproblematic... [Or any other encoding. The only one which supports it is berenisadf in LY1.] – cfr Apr 13 '14 at 21:30

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.