With class option headsepline
there will be a line below of the header when page style headings
is used. With class option footsepline
the line above the footer is printed with both page style headings
and page style plain
. Note that these class options set also the typearea
options headinclude
and footinclude
.
But you are loading package scrlayer-scrpage
and this package has its own options headsepline
and footsepline
. They also have a different syntax: Using them you can also set a width and a length to the lines. But without any values they simple activate the lines with .4pt width and the same length as header/footer.
While \documentclass
passes the options to the packages options set with \LoadClass
are not seen by the packages. So scrlayer-scrpage
does not know that there should be lines below header and above footer. So you have to set the options explicitly for scrlayer-scrpage
.
\begin{filecontents*}{myclass.cls}
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{myclass}[2016/02/21 My Class]
\RequirePackage{fix-cm}
\LoadClass[
numbers=noenddot,
captions=tableheading,
listof=totoc,
bibliography=totoc,
fontsize=10.5pt,
toc=flat,
DIV=calc
]{scrartcl}
\KOMAoptions{
headinclude,
footinclude
}
\recalctypearea
\RequirePackage[headsepline,footsepline]{scrlayer-scrpage}
\end{filecontents*}
\documentclass{myclass}
\usepackage{blindtext}% dummy text
\clearpairofpagestyles
\ihead{Header Text}
\begin{document}
\tableofcontents
\blinddocument
\end{document}
or
\begin{filecontents*}{myclass.cls}
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{myclass}[2016/02/21 My Class]
\RequirePackage{fix-cm}
\LoadClass[
numbers=noenddot,
captions=tableheading,
listof=totoc,
bibliography=totoc,
fontsize=10.5pt,
toc=flat,
DIV=calc
]{scrartcl}
\RequirePackage{scrlayer-scrpage}
\KOMAoptions{
headsepline,
footsepline
}
\recalctypearea
\end{filecontents*}
\documentclass{myclass}
\usepackage{blindtext}% dummy text
\clearpairofpagestyles
\ihead{Header Text}
\begin{document}
\tableofcontents
\blinddocument
\end{document}
Some remarks:
I have replaced the old command \clearscrheadfoot
by \clearpairofpagestyles
. Loading scrlayer-scrpage
already activates pagestyle scrheadings
. Note that this package also redefines headings
and plain
as aliases of scrheadings
and plain.scrheadings
.
Note that there is no DIV value predefined for fontsize=10.5pt
and the default paper size a4. So you will get a warning that DIV=1
is used. That means a good DIV
value will be calculated. To avoid this warning I set DIV=calc
explicitly.
In the first example I have used
\KOMAoptions{
headinclude,
footinclude
}
\recalctypearea
because the class options headsepline
and footsepline
sets the typearea
options headinclude
and footinclude
. But if I use headsepline
and footsepline
as package options for scrlayer-scrpage
I have to set the options headinclude
and footinclude
for typearea
explicitly. The command \recalctypearea
recalculates the page layout taking these options into account.
In the second example with
\usepackage{scrlayer-scrpage}
\KOMAoptions{
headsepline,
footsepline
}
\recalctypearea
headsepline
and footsepline
are used for both the package scrlayer-scrpage
and the KOMA-Script class. So headinclude
and footinclude
are set automatically. But I have to use \recalctypearea
too to recalculate the page layout.
If you do not want to set the typearea
options headinclude
and footinclude
use headsepline
and footsepline
only as package options for scrlayer-scrpage
.
\ifoot{footer}
– egreg Feb 21 '16 at 15:29