# Using ornaments from pgfornament in KOMA Script as headsepline

I want to use an ornament from the pgfornaments package as the headsepline in a KOMA-Script scrbook. A minimal working example of my document would be something like:

\documentclass[a4paper,ngerman,headsepline, BCOR=5mm, numbers=noenddot, sort&compress]{scrbook}
\usepackage[T1]{fontenc}
\usepackage[latin9]{inputenc}

\setkomafont{sectioning}{\bfseries} % Serifen und Überschriften
\setkomafont{descriptionlabel}{\bfseries}

\begin{document}
some lorem here
\end{document}


So is there a way to "replace" or renew the headsepline option to draw an ornament (like ornament #88 from pgfornaments) to use as header?

I searched for ornament options here, but I didn't find any with specific mentioning of using it as a header separator line and the documentation of pgfornaments also didn't really help me either. There is a mention of designing own heads in KOMA Script here: How to change \headsepline color in KOMA-Scriptclasses , but to be honest, I am not experienced enough in LaTeX to have an idea on hjow to start.

To clarify as to what I want to achieve (that doesn't look horribly uggly): I have three options in mind to try out whether they work (although only one option per document. SO I won't interchange them inside a single document)

1. Have the horizontal header separator line be interrupted in the center with an ornament like pgfornament #12 and therefore make the header separator line just a tiny bit more fancy

2. Maybe have both outer end of the header separator line be "finished" with eg ornament #21 as the left end and ornament #23 as the right end of the line.

3. Or approach it per left/right page and have the outer end of the line (on a right page, the right side and on the left page the left side) and only on the outer sides end the line with ornaments like in the second option of this list

Edit: My current code thatnks to Keks Dose is the following (although it doesn't account for the space introduced by headsepline usually) and probably ugly:

\documentclass[a4paper,ngerman]{scrbook}
\usepackage[T1]{fontenc}
\usepackage[latin9]{inputenc}
\usepackage{scrlayer-scrpage}
\usepackage{pgfornament, blindtext}
\usepackage{showframe}

\setkomafont{sectioning}{\bfseries} % Serifen und Überschriften
\setkomafont{descriptionlabel}{\bfseries}

\raisebox{-3mm}{
\rule{0.4\linewidth}{0.2mm}%
\pgfornament[width=2mm]{13}
\rule{0.4\linewidth}{0.2mm}}
}

\automark[chapter]{chapter}

\automark*[section]{}

\begin{document}
\blinddocument
\chapter{more blindtext with a very very very long name}
\blindtext[12]

\end{document}


My code also doesn't yet rotate the ornament by 90 ° and also doesn't correctly set the width of the rules, but I'm working on it.

Current status:

• I think this could work with the new package scrlayer-scrpage. – Johannes_B Sep 1 '14 at 13:16
• ok, but how would I approach this? The linked response from cgnieder mentiones scrlayer-scrpage, but how to implement? I am sadly not that tex-savvy, do you have a code snippet maybe? – Hug Sep 1 '14 at 13:18
• It's a bit more complicated here. Just wait a bit, somebody will find a solution. I am going to take a look myself. – Johannes_B Sep 1 '14 at 13:20
• didn't mean to be impatient. Thank you very much! – Hug Sep 1 '14 at 13:20
• @Johannes_B do you think I can add more info or specifics to the question to increase likelyhood of an answer? – Hug Sep 4 '14 at 16:33

Maybe my solution is pretty simple, but I'd start here:

\documentclass[a4paper,ngerman, headheight=3ex]{scrbook}
\usepackage[T1]{fontenc}
\usepackage[latin9]{inputenc}
\usepackage{scrlayer-scrpage}
\usepackage{pgfornament, blindtext}

\setkomafont{sectioning}{\bfseries} % Serifen und Überschriften
\setkomafont{descriptionlabel}{\bfseries}

\pgfornament[width=\textwidth]{88}}
\automark[chapter]{chapter}

\begin{document}
\blinddocument

\end{document}

• +1 from my side, this is the simplest solution. But i wanted to learn something about the internals. Very interesting package ;-) – Johannes_B Sep 5 '14 at 16:07
• @Johannes_B The package author will give a speech on September 20th in Karlsruhe at the semiannual Dante meeting, about scrlayer. See here: dante.de/events/Herbst2014/Programm.html Please register and come! – Keks Dose Sep 5 '14 at 20:02
• I'd like to meet him in person, but i cannot make it to the meeting this year. Maybe next year and we have a drink with Elke. ;-) – Johannes_B Sep 5 '14 at 20:06
• @KeksDose So I am trying to understand both answers at the moment, but I'll try to understand this one first as it seems easier. ;-) Where can I find the documentation for commands like "\automark" and "\headmark"? Your solution also seems to dismiss the previous formatting of header being dependent on which side of the document it is and left/right orientation. – Hug Sep 6 '14 at 13:01
• Things like \headmark and \automark are described in every LaTeX introduction. The solution above uses them as well, as they are the standards, and don't get touched. You should also have a look at the KOMA-script documentation. Don't be scared, it is a whole lot of information. – Johannes_B Sep 6 '14 at 13:28

I never used the internals of package scrlayer and i am pretty sure there is a much better way. For example using the higher level interface of package scrlayer-scrpage.

Here is a first draft and i looks pretty ugly:

%\RequirePackage{filecontents}
\begin{filecontents}{\jobname.sty}
\ProvidesPackage{\jobname}[2014/09/05 v 0.1  pgfornaments
and scrlayer-scrpage]
\RequirePackage{pgfornament}
\RequirePackage{scrlayer-scrpage}
\RequirePackage{etoolbox}
\newcommand{\JB@ornament}{%
\pgfornament{88}%
}
\DeclareLayer[%
background,%
height=0pt,%
align=tl,%
contents={%
\JB@ornament
}}}
}%
}
\endinput
\end{filecontents}

\documentclass{scrbook}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{blindtext}
\usepackage{showframe}
\usepackage{\jobname}

\setkomafont{sectioning}{\bfseries}
\setkomafont{descriptionlabel}{\bfseries}

• Yes, a package is created just because @ signs are treated as letters there. If you want to go with that solution, you might need to add stuff and using a package, the preamble does not get littered. I wanted to implement options at the beginning, to keep the package as flexible as possible, but i think there really is no need for it as including an ornament can be very easily done using @Keks approach. If you want to change the ornament, change the definition of \JB@ornament. – Johannes_B Sep 6 '14 at 13:24