# Header and footer with special format

\documentclass[a4paper]{article}

\usepackage{graphicx}

\usepackage{fancyhdr}
\pagestyle{fancy}

\usepackage{xcolor}

\usepackage{lipsum}
\setlength\headheight{26pt} %% just to make warning go away. Adjust the value after looking into the warning.

\begin{document}

\lipsum

\end{document}


How can I add a numbering footer on the right like that one?:

And how can I quit the rule that it's created under my header? And add a rule over the footer?

Thanks

This looks like a job for tikz. You may have to adjust some settings a little.

The head rule can be disabled with \renewcommand{\headrulewidth}{0pt}. I also inserted a colored foot rule, as shown in your picture.

The result (the black and gray frame on the bottom and the right is from my PDF viewer):

The code:

\documentclass[a4paper]{article}

\usepackage{graphicx}

\usepackage{fancyhdr}
\pagestyle{fancy}

\usepackage{xcolor}

\usepackage{tikz}

\usepackage{lipsum}
\setlength\headheight{26pt} %% just to make warning go away. Adjust the value after looking into the warning.

% colored foot rule
\let\origfootrule\footrule
\renewcommand{\footrule}{{\color{blue!80!black}\origfootrule}}
\renewcommand{\footrulewidth}{0.4pt}

\cfoot{} % clear centeer foot
\rfoot{%
\begin{tikzpicture}[remember picture,overlay]
\fill[violet!75]
(current page.south east) --
++(-5,0) -- node[white,below right,node font=\sffamily,scale=4] {\thepage}
++(5,5) -- cycle;
\end{tikzpicture}
}

\begin{document}

\lipsum

\end{document}


Here is another suggestion that uses package scrlayer-scrpage instead fancyhdr. Then you can declare a new layer for the page number and this layer to the layer pagestyle scrheadings.

\documentclass[a4paper]{article}
\usepackage{lipsum}% only for dummy text
\usepackage{tikz}% loads also graphicx, xcolor, ...

\colorlet{footsepline}{blue!80!black}
\colorlet{pagenumberbg}{violet}
\colorlet{pagenumberfg}{white}

\setlength\headheight{26pt} %% just to make warning go away. Adjust the value after looking into the warning.
\clearpairofpagestyles

\newlength\pagenumberbgsize
\setlength\pagenumberbgsize{5cm}% sets the size of the colored triangle
\newsavebox\pagenumberbgbox
\savebox\pagenumberbgbox{\tikz\fill[pagenumberbg]
(0,0)--++(\pagenumberbgsize,0)--+(0,\pagenumberbgsize)--cycle;}
\DeclareNewLayer[
foreground,
align=br,
area={\paperwidth}{\paperheight}{\pagenumberbgsize}{\pagenumberbgsize},
mode=picture,
contents={%
\putLL{\usebox\pagenumberbgbox}%
\put(\LenToUnit{.66\layerwidth},\LenToUnit{.33\layerheight}){\makebox(0,0){\pagemark}}%
}
]{pagenumber}