6

How do I add a plain rectangle page border offset by 1.5 cm from the edge of the page? I'd prefer to use \TikZ if possible.

2
  • 1
    On all pages? Should this boarder be the same as the available text space? – samcarter_is_at_topanswers.xyz Jun 5 '18 at 17:26
  • All pages, unrelated to available text space. – KJC Jun 5 '18 at 17:36
8
\documentclass{article}
\usepackage{tikz}
\usepackage{tikzpagenodes}
\usetikzlibrary{calc}
\begin{document}
\tikz[overlay,remember picture]\draw($(current page.north east)+(-1.5cm,-1.5cm)$)--($(current page.north west)+(1.5cm,-1.5cm)$)--($(current page.south west)+(1.5cm,1.5cm)$)--($(current page.south east)+(-1.5cm,1.5cm)$)--cycle;
\end{document}

enter image description here

Set the border in all pages:

\documentclass{article}
\usepackage{tikz}
\usepackage{tikzpagenodes}
\usetikzlibrary{calc}
\usepackage{fancyhdr}

\newcommand{\myborder}{
\tikz[overlay,remember picture]\draw($(current page.north east)+(-1.5cm,-1.5cm)$)--($(current page.north west)+(1.5cm,-1.5cm)$)--($(current page.south west)+(1.5cm,1.5cm)$)--($(current page.south east)+(-1.5cm,1.5cm)$)--cycle;}

\pagestyle{fancy}
\fancyhf{}
\renewcommand{\headrulewidth}{0pt}
\rhead{\myborder}
\begin{document}
content
\end{document}
2
  • This is it, thanks! I see how that works but I didn't know the syntax. – KJC Jun 5 '18 at 17:45
  • you're welcome :) I'm sure you'll improve this code – Old Nick Jun 5 '18 at 17:46
4
\documentclass{article}
\usepackage{fancybox}
\cornersize{0}
\fancyput(3.25in,-4.5in){%
        \setlength{\unitlength}{1in}\fancyoval(7,9.5)}%
\begin{document}
foo
\end{document}

enter image description here

1
  • I think the OP is asking for something different. – gvgramazio Jun 5 '18 at 17:49
2

You don't need a hammersledge to obtain this frame on every page: eso-pic and simple \framebox and \raisebox commands with the relevant parameters will do the trick:

\documentclass[11pt,svgnames, a4paper]{book}
\usepackage{eso-pic}
\usepackage{geometry}
\usepackage{xcolor} 
\usepackage{etoolbox}
\usepackage{lipsum}
\dimdef{\frameheight}{\dimexpr\paperheight-3cm-\fboxsep-2\fboxrule}
\dimdef{\framewidth}{\dimexpr\paperwidth-3cm-2\fboxsep-2\fboxrule}

\title{Page Frames}
\author{My Self}

\date{}
  \AddToShipoutPictureBG{%
 \AtPageLowerLeft{%
\fboxrule = 1pt
\hspace*{1.5cm}\raisebox{1.5cm}{\color{DarkSeaGreen}\framebox[\framewidth]{\rule{0pt}{\frameheight}}}%
}}

\begin{document}

\maketitle
\chapter{Chapter Title}

\lipsum

\end{document} 

enter image description here

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.