4

At the moment I am working on a rather big project in which I typeset a lecture note for a professor of mine. I want to use the headsepline the KOMA Script Class offers, but I want it to have the same color as the headlinecolor I defined by adding

\renewcommand{\headfont}{\color{schrift}\normalfont\slshape} 

Is there a solution for this with KOMA Script means or do I have to define it myself (in a way I don't know as I don't really know how to do such things at all)?

Example:

\documentclass[oneside, twocolumn=false, 12pt, headsepline=true]{scrbook}
\usepackage[ngerman]{babel}
\usepackage[utf8x]{inputenc}
\usepackage{delarray, graphicx, url, fancybox, calc, cancel, caption, mathtools, amsmath, amssymb, wrapfig, subcaption, floatrow, amsthm, lipsum}
\usepackage[usenames,dvipsnames]{color}
\usepackage[margin={0.08\paperwidth,0.10\paperheight}, heightrounded]{geometry}

\usepackage[onlytext]{MinionPro}

\parindent 0pt
\parskip 6pt

\usepackage[pdftex, colorlinks=true,pdfstartview=FitB,bookmarks=false, urlcolor=schrift, linkcolor=schrift]{hyperref}
\hypersetup{
  colorlinks,
  linkcolor=schrift,
  linktoc=all
}

\makeatletter
\renewcommand{\l@section}{\@dottedtocline{1}{1.5em}{2.6em}}
\renewcommand{\l@subsection}{\@dottedtocline{2}{4.0em}{3.6em}}
\renewcommand{\l@subsubsection}{\@dottedtocline{3}{7.4em}{4.5em}}
\makeatother

\fboxrule0pt

\definecolor{rahmen}{RGB}{0,73,114}
\definecolor{grund}{RGB}{238,241,251}          
\definecolor{schrift}{RGB}{0,73,114}

\captionsetup{format=plain, labelfont={color=rahmen,bf}}

%\usepackage[nomath]{kpfonts}

\SetSymbolFont{letters}{normal}{OML}{cmbr}{m}{it}
\SetSymbolFont{operators}{normal}{OT1}{cmbr}{m}{n}
\SetSymbolFont{symbols}{normal}{OMS}{cmbr}{m}{n}

\DeclareMathAlphabet{\mathbf} {OT1}{cmbr}{bx}{n}

\setkomafont{disposition}{\color{schrift}\bfseries}

\renewcommand{\headfont}{\color{schrift}\normalfont\slshape}

\renewcommand{\labelitemi}{-}
\renewcommand{\labelitemii}{$\cdot$}
\renewcommand{\labelitemiii}{$\circ$}
\renewcommand{\labelitemiv}{$\bullet$}

\captionsetup{format=plain, labelfont={color=schrift,bf}}

\allowdisplaybreaks

\newcommand{\defeq}{\vcentcolon=}
\newcommand{\eqdef}{=\vcentcolon}

\hfuzz 100pt
\hbadness 10000

\renewcommand{\chapterheadstartvskip}{\vspace *{-\baselineskip }}

\begin{document}

\chapter{This is just some test chapter}

\lipsum[1]
\lipsum[2]
\lipsum[3]
\lipsum[4]
\lipsum[5]
\lipsum[6]

\lipsum[7]

\end{document}

My problem is this output which I want to be in matching color

Headlinesep by KOMA

The option [headlinesep] added to the KOMA Script class I am using adds a horizontal bar between header and the body of the page.

There has been help in the comments I should just use the \scrlayer-scrpage Style, as it offered all the functions I have been looking for. But it appeared, that there more errors to cope with - I'll post my test document code here. Everything that is important allready is in the code

\documentclass[twoside=false, twocolumn=false, 12pt, ngerman, headsepline=true]{scrbook}
\usepackage[ngerman]{babel}
\usepackage[utf8x]{inputenc}
\usepackage{delarray, graphicx, url, fancybox, calc, cancel, caption, amssymb, amsmath, mathtools, wrapfig, floatrow, amsthm, scrlayer-scrpage, lipsum}
\usepackage[usenames,dvipsnames]{color}

\usepackage[margin={0.08\paperwidth,0.10\paperheight}, heightrounded]{geometry}
\renewcommand{\chapterheadstartvskip}{\vspace *{-\baselineskip }}

\usepackage[frenchmath]{MinionPro}

\parindent 0pt
\parskip 6pt
%\baselinestretch

%\usepackage[nomath]{kpfonts}
%\SetSymbolFont{letters}{normal}{OML}{cmbr}{m}{it}
%\SetSymbolFont{operators}{normal}{OT1}{cmbr}{m}{n}
%\SetSymbolFont{symbols}{normal}{OMS}{cmbr}{m}{n}
%\DeclareMathAlphabet{\mathbf} {OT1}{cmbr}{bx}{n}

\setkomafont{disposition}{\color{schrift}\bfseries}
\setheadsepline{1pt}[\color{schrift}]
\renewcommand{\headfont}{\color{schrift}\normalfont\slshape}

\renewcommand{\labelitemi}{-}
\renewcommand{\labelitemii}{$\cdot$}
\renewcommand{\labelitemiii}{$\circ$}
\renewcommand{\labelitemiv}{$\bullet$}

\fboxrule0pt

\definecolor{rahmen}{RGB}{0,73,114}
\definecolor{grund}{RGB}{238,241,251}          
\definecolor{schrift}{RGB}{0,73,114}

\usepackage[pdftex, colorlinks=true,pdfstartview=FitB,bookmarks=false, urlcolor=schrift, linkcolor=schrift]{hyperref}

\captionsetup{format=plain, labelfont={color=rahmen,bf}}

\newcommand{\defeq}{\vcentcolon=}
\newcommand{\eqdef}{=\vcentcolon}

\hfuzz 40pt
\hbadness 10000

\renewcommand{\thefigure}{\arabic{chapter}.\arabic{section}.\arabic{subsection}}

\addto\captionsngerman{
\renewcommand{\figurename}{Aufgabe}}

\parskip 6pt
\parindent 0pt

\makeatletter
\let\stdl@section\l@section
\renewcommand*{\l@section}[2]{%
  \stdl@section{\textcolor{black}{#1}}{\textcolor{black}{#2}}}
\let\stdl@subsection\l@subsection
\renewcommand*{\l@subsection}[2]{%
  \stdl@subsection{\textcolor{schrift}{#1}}{\textcolor{black}{#2}}}
\makeatother

\deftripstyle{versionheading}[][1pt]%
{22.08.2014}{\headmark}{}%
{}{\pagemark}{}

\allowdisplaybreaks

\begin{document}

\chapter{This is just some testing chapter}

\lipsum[1]
\lipsum[2]
\lipsum[3]
\lipsum[4]
\lipsum[5]
\lipsum[6]
\lipsum[7]

\paragraph{Error Prompt 1}

\begin{verbatim}
    Package scrlayer-scrpage Warning: Command \deftripstyle is deprecate.
(scrlayer-scrpage) You should replace it by \deftriplepagestyle,
(scrlayer-scrpage) e.g., on input line 64.
\end{verbatim}

But when I do as the error prompt is telling me, it says the command was undefined.

\end{document}

It now prints the headsepline in the color I desired but the defined pagestyle doesn't work which is why I cant adjust the thickness of the headsepline even though it is shown exactly like this in the KOMA Manual.. Please help me, I have no clue whats going on there! I hope anyone here knows how to deal with the errors because I am completely lost.

The Code produces this:

output of examplecode 2

12
  • \newcommand{\generalheadcolor}{schrift} and use \generalheadcolor in both cases?
    – user31729
    Aug 22, 2014 at 12:41
  • Please help us to help you and add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}.
    – user31729
    Aug 22, 2014 at 12:41
  • @ Christian Hupfer I am sorry for having not added an example, I thought there might have been somebody out there who knew the problem - but after thinking about it its of course the better solution because everyone can have a look at the problem now without having to read manuals to see what I mean.
    – Friedrich
    Aug 22, 2014 at 12:54
  • Well, thanks for MWE. As far as I know, the KOMA classes do not store the colours for particular elements of the layout commands.
    – user31729
    Aug 22, 2014 at 12:57
  • 1
    If you design your headers and footers using KOMA-Script's scrlayer-scrpage then you could use \setkomafont{headsepline}{\color{whatever}}
    – cgnieder
    Aug 22, 2014 at 14:53

1 Answer 1

4

I took the liberty to write up an answer, making your very large example into a minimal one. As @cgnieder stated in the comments, package scrlayer-scrpage defines an interface for defining page headers and footer; mostly compatible with scrpage2. Mostly, what does that mean? You received a warning, telling you that the command deftripstyle is deprecated. True, it is. But it gives you an alternative, and looking into the KOMA-documentation reveals: You can just change the command name. But using this is not recommended any more and is just there for compatibility reasons.

Is there any reason for making the document look like the standard W0rd stuff? You should also consider using the class scrreprt. @cgnieder made you aware of some other oddities in the comments.

Be careful, you are loading packages twice.

\documentclass{scrreprt}
\usepackage{blindtext}
\usepackage{xcolor}
\usepackage[headsepline,automark]{scrlayer-scrpage}
\addtokomafont{headsepline}{\color{blue}}
\KOMAoptions{headsepline=10pt:\textwidth}
\renewcommand{\headfont}{\color{blue}\normalfont\slshape}
\newcommand{\versiondate}{\today}
\deftriplepagestyle{draftpages}[5pt]
{\versiondate}{\headmark}{}
{Draft}{\pagemark}{}
\begin{document}
\blinddocument
\clearpage
\pagestyle{draftpages}
\blinddocument
\end{document}
3
  • Thank you very much for your answer, I hope to tidy up my preamble soon, any suggestion is appreciated - eMail would be "friedrich-(at)hotmail.de"
    – Friedrich
    Aug 24, 2014 at 10:11
  • What suggestions do you mean exactely?
    – Johannes_B
    Aug 24, 2014 at 10:13
  • Concerning the "oddities", I'm very aware of having some in my code but the KOMA Documentation alone is one big piece of text to go through which I am planning to do for sure, but that is going to take some time...
    – Friedrich
    Aug 24, 2014 at 12:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.