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.

I'm using the following document structure based on KOMA script classes and styles

\documentclass[11pt,a4paper,BCOR10mm,DIV11,toc=listof]{scrbook}
\usepackage[nouppercase,headsepline]{scrpage2}
\pagestyle{scrheadings}
\clearscrheadfoot
\automark[section]{chapter}
\chead{\headmark}

(plus some more stuff I'm not listing here). This works very well in general. But I do have an unnumbered chapter like this

  \addcontentsline{toc}{chapter}{Bla bla}
  \chapter*{Bla bla}

and I want its title (no number) to appear in the heading of right pages (left pages blank as there are no numbered sections in this chapter). As was to be expected, this does not work out of the box, it currently lists the name of the previous chapter (list of figures).

How can I make it work? Would a manually issued \markboth{}{Bla bla} be the right way to go? From the KOMA script documentation I'm not quite sure how that would interfere with the automark stuff.

share|improve this question

2 Answers 2

up vote 5 down vote accepted

With the KOMA-Script classes scrbook and scrreprt you can use \chaptermark{...}, \sectionmark, \chaptermarkformat{...}, \sectionmarkformat{...} to set and format the running headings. A little example:

\documentclass[11pt,a4paper,BCOR10mm,DIV11,toc=listof]{scrbook}
\usepackage[nouppercase,headsepline]{scrpage2}
\pagestyle{scrheadings}
\clearscrheadfoot
\automark[section]{chapter}
\chead{\headmark}
\usepackage{lipsum}

\begin{document}

\chapter{A numbered chapter}
\section{Test section}
\lipsum[1-5]
\chapter*{A chapter without number}
\renewcommand*{\chaptermarkformat}{}
\renewcommand*{\sectionmarkformat}{}
\chaptermark{}
\sectionmark{A chapter without number}
\lipsum[1-30]

\end{document}
share|improve this answer
    
Ok. That's definitely going into the right direction. However, the \renewcommand*{\chaptermarkformat}{} part does also kill numbering and formats for all subsequent chapters and sections. Is there a way to prevent this? –  janitor048 Mar 27 '11 at 21:34
1  
You can keep the changes local by enclosing the affected chapter and its contents inside a pair of braces. –  Gonzalo Medina Mar 27 '11 at 21:36
    
Damn! Of course.. Could have thought of this myself. It's getting late.. Thanks a lot! –  janitor048 Mar 27 '11 at 21:41
    
Thanks a lot for mentioning \chaptermark. For one of my pages \ohead{Appendix} did not work, writing the wrong chapter name. Finally got it to work! –  user2366975 Aug 22 '14 at 8:21

The KOMA-script classes also has the command \addchap instead of \chapter*. Using \addchap should correct the problem of misnamed headers. This command also automatically creates a ToC entry so \addcontentsline{toc}{chapter}{...} isn't needed anymore.

See the MWE modified from above using the KOMA-script class native commands.

\documentclass[11pt,a4paper,BCOR10mm,DIV11,toc=listof]{scrbook}
\usepackage[nouppercase,headsepline]{scrpage2}
\pagestyle{scrheadings}
\clearscrheadfoot
\automark[section]{chapter}
\chead{\headmark}
\usepackage{lipsum}

\begin{document}

\chapter{A numbered chapter}
\section{Test section}
\lipsum[1-5]
\addchap{A chapter without number}
\addsec{A chapter without number}
\lipsum[1-30]

\end{document}
share|improve this answer
    
This should indeed work out of the box and also since it automatically creates a ToC entry \addcontentsline{toc}{chapter}{...} wouldn't be needed anymore. BTW: \addchap is used without star: \addchap{...} instead of \chapter*{...} –  clemens May 25 '13 at 10:28
    
Exactly! I have updated the answer to reflect that. –  jjewell May 25 '13 at 10:33
    
Maybe you could aslo add a small example like Gonzalo did in his answer. You could even use his example and replace the four lines including \chapter*{A chapter without number} with \addchap{A chapter without number}. (IMHO this is the right answer for the question as it uses KOMA's tools that are made for the task.) –  clemens May 25 '13 at 10:51
    
Thanks a lot for the feedback on my answer. This was the first question I could contribute to since I started Tex this year :). Great to have the feedback on making more useful answers. –  jjewell May 25 '13 at 13:04

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.
http://tex.stackexchange.com/questions/14379/koma-script-page-heading-for-unnumbered-chapter-vs-automark
tex.stackexchange.com
crawl=CC-MAIN-2015-35
82121
application/http; msgtype=response
sha1:UVTOE4AEWA7PVHOQ2EYJ66NKRLBXUGBC
<urn:uuid:c07e6bd1-d7fb-4559-9285-1b3a8fb83e88>
2015-09-04T08:00:42Z
104.16.14.128
sha1:YINHYEHXLJ6DGXMVPY2TTU6H2QZDC7OS
<urn:uuid:bdfa4255-ffd1-43bb-922c-7426f8dc7457>
http://tex.stackexchange.com/questions/14379/koma-script-page-heading-for-unnumbered-chapter-vs-automark
length
response
<urn:uuid:1d6f45fe-4d09-42a9-94a8-3c6c00d2efc0>
robots: classic
hostname: ip-10-171-96-226.ec2.internal
software: Nutch 1.6 (CC)/CC WarcExport 1.0
isPartOf: CC-MAIN-2015-35
operator: CommonCrawl Admin
description: Wide crawl of the web for August 2015
publisher: CommonCrawl
format: WARC File Format 1.0
conformsTo: http://bibnum.bnf.fr/WARC/WARC_ISO_28500_version1_latestdraft.pdf