# Custom Page Border

How can i create a page template that looks like this:

Where the default paper is A4 and I want my ctext to be located in the big rectangle? The distances represent how far away it should be from the borders of the A4 paper.

• Welcome to TeX SX! Should 25 and 35 mm be the left and right margins? And the page number should be in the right margin? – Bernard Oct 20 '19 at 17:36

If you need a border around your text, I would suggest you leave some space between the border and the text. For your page template, you could use a combination of the geometry package, the fancyhdr package and some TikZ for the frames:

\documentclass[a4paper]{article}
\usepackage[
top=8mm,
bottom=8mm,
left=27mm,
right=44mm,
marginparwidth=31mm,
marginparsep=4mm
]{geometry}

\usepackage{tikz}

\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhf{}
\draw ([shift={(25mm,-7mm)}]current page.north west) rectangle ++(178mm,-283mm);
\draw ([shift={(168mm,-7mm)}]current page.north west) -- ++(0,-283mm);
\draw ([shift={(168mm,-13mm)}]current page.north west) -- ++(35mm,0);
\node[minimum width=31mm] at ([shift={(185.5mm,-10mm)}]current page.north west) {Page \thepage};
} }

\usepackage{lipsum}

\begin{document}

\lipsum[1-3]\marginpar{This is an annotation in the margin.}

\lipsum

\end{document}