Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Suppose you have a two-sided document. The even page's header contains the title of the current chapter; the odd page's header contains the title of the current section. Nothing too fancy, and pretty easily done using the scr* classes and scrpage2.

\documentclass[paper=a5,headinclude=true,pagesize,twoside=true]{scrreprt}
\usepackage[automark]{scrpage2}
\usepackage{blindtext}

\pagestyle{scrheadings}

\begin{document}
\chapter{Chapter one}
%\renewcommand*{\sectionmarkformat}{} %removes section number
%\sectionmark{\thechapter\enskip Chapter one} %sets odd header
\Blindtext\Blindtext\Blindtext\Blindtext
\section{Section one}
\Blindtext\Blindtext\Blindtext\Blindtext
\end{document}

everything in its right place

Things get difficult in the introductory passages of chapters. Say you have three or more pages of text at the beginning of a chapter before the first \section starts, which is something I do quite often to provide readers with some signposting. Now, in the above setup, the odd page headers will remain empty, which is what you'd expect, but I'd like to change it -- so the odd page header will have the chapter's title until a section is available.

I do know how to manually modify \sectionmark, which I can use to insert anything I want. See the two comment lines in the MWE. But of course you'd usually want a more automated solution. For example, is there a way to ›grab‹ the current chapter title and pass it on to \sectionmark? I tried

\sectionmark{\leftmark},

too, but to no avail. Thanks in advance!

share|improve this question
    
@cgnieder works great! Feel free to turn this into an official answer. –  Nils L Mar 12 '13 at 8:19
add comment

1 Answer

up vote 2 down vote accepted

Short idea: set \chaptermark to write both headers. The next call of \section will set its headers again. So something like

\renewcommand*\chaptermark[1]{%
  \markboth
    {\MakeMarkcase{\chaptermarkformat#1}}
    {\MakeMarkcase{\chaptermarkformat#1}}}

should do.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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