# Footers with fancyhdr in the margin in right pages of twosided book

I've just written in LaTeX my term notes and wanted to give it different look. I want that the page numbers get a blue shade around, and that shade should come from the border of the page. Sorry for my bad English, with the images it'll be easier.

Something like this:

This is the MWE for this in LaTeX:

\documentclass[11pt,a4paper,twoside,openany]{book}
\usepackage[utf8]{inputenc}
\usepackage[bottom=3cm,top=3cm,left=2.5cm,right=2.5cm]{geometry}
\usepackage{xcolor}

\usepackage{framed}

\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyfoot{} % clear all footer fields

\begin{document}
\newpage
.
\newpage
.
\end{document}


I defined right and left pages separately, and the result in left pages is the desired, but in the right pages I'm getting this:

I've tried putting a \hspace*{length} before, but it refuses to read it and always put the shaded area in the same place.

I want the page number 2.5cm (right margin) from the right border, with the blue shade going from the number to the right border of the page.

• Try using \llap{} and \rlap{}. – cfr Jan 3 '17 at 3:22

\documentclass[11pt,a4paper,twoside,openany]{book}
\usepackage[utf8]{inputenc}
\usepackage[bottom=3cm,top=3cm,left=2.5cm,right=2.5cm,paperheight=10cm]{geometry}
\usepackage{xcolor}

\usepackage{framed}

\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyfoot{} % clear all footer fields