0

I have a problem with the book,twoside documentclass and the headings in the respective second chapterpages.

In \frontmatter I use Abstract and Acknowledgements. In the \mainmatter I use Contents, Introduction, ...

Now I want to set the header for the frontmatter for example without the chapternumber \thechapter and the header in the mainmatter with the chapternumber.

Is there a way to do it like this?

I tried

\if@mainmatter
\renewcommand\chaptermark[1]{\markboth{\textsc{\thechapter\ #1}}{}}  
\else
\renewcommand\chaptermark[1]{\markboth{\textsc{#1}}{}}
\fi

But it always displays the else branch.

Here is a MWE to show my problem.

\documentclass[12pt,a4paper,twoside]{book}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[ngerman,english]{babel}
\usepackage{blindtext}

\if@mainmatter
\renewcommand\chaptermark[1]{\markboth{\textsc{\thechapter\ #1}}{}}%
\else
\renewcommand\chaptermark[1]{\markboth{\textsc{#1}}{}}%
\fi

\begin{document}

\frontmatter
\chapter{Abstract}
\blindtext[4]
\chapter{Achknowledgements}
\blindtext[10]

\mainmatter
\tableofcontents
\chapter{Introduction}
\blindtext[15]

\end{document}

Thanks

  • 1
    Use \if@mainmatter inside the redefinition: \makeatletter \renewcommand\chaptermark[1]{\if@mainmatter ...\else ...\fi} \makeatother. Note that this does not affect the header entry of the table of contents. – esdd Nov 09 '16 at 13:09
  • yeah forgot \makeatletter \makeatother :( now it works damn – dokukaefer Nov 09 '16 at 13:13
  • 1
    this is a similar question (duplicate?): http://tex.stackexchange.com/questions/146106/remove-chapter-in-header-of-the-backmatter?rq=1 – dokukaefer Nov 09 '16 at 13:48
  • Maybe you can also search how to get »CONTENTS« in the page header with \scshape too. – esdd Nov 09 '16 at 14:17

1 Answers1

0

For the tableofcontents style I found in the book.cls the \newcommand\tableofcontents... which i reconfigured with: \renewcommand:

\renewcommand\tableofcontents{%  
  \if@twocolumn  
    \@restonecoltrue\onecolumn  
  \else  
    \@restonecolfalse  
  \fi  

  \chapter*{\contentsname  
  \@mkboth{%  
  \scshape{\contentsname}}{\scshape{\contentsname}}}%  
  \@starttoc{toc}%  
  \if@restonecol\twocolumn\fi  
}

this will change the CONTENTS style in the header. Equivalent you can also change the listoffigures and listoftables.