## LaTeX forum ⇒ Page Layout ⇒ Fancyhdr with a KOMA-scipt class Topic is solved

Information and discussion about page layout specific issues (e.g. header and footer lines, page formats, page numbers).
Cham
Posts: 894
Joined: Sat Apr 02, 2011 4:06 pm

### Fancyhdr with a KOMA-scipt class

I'm using the fancyhdr package to modify the header and footer of several KOMA-script classes (scrbook, scrartcl, scrreprt). Everything compiles fine and the output is really nice. I'm only getting a single warning in the console (shown below).

However, I know it's not recommended to use fancyhdr with a KOMA class document since the KOMA classes already have built-in features to modify the header and footer. So I have two questions :

1. What are the wrong things that could happen or what should I expect if I still use the fancyhdr package with a KOMA class document ?

2. What should be the proper code to replace the fancyhdr code shown below, if I really have to scrap that package ?


Here's the warning I get :
Class scrartcl Warning: Usage of package fancyhdr' together
(scrartcl) with a KOMA-Script class is not recommended.
(scrartcl) I'd suggest to use
(scrartcl) package scrlayer-scrpage'.
(scrartcl) Nevertheless, using requested
(scrartcl) package fancyhdr' on input line 9.

So how should I replace the fancyhdr code ?

Johannes_B
Site Moderator
Posts: 3853
Joined: Thu Nov 01, 2012 4:08 pm
Just keep on. Your system is outdated anyway.

\documentclass[11pt,twoside,headsepline]{scrartcl}\usepackage[T1]{fontenc}\usepackage{lmodern}\usepackage[left=1in,right=1in,top=0.5in,bottom=0.5in,includehead,includefoot]{geometry}%%%% How to replace the following for a KOMA class document?\usepackage[page]{totalcount}\usepackage{scrlayer-scrpage}\ohead{Fu with LaTeX}\chead{center}\ihead{inner}\cfoot{center}\ofoot{page \thepage~of \totalpages}\ifoot{Useless text at bottom}\setlength{\headheight}{14pt}%%%%\begin{document} \title{Title}\author{Isaac Newton}\date{}\maketitle\tableofcontents\section{Introduction} Some introduction text for fun.\newpage\section{A title} Some lazy text.\newpage\section{Another title} Some annoying text.\newpage\section*{Thank you} Thanks all!\newpage\begin{thebibliography}{999}\bibitem{bibitem1}\uppercase{Some one}, \par \textit{Title}, \par Found.\ Phys.\  \textbf{47}, no. 6, 797 (2000).\bibitem{bibitem2}\uppercase{Some guy}, \par \textit{Title}, \par Phys.\ Rev.\ D \textbf{65}, 103522 (2017).\end{thebibliography}  \nonfrenchspacingCompare.\ this\parCompare. that \end{document}

Looking at the KOMA-script manual would have helped you.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.

Cham
Posts: 894
Joined: Sat Apr 02, 2011 4:06 pm
What do you mean by "Your system is outdated anyway." ? Could you be more specific?

Johannes_B
Site Moderator
Posts: 3853
Joined: Thu Nov 01, 2012 4:08 pm
You have TeX Live 2015 installed. There have been many updates to LaTeX and contributed packages. The nag warning about fancyhdr is only there, because fancyhdr wasn't updated yet. scrlayer-scrpage should be in a solid state by TL 2015, but i am not sure.
LaTeX itself, the basic LEGO set, was updated in the meantime.

The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.

Cham
Posts: 894
Joined: Sat Apr 02, 2011 4:06 pm
This is why I'm changing the fancyhdr code to the KOMA version, in my KOMA-script templates. (it's all working great, by the way).

I'm now getting a last strange message in the console :

(scrreprt) deprecated in KOMA-Script v3.01 2008/11/14 and
(scrreprt) has been replaced by several more flexible
(scrreprt) features of package tocbasic.
(scrreprt) Since Version 3.12 support for deprecated
(scrreprt) restricted to only some of the KOMA-Script
(scrreprt) features and been removed from others.
(scrreprt) avoid this warning, if you are using a
(scrreprt) a package that still implements the

How should I interpret that? What is causing that, and is there something to fix? How?

EDIT :

Thanks for the link. Do you consider fancyhdr as an obsolete package?

Johannes_B
Site Moderator
Posts: 3853
Joined: Thu Nov 01, 2012 4:08 pm

Fancyhdr is not obsolete, it is just not recommended with KOMA-script.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.

Cham
Posts: 894
Joined: Sat Apr 02, 2011 4:06 pm
scrhack is one such mysterious package to me ! The documentation I've found is pretty obscure/weird to me! (it's even almost insulting to some packages authors!)

It removes the curious message I've shown above from my console, and the whole compiled document stays the same. What is the purpose of that esoteric package? I'm afraid it's a kind of superfluous "hack" (scrhack = script hack) !

Johannes_B
Site Moderator
Posts: 3853
Joined: Thu Nov 01, 2012 4:08 pm
While LaTeX evolved over the years, some packages didn't speed up. scrhack makes some extra LEGO brick sets compatible to LaTeX itself or KOMA-script.
The package exists, because some package maintainers never made an update becuase of various reasons.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.

Stefan Kottwitz
Posts: 9088
Joined: Mon Mar 10, 2008 9:44 pm
The KOMA-Script author is often a bit harsh.

Via the scrhack package, he ensures compatibility and avoids issues with other packages. Consider it as a service for KOMA-Script users.

Stefan