Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I want a custom border for my document. I was thinking of doing something like this, creating a border with a graphics tool(only the outer frame) and then placing it in the beginning of the document, so it cover the entire page as a border.

When I type something now, would it be inside the frame or outside?

I need help in creating my own borders for the page.

share|improve this question
    
You can either use the textpos or tikz package to position the image at an absolute position on the page. You might need to put that code in the header or footer, so that it is added on every page –  Martin Scharrer May 13 '11 at 18:16
add comment

1 Answer

up vote 12 down vote accepted

You can use the background package to add a frame to every page of your document; the package internally uses PGF/TikZ to place the background material and offers you great control over the attributes. A little example that places a blue frame in every page of the document:

\documentclass{book}
\usepackage{background}
\usepackage{ifthen}
\usepackage{lipsum}

\newcommand*\Myframe{%
  \begin{tikzpicture}[ultra thick]
    \draw(0,0) rectangle (1.1\textwidth,1.15\textheight);
  \end{tikzpicture}}

\SetBgScale{1}
\SetBgHshift{-1cm}
\SetBgAngle{0}
\SetBgOpacity{1}
\SetBgContents{}
\SetBgColor{blue}
\SetBgVshift{-0.1cm}

\makeatletter
\AddEverypageHook{%
\ifthenelse{\isodd{\value{page}}}%
  {\SetBgHshift{-1cm}}%
  {\SetBgHshift{1cm}}%
  \SetBgContents{\Myframe}\bg@material}
\makeatother


\begin{document}
\chapter{Chapter title}
\lipsum[1-20]

\end{document}

Of course, you can use your own material as frame.

share|improve this answer
3  
@Gonzola: \ifthenelse{\isodd{\thepage}} isn't well because \thepage can be IV. or page IV or ... --- better \value{page} –  Marco Daniel May 13 '11 at 19:02
    
@Marco: thanks. Fixed. –  Gonzalo Medina May 13 '11 at 19:07
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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