I have created a nice frame (well... nice for my standards) in tikz. Taking inspiration from another question (namely Getting a particular kind of page border using background package ), I used tikzpagenodes so that changing in the margins wouldn't affect the border.
I also decided to put page numbers in the margins of the page, using directly code I found here on stackexchange as well (Page number in outer margin affects vertical ruler).
Here's a sample code:
\documentclass[a4paper,11pt,twoside]{scrreprt}
\usepackage[utf8]{inputenc}
\usepackage[B1,T1]{fontenc}
\usepackage[usenames,dvipsnames,svgnames,table]{xcolor}
\usepackage[margin=45mm]{geometry}
% page number in margins
\usepackage{scrpage2}
\clearscrheadfoot
\pagestyle{scrheadings}
\setlength{\footskip}{0pt}
\rofoot[\centerpageno{o}]{\centerpageno{o}}
\lefoot[\centerpageno{e}]{\centerpageno{e}}
\def\centerpageno#1{\leavevmode
\vbox to 0pt{
\vss
\hbox to 0pt{\large
\if#1o\kern 1.15cm\else\hss\fi\thepage
\if#1o\hss\else\kern 1.15cm\fi}
\vskip.5\textheight
\vskip\baselineskip}}
\usepackage{background}
\usetikzlibrary{calc}
\usepackage{tikzpagenodes}
\backgroundsetup%
{ contents={
\begin{tikzpicture}[overlay]
\checkoddpage
\ifoddpage
\draw[color=BrickRed,line width=5pt, opacity=1] ($(current page text area.south west)+(-1.5,-1.5)$) rectangle ($(current page text area.north east)+(1.5,1.5)$);
\draw[black, opacity=1] ($(current page text area.south west)+(-1.7,-1)$) -- ($(current page text area.north west)+(-1.7,1)$) -- ($(current page text area.north west)+(-1.25,1)$) -- ($(current page text area.north west)+(-1.25,1.7)$) -- ($(current page text area.north west)+(-1.7,1.7)$) -- ($(current page text area.north west)+(-1.7,1.25)$) -- ($(current page text area.north west)+(-1,1.25)$) -- ($(current page text area.north west)+(-1,1.7)$) -- ($(current page text area.north east)+(1,1.7)$) -- ($(current page text area.north east)+(1,1.25)$) -- ($(current page text area.north east)+(1.7,1.25)$) -- ($(current page text area.north east)+(1.7,1.7)$) -- ($(current page text area.north east)+(1.25,1.7)$) -- ($(current page text area.north east)+(1.25,1)$) -- ($(current page text area.north east)+(1.7,1)$) -- ($(current page text area.south east)+(1.7,-1)$) -- ($(current page text area.south east)+(1.25,-1)$) -- ($(current page text area.south east)+(1.25,-1.7)$) -- ($(current page text area.south east)+(1.7,-1.7)$) -- ($(current page text area.south east)+(1.7,-1.25)$) -- ($(current page text area.south east)+(1,-1.25)$) -- ($(current page text area.south east)+(1,-1.7)$) -- ($(current page text area.south west)+(-1,-1.7)$) -- ($(current page text area.south west)+(-1,-1.25)$) -- ($(current page text area.south west)+(-1.7,-1.25)$) -- ($(current page text area.south west)+(-1.7,-1.7)$) -- ($(current page text area.south west)+(-1.25,-1.7)$) -- ($(current page text area.south west)+(-1.25,-1)$) -- ($(current page text area.south west)+(-1.7,-1)$) ;
\draw[color=BrickRed,line width=5pt,opacity=1,fill=white] ($(current page text area.north east)+(1.5,-10.12)$) circle (25pt);
\else
\draw[color=BrickRed,line width=5pt, opacity=1] ($(current page text area.south west)+(-1.5,-1.5)$) rectangle ($(current page text area.north east)+(1.5,1.5)$);
\draw[black, opacity=1] ($(current page text area.south west)+(-1.7,-1)$) -- ($(current page text area.north west)+(-1.7,1)$) -- ($(current page text area.north west)+(-1.25,1)$) -- ($(current page text area.north west)+(-1.25,1.7)$) -- ($(current page text area.north west)+(-1.7,1.7)$) -- ($(current page text area.north west)+(-1.7,1.25)$) -- ($(current page text area.north west)+(-1,1.25)$) -- ($(current page text area.north west)+(-1,1.7)$) -- ($(current page text area.north east)+(1,1.7)$) -- ($(current page text area.north east)+(1,1.25)$) -- ($(current page text area.north east)+(1.7,1.25)$) -- ($(current page text area.north east)+(1.7,1.7)$) -- ($(current page text area.north east)+(1.25,1.7)$) -- ($(current page text area.north east)+(1.25,1)$) -- ($(current page text area.north east)+(1.7,1)$) -- ($(current page text area.south east)+(1.7,-1)$) -- ($(current page text area.south east)+(1.25,-1)$) -- ($(current page text area.south east)+(1.25,-1.7)$) -- ($(current page text area.south east)+(1.7,-1.7)$) -- ($(current page text area.south east)+(1.7,-1.25)$) -- ($(current page text area.south east)+(1,-1.25)$) -- ($(current page text area.south east)+(1,-1.7)$) -- ($(current page text area.south west)+(-1,-1.7)$) -- ($(current page text area.south west)+(-1,-1.25)$) -- ($(current page text area.south west)+(-1.7,-1.25)$) -- ($(current page text area.south west)+(-1.7,-1.7)$) -- ($(current page text area.south west)+(-1.25,-1.7)$) -- ($(current page text area.south west)+(-1.25,-1)$) -- ($(current page text area.south west)+(-1.7,-1)$) ;
\draw[color=BrickRed,line width=5pt,opacity=1,fill=white] ($(current page text area.north west)+(-1.5,-10.12)$) circle (25pt);
\fi
\end{tikzpicture}
},
scale=1,
angle=0
}
\usepackage{lipsum}
\begin{document}
\lipsum
\addtocounter{page}{+10}
\lipsum
\addtocounter{page}{+100}
\end{document}
As you can see, the page number in the margin is not centered inside the circle (I enlarged the font in order to better show the effect); this is because the page number isn't centered horizontally as the digits are added.
Is there a way to make the page number centered horizontally, so that the number remains centered on a point, regardless of the number of digits?
Bonus question: is there a way to draw the circle in that same point, so that I don't have to position it manually?
Thanks.
