6

I'm writing a document using scrbook document class and while I was able to set up all header and footer apparence, I can't find a way to set headsepline length (seems to follow \textwidth settings, while I need it to be slightly longer). Is there a way to make it without using external packages, maybe changing something in class file?

1 Answer 1

4

As lockstep remarked, my short answer was way to short, so here's a more elaborate one:

Setting the headsepline can be done with the scrpage2 package, which provides the macro

\setheadsepline[<length>]{width}

To be able to use a notation like \textwidth+20pt, e.g. to do calculations, you'll need e.g. the calc package. The scrpage2 package also provides a new pagestyle (scrheadings), I made a little example below: The pageheads automatically alternate between the current chapter and section headings. Also you can see that the headsepline is longer than the headtopline. It protudes on both left and right, I don't know if you want that or just one side.

The code

\documentclass{scrbook}
\usepackage[inner=10mm,outer=30mm,top=30mm,bottom=10mm,a4paper,twoside]{geometry}
\usepackage{calc}

\usepackage{lipsum}

\usepackage{scrpage2}
\pagestyle{scrheadings}
\clearscrheadfoot
\automark[chapter]{section}
\ohead{\pagemark}
\ihead{\headmark}
\setheadtopline{1pt}
\setheadsepline[\textwidth+20pt]{0.5pt}

\begin{document}

\chapter{One}
\lipsum[1]
\section{one}
\lipsum[2]
\section{two}
\lipsum[3]
\section{three}
\lipsum[4]
\section{four}
\lipsum[5]
\section{five}
\lipsum[6]
\section{six}
\lipsum[7]
\section{seven}
\lipsum[8-12]

\chapter{Two}
\lipsum[1]
\section{one}
\lipsum[2]
\section{two}
\lipsum[3]
\section{three}
\lipsum[4]
\section{four}
\lipsum[5]
\section{five}
\lipsum[6]
\section{six}
\lipsum[7]
\section{seven}
\lipsum[8-12]

\end{document}

Part of the result

enter image description here

3
  • thank you very much, I loaded scrpage2 but tought \setheadsepline would work only for line height.
    – Gianluigi
    Sep 2, 2012 at 18:13
  • @Gianluigi: You're welcome. Thats what I love about this site: there's usually someone around who knows the answer or can think of away to do it. Sep 2, 2012 at 19:41
  • @Gianluigi don't forget to accept (different from up-vote) Tom Bombadil's answer (and any answer that solves the problem in your other questions) by clicking on the check-mark to the left of the answers; in case of doubt, please see How do you accept an answer?. Sep 2, 2012 at 23:22

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .