Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Redefining running headings

28 views
Skip to first unread message

Andreas Keil

unread,
Apr 29, 2010, 10:28:53 AM4/29/10
to
Dear all,

I would like to change the running heading defined in \leftmark and
\rightmark. Specifically, I'd like to add a period, dash, or some
extra space in between the chapter/section number and its title:

Chapter 3 My Chapter Title -> Chapter 3 - My Chapter Title

Is a redefinition of \leftmark and \rightmark the right way to do
this? If yes, how could I do this? / How are these commands defined
by default? If no, what's the proper way to redefine the running
headings?

Note that I am using KOMA-Script (scrbook.cls) and would also
appreciate any comments on how to achieve this there (although I
have the impression that this is a general LaTeX question since
\left/rightmark are defined by LaTeX).

Thanks a lot,
Andreas.

--
For replying by e-mail, please remove the fruit
as well as the .invalid TLD from my address.

Tariq

unread,
Apr 29, 2010, 10:36:33 AM4/29/10
to
On Apr 29, 10:28 am, Andreas Keil

As far as I know, fancyhdr package gives you control (at user level,
which is probably what you want) for such customization. The
documentation is pretty good although I have not been able to make
much sense of the way this \leftmark, \rightmark mechanism actually
works. Once you get going, someone can help you sort out any minor
glitches if there are any. Good luck. Regards,

Tariq

Lars Madsen

unread,
Apr 29, 2010, 11:16:17 AM4/29/10
to
Andreas Keil wrote:
> Dear all,
>
> I would like to change the running heading defined in \leftmark and
> \rightmark. Specifically, I'd like to add a period, dash, or some
> extra space in between the chapter/section number and its title:
>
> Chapter 3 My Chapter Title -> Chapter 3 - My Chapter Title
>
> Is a redefinition of \leftmark and \rightmark the right way to do
> this? If yes, how could I do this? / How are these commands defined
> by default? If no, what's the proper way to redefine the running
> headings?
>
> Note that I am using KOMA-Script (scrbook.cls) and would also
> appreciate any comments on how to achieve this there (although I
> have the impression that this is a general LaTeX question since
> \left/rightmark are defined by LaTeX).
>
> Thanks a lot,
> Andreas.
>

you need to change the data given to \leftmark and \rightmark, do NOT
change \leftmark or \rightmark, they are data providers used in the headers.

You need to change the mark generators. For each sectional macro
(\chapter, section and such) there is an associated mark generator, e.g.
\chaptermark, you will need to change this. I would assume that KOMA
have some interface for this.

If you where using the memoir class, and say you've made a page style
called 'mystyle', then it would be as simple as

\makeatletter % because of \@chapapp
\addtopsmarks{mystyle}{
\createmark{chapter}{both}{shownumber}{\@chapapp\ }{\ --\ }
}
\makeatother
\pagestyle{mystyle}


--

/daleif (remove RTFSIGNATURE from email address)

LaTeX FAQ: http://www.tex.ac.uk/faq
LaTeX book: http://www.imf.au.dk/system/latex/bog/ (in Danish)
Remember to post minimal examples, see URL below
http://www.tex.ac.uk/cgi-bin/texfaq2html?label=minxampl
http://www.minimalbeispiel.de/mini-en.html

Andreas Keil

unread,
Apr 29, 2010, 11:28:46 AM4/29/10
to
Tariq wrote:

> On Apr 29, 10:28�am, Andreas Keil
> <andreas.k...@banana.fantasymail.de.invalid> wrote:
>> Dear all,
>>
>> I would like to change the running heading defined in \leftmark and
>> \rightmark. Specifically, I'd like to add a period, dash, or some
>> extra space in between the chapter/section number and its title:
>>
>> � Chapter 3 My Chapter Title -> Chapter 3 - My Chapter Title
>>
>> Is a redefinition of \leftmark and \rightmark the right way to do
>> this? If yes, how could I do this? / How are these commands defined
>> by default? If no, what's the proper way to redefine the running
>> headings?
>>
>> Note that I am using KOMA-Script (scrbook.cls) and would also
>> appreciate any comments on how to achieve this there (although I
>> have the impression that this is a general LaTeX question since
>> \left/rightmark are defined by LaTeX).
>>
>> Thanks a lot,
>> Andreas.
>>
>

> As far as I know, fancyhdr package gives you control (at user level,
> which is probably what you want) for such customization. The
> documentation is pretty good although I have not been able to make
> much sense of the way this \leftmark, \rightmark mechanism actually
> works. Once you get going, someone can help you sort out any minor
> glitches if there are any. Good luck. Regards,
>
> Tariq

Ah, I found a solution. Just haven't looked in the right part of the
KOMA-Script documentation yet:
\renewcommand*{\chaptermarkformat}{\chapapp~\thechapter~-- }
\renewcommand*{\sectionmarkformat}{\thesection~-- }
should do the job :-)

Sorry for bothering you...

Andreas

Lars Madsen

unread,
Apr 29, 2010, 11:34:12 AM4/29/10
to


then what happens if you are using a \chapter inside \frontmatter?

Usually this switches of numbering, but your provider still inserts
\thechapter (which is zero)

Andreas Keil

unread,
Apr 29, 2010, 11:47:07 AM4/29/10
to
Lars Madsen wrote:

I am not using \chapter inside \frontmatter but the alternative
command \addchap*{My Chapter Title}. This is provided by KOMA-Script
for the purpose of neither adding the chapter to the TOC nor
printing running headings.

Lars Madsen

unread,
Apr 29, 2010, 12:02:19 PM4/29/10
to

in memoir this is done automatically

0 new messages