I a looking for a way to achieve the following outcome for the page numnbers in my footer created using fancyhdr:
My current code in a stand-alone example looks like this:
\documentclass[12pt,a4paper,parskip=full]{scrartcl}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{lipsum}
\usepackage{fancyhdr}
\usepackage[a4paper,left=4.5cm,right=3cm,top=2.5cm,bottom=2cm,includeheadfoot]{geometry}
% Header and footer
\fancyhf{}
\pagestyle{fancy}
\renewcommand{\sectionmark}[1]{\markboth{\thesection.\ #1}{}}
\renewcommand{\headrulewidth}{0.3pt}
\renewcommand{\footrulewidth}{0.3pt}
\chead{\small{\leftmark}}
\lfoot{\small{Author name}}
\rfoot{\small{\thepage}}
\begin{document}
\pagestyle{fancy}
\section{Section One}
\lipsum
\clearpage
\section{Section Two}
\lipsum
\end{document}
This of course leads to a pretty much standard outcome:
The closest thing I found in the fancyhdr documenatation are the thumb-indexes however I am not sure how to adapt them for this.
Is there an easy way to do this or would it require a lot of custom drawing with tikz?
I appreciate all hints.
Best Answer
Because of you are using the KOMA-Script class
scrartcl
I would suggest to usescrlayer-scrpage
insteadfancyhdr
. Then you can define and insert a new layer for the background of the pagenumber.Or you could add the black box to the layer of the
headsepline
and move this layer to the background:The result is the same as above.
Note, that the option
addcontents
was implemented in KOMA-Script version 3.16 (2015/02/07). So you need this or a newer version to run the second example.