2
\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.
% \rhead{{\color{blue}\rule{1cm}{1cm}}}

\rhead{\includegraphics[width=5cm]{1}}
\lhead{\includegraphics[width=4cm]{2}}

% \rhead{\begin{picture}(3,3) \put(3,3){\includegraphics[width=1cm]{example-image-a}} \end{picture}}

\begin{document}

\lipsum

\end{document}

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

Number

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

Thanks

2 Answers 2

2

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):

enter image description here

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.
% \rhead{{\color{blue}\rule{1cm}{1cm}}}

\rhead{\includegraphics[width=5cm,height=22pt]{example-image-a}}
\lhead{\includegraphics[width=4cm,height=22pt]{example-image-b}}

% \rhead{\begin{picture}(3,3) \put(3,3){\includegraphics[width=1cm]{example-image-a}} \end{picture}}

% remove rule in head
\renewcommand{\headrulewidth}{0pt}

% 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}
2

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}

\usepackage[footsepline]{scrlayer-scrpage}% sets pagestyle scrheadings
\setlength\headheight{26pt} %% just to make warning go away. Adjust the value after looking into the warning.
\clearpairofpagestyles
\ihead{\includegraphics[width=5cm,height=22pt]{example-image-a}}
\ohead{\includegraphics[width=4cm,height=22pt]{example-image-b}}

\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}
\AddLayersToPageStyle{scrheadings}{pagenumber}

\addtokomafont{footsepline}{\color{footsepline}}
\addtokomafont{pagenumber}{\Huge\bfseries\sffamily\color{pagenumberfg}}

\begin{document}
\lipsum
\clearpage
\setcounter{page}{100}% test a page number with 3 digits
\lipsum
\end{document}

enter image description here

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .