4

Sorry if you don't understand me, but English is not my native language.

Is it possible to put a frame at x cm from the right and left edges of the page and at y cm from the up and bottom edges of the page?

like in this image. enter image description here

I have tried with the showframe package and the showframe option of the geometry package, but none of those works for me.

Thanos
  • 12,446
  • Welcome to TeX.SE. It would be helpful if you composed a fully compilable MWE including \documentclass and the appropriate packages that shows what you have tried. While solving problems can be fun, setting them up is not. Then, those trying to help can simply cut and paste your MWE and get started on solving the problem which works for your particular case. – Peter Grill Aug 17 '14 at 18:08

2 Answers2

4

Here is an adaptation of Place a TikZ picture on every page:

enter image description here

Notes:

  • This does require two runs. First one to determine the locations, and the second to do the drawing.

Code:

\documentclass[12pt]{book}
\usepackage[demo]{graphicx}
\usepackage[all]{background}

\usepackage{lipsum} %\usepackage{showframe} \usepackage{tikz} \usetikzlibrary{calc}

\usepackage{changepage} \strictpagecheck

\newcommand{\VOffset}{2cm}% vertical offset \newcommand{\HOffset}{1cm}% horizontal offset

\newcommand{\MyTikzLogo}{% For a logo drawn with TikZ \begin{tikzpicture}[remember picture,overlay,draw=black,ultra thick] \draw [gray] ($(\HOffset,-\paperheight+\VOffset)$) rectangle (\paperwidth-\HOffset,-\VOffset); \end{tikzpicture} }

\SetBgContents{\MyTikzLogo}% Set tikz picture

\SetBgPosition{current page.north west}% Select location \SetBgOpacity{1.0}% Select opacity \SetBgAngle{0.0}% Select roation of logo \SetBgScale{1.0}% Select scale factor of logo

\begin{document} \section*{Lorem Ipsum} \lipsum[1-25] \end{document}

Peter Grill
  • 223,288
2

Here is a simple solution that ensures frames on every page, with the typogrid,geometry and framed package, with \FrameRule set to 0pt. One has to make titles by hand, as \maketitle creates empty (framed) pages before the title. The framed environment is used only to have a small space between text and frame.

\documentclass[a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[hmargin = \dimexpr 2.5cm + \fboxrule\relax, vmargin =\dimexpr 3cm + \fboxrule\relax]{geometry}
\usepackage[draft, columns = 1,margin = false, headings = false]{typogrid}
\usepackage{framed}
\usepackage{lipsum, titling}
\title{Some Title}
\author{I. Myself}
\setlength\FrameRule{0pt}
\begin{document}

\begin{framed}
\begin{center}
\Huge Some Title\\[2ex]
\Large I. Myself \\[4\baselineskip]
\end{center}

\section{A First Section}
 \lipsum[1-4]
 \end{framed}

\end{document} 

enter image description here

Bernard
  • 271,350