I'd like to modify the contents of my headers and footers - e.g., to display the current chapter and/or section title or to change the pagination alignment. How can I do that? I've noticed the packages fancyhdr and scrpage2 (part of the KOMA-Script-bundle) - are they interchangeable, or are there situations where I should prefer one package to the other?
- 250,273
2 Answers
fancyhdris the classical package. The last change has been Version 4.1 2022-11-09.scrpage2has been available for years but is also developing currently together with the modernKOMA-scriptclasses. Naturally it is better integrated with those classes but it may be used with other classes as well.
fancyhdr provides a head rule and a foot rule, but scrpage2 offers head top line, head separation line, foot separation line and foot bottom line.
scrpage2 comes with a sophisticated interface to specify own styles, beginning with a simple \deftripstyle taking 9 parameters complemented by an expert interface: \defpagestyle, \newpagestyle, \renewpagestyle and \providepagestyle, see documentation.
To ease work with different styles scrpage2 reads and processes a file scrpage.cfg where several styles for many projects might be defined.
So, I would prefer scrpage2 if it's available. I'm sure it can replace fancyhdr. The latter package might be preferred if the requirements aren't too sophisticated and quick learning is expected.
Note: if you use fancyhdr and geometry, load geometry first.
- 3,848
- 231,401
Since November 2011, there's a third package dedicated to customizing headers and footers: titleps by Javier Bezos (the author of enumitem, titlesec, and titletoc). Package description:
The package provides page styles with a simple one-stage mechanism, including top marks; access to top-, first- and botmarks in a single header/footer; headers/footers for specific floats; multiple sets of marks (with e-TeX), and more.
Note that the features listed in titleps' description aren't available in fancyhdr and scrpage2.
- 250,273
\iffloatpage, a one-liner that might be used with scrpage2 as well:\providecommand{\iffloatpage}[2]{\if@fcolmade #1\else #2\fi}. – Stefan Kottwitz Aug 07 '10 at 00:00scrlayer-scrpagereplaces the oldscrpage2"? – Tobias Kienzler Jun 24 '15 at 08:11scrlayer-scrpageinstead ofscrpage2? – Werner Jan 14 '16 at 19:48