18

I am using the classicthesis package and would like to customize the page headers and the page numbers. Here is a test project that shows the problem.

\documentclass[dottedtoc, headinclude, footinclude=true]{scrreprt}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[pdfspacing]{classicthesis}
\usepackage{lipsum,kantlipsum} % Generates dummy text.

\begin{document}
\pagestyle{plain}
\tableofcontents

\pagestyle{scrheadings} % <--- Affects the page header and page number in the footer.

\part{Liechtenstein}
\chapter{Liechtenstein}\kant[1-6]\clearpage

\part{Germany}
\chapter{Germany}\kant[1-3]\clearpage
\section{Bavaria}\kant[1-6]\clearpage
\section{Hesse}\kant[1-6]

\end{document}

When I add \pagestyle{scrheadings} the page number jumps to the header as shown in the screenshot. I want the page numbers to stay at the footer. Nevertheless, I want a page header that shows the current chapter respectively the section. Please compile my example to recognize that some chapters do not have sections. It would be best, when I could manually decide whether the chapter name should be displayed on all pages of the chapter or whether the section names should appear.

Wrong page header

This following screenshots show how a page looks like with or without scrheadings enabled.

With or Without scrheadings

Desired layout:

  • Page number always in the footer.
  • Chapter name or section name in the header.
  • Total page numbers in the footer. (optional)
  • Manual configuration whether chapter or section name is shown in the header. (optional)

1 Answer 1

23

1. Redefining scrheadings
The redefinition of scrheading is described in chapter 5 in the KOMAscript-manual.

Add the following three lines to your MWE:

\clearscrheadfoot
\ohead{\rightmark}
\cfoot[\pagemark]{\pagemark}

You manipulate chapteror sectionin the header by changing between \leftmark and \rightmark in the second line, i.e.

\ohead{\rightmark}  % section-names in the header
\ohead{\leftmark}   % chapter-names in the header

If you use the option twoside to the class, you can use the command

\ohead{\headmark}

and have chapter names in the left-side heading and section names in the right-side headings, automagically.

Page number x of y
To have page number as ‘6 of 10’, add the package lastpage and redefine the cfoot to:

\cfoot[\pagemark]{\pagemark{} of \pageref{LastPage}}

NB! If you want the same page numbering in the part- and chapter-sides, add the same commands to the optional argument of \cfoot, i.e.

\cfoot[\pagemark{} of \pageref{LastPage}]% for pagestyle `scrplain`
     {\pagemark{} of \pageref{LastPage}}% for pagestyle `scrheading`

3. Section number in heading
To remove the section (or chapter-) number from the heading, in KOMAscript you use the commands:

 \renewcommand*{\sectionmarkformat}{}

and

 \renewcommand*{\chaptermarkformat}{}

Unfortunately, this does not work in classicthesis (the spaced smallcaps disappear). Instead, you have to use

\renewcommand{\sectionmark[1]{\markright{\spacedlowsmallcaps{#1}}}

4. Complete MWE
Your MWE with all your requirements implemented:

\documentclass[dottedtoc, headinclude, footinclude=true]{scrreprt}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[pdfspacing]{classicthesis}
\usepackage{lastpage,lipsum,kantlipsum} % Generates dummy text.


\pagestyle{scrheadings} % <--- Affects the page header 
                        % and page number in the footer.
\clearscrheadfoot
\ohead{\rightmark}  % comment this line and uncomment the next
                    % to switch to `chapter name` in the heading
%\ohead{\leftmark}  % comment out to 

\cfoot[\pagemark]{\pagemark}
    \cfoot[\pagemark{} of \pageref{LastPage}]% for pagestyle `scrplain`
     {\pagemark{} of \pageref{LastPage}}% for pagestyle `scrheading`

\renewcommand{\sectionmark}[1]{\markright{\spacedlowsmallcaps{#1}}}
% Remove section number from heading

\begin{document}

\tableofcontents


\part{Liechtenstein}
\chapter{Liechtenstein}\kant[1-6]\clearpage

\part{Germany}
\chapter{Germany}\kant[1-3]\clearpage
\section{Bavaria}\kant[1-6]\clearpage
\section{Hesse}\kant[1-6]

\end{document}
5
  • Beautiful! I owe you a beer!! Thank you so much.
    – JJD
    Sep 8, 2012 at 22:46
  • 1
    Remove section number from heading implemented.
    – Sveinung
    Sep 9, 2012 at 9:35
  • Your solution works great. I did not receive any notification from SE why I missed your edit. Thank you once again! (I removed my former comments)
    – JJD
    Sep 10, 2012 at 10:17
  • Hello @Sveinung, can you take a look to this question please? tex.stackexchange.com/questions/447489/… Aug 24, 2018 at 10:17
  • @GennaroArguzzi Sorry for no reply. I have not been online for some days.
    – Sveinung
    Aug 27, 2018 at 8:23

You must log in to answer this question.

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