5

I am writing a report. I set \pagestyle{headings} which looks well, but formats the chapter in italics instead of normalfont. How can I change this to normalfont or boldfont, without using fancyhdr?


Here is an example how it looks:

KAPITEL 5. INSTALLATION UND BENUTZUNG                             26

And here is an example how it should look:

KAPITEL 5. INSTALLATION UND BENUTZUNG                             26

3
  • 1
    Why is fancyhdr to be avoided?
    – egreg
    Jun 4, 2011 at 15:34
  • 1
    Welcome to tex.sx! A tip: you can use backticks ` to mark your inline code.
    – doncherry
    Jun 4, 2011 at 15:38
  • @egreg Minimalism. Jun 4, 2011 at 15:53

2 Answers 2

2

You have to modify the internal heading definition. Do you use the option twoside? Please provide a minimal example.

The solution for onside:

\documentclass{report}
\makeatletter
\def\ps@headings{%
    \let\@oddfoot\@empty
    \def\@oddhead{\bfseries{\rightmark}\hfil\thepage}%
    \let\@mkboth\markboth
    \def\chaptermark##1{%
      \markright {\MakeUppercase{%
        \ifnum \c@secnumdepth >\m@ne
            \@chapapp\ \thechapter. \ %
        \fi
        ##1}}}
}
\makeatother
\pagestyle{headings}

\begin{document}
\setcounter{chapter}{4}
\chapter{Installation und Benutzung}
\clearpage
\mbox{}
\end{document}

You are writing in German. You should use a KOMA class like scrreprt. Why don't you use a package like scrpage2 or fancyhdr

5
  • Do I edit this in report.cls/sty directly? Jun 4, 2011 at 15:39
  • 1
    You can copy the code into your header Jun 4, 2011 at 15:40
  • koma destroys the pre-existing layout somehow and I do not like its look. Additionally, I want the changes to be portable to other documents easily, that do not use koma. Jun 4, 2011 at 15:57
  • @Marco: you forgot the modification to the font in your edited example? Also, \pagestyle{headings} should go after the modificatition of \ps@headings. Jun 4, 2011 at 16:06
  • @Gonzalo: I edited my post. Jun 4, 2011 at 16:10
3

This is the definition of \chaptermark in report.cls for the headings page style (one sided):

\def\chaptermark#1{%
  \markright {\MakeUppercase{%
    \ifnum \c@secnumdepth >\m@ne
        \@chapapp\ \thechapter. \ %
    \fi
    #1}}}

Your needs seem to be twofold: "KAPITEL 1." bold and the chapter title medium face. There's also the definition of \@oddhead to keep in mind:

\def\@oddhead{{\slshape\rightmark}\hfil\thepage}%

We have to change the way both commands act:

\makeatletter
\def\chaptermark#1{%
  \markboth {\MakeUppercase{%
    {\bfseries\ifnum \c@secnumdepth >\m@ne
        \@chapapp\ \thechapter.} \ %
    \fi
    #1}}{}}
\def\@oddhead{\rightmark\hfil\thepage}
\newcommand\tableofcontents{%
    \if@twocolumn
      \@restonecoltrue\onecolumn
    \else
      \@restonecolfalse
    \fi
    \chapter*{\contentsname
        \@mkboth{%
           {\bfseries\MakeUppercase\contentsname}}
           {{\bfseries\MakeUppercase\contentsname}}}%
    \@starttoc{toc}%
    \if@restonecol\twocolumn\fi
}
\makeatother

A similar adjustment should be done also to the definition of thebibliography and theindex (if you use them).

2
  • 1
    When I reread the question and noticed that only \chaptername and \thechapter` were to be boldfaced, I was going to edit my answer just to give this solution. Jun 4, 2011 at 16:13
  • @Gonzalo: it seems that this doesn't bother the OP.
    – egreg
    Jun 4, 2011 at 16:15

You must log in to answer this question.

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