# \chapterpagestyle with scrpage2 not working for toc, lof and lot

I wrote my master thesis with the document class scrbook from the KOMA script package and defined my own \chapterpagestyle with the package scrpage2:

\deftripstyle{ChapterPage}{}{}{}{}{}{\footnotesize\pagemark}
\renewcommand*{\chapterpagestyle}{ChapterPage}


This works pretty well for the whole document, except for the chapterpages for the TOC, LOF and LOT. This looks ugly, because the pages before and after do have numbers.

All I want to do is, moving the page number from bottom-center to bottom-right for the chapterpages.
So I used in addition a solution from here: How to set page number at right footer:

\usepackage{fancyhdr} % to change header and footers
\pagestyle{fancy} % Turn on the style
% Set the right side of the footer to be the page number
\fancyfoot[R]{\thepage}

% Redefine plain style, which is used for titlepage and chapter beginnings
% From https://tex.stackexchange.com/a/30230/828
\fancypagestyle{plain}{%
\fancyhf{}%
\fancyfoot[R]{\thepage}%
}


Then, when my first chapter starts (after ..., acknowledgment, abstract, TOC, LOF, LOT, ..., chapter 1) I'm activating the scriptstyle

\pagestyle{scrheadings}


The document compiles this way but there are some errors, because scrpage2 and fancyhdr are both defining a command named \chead.

How can I make the \chapterpagestyle also working with TOC, LOF and LOT with using scrpage2?

As far as I understand, the code above (using fancyhdr) just redefines the default plain pagestyle.
If this is possible with scrpage2, that would do the job for me totally.

Edit:
Changed scrpage2 to scrlayer-scrpage.
Redefining the page style plain like \deftripstyle{plain}{}{}{}{}{}{\footnotesize\pagemark}, as an analogous attempt to the code above, does not work.

• I suggest you read the KOMAscript manual. You should not use fancyhdr when you use a komascript class. the package scrlayer-scrpagehas all the functions you need to define the most advance headers and footers. – Sveinung Jan 3 '17 at 22:57
• I know. That's the reason I was looking for a solution without fancyhdr :-). It was just some kind of a bad workaround. Initially fancyhdr wasn't there. – dqpmsm Jan 3 '17 at 23:04

If only the page numbers should be at the same position on all pages including chapter pages, there is no need to define a new pagestyle. As in your fancyhdr could you can redefine the pagestyle plain which is the default pagestyle on chapter pages. Therefore you can use the optional argument of \ofoot or with scrlayer-scrpage the starred version of \ofoot.

\documentclass{scrbook}
\usepackage{tocloft}% do not use this package with a KOMA-Script class!
\usepackage[automark]{scrlayer-scrpage}
\clearpairofpagestyles
\ofoot*{\pagemark}

\usepackage{blindtext}% only for dummy text
\begin{document}
\tableofcontents
\Blinddocument
\end{document}


Result:

Or with the outdated package scrpage2:

\documentclass{scrbook}
\usepackage{tocloft}% do not use this package with a KOMA-Script class!
\usepackage[automark]{scrpage2}
\ofoot[\pagemark]{\pagemark}

\usepackage{blindtext}% only for dummy text
\begin{document}
\tableofcontents
\Blinddocument
\end{document}


During the creation of a compilable MWE, it came out that it was the fault of the package tocloft, which I was loading in an earlier work for some reason.
After commenting it out everything went well.
Moving \usepackage{tocloft} before \usepackage{scrlayer-scrpage} did not help.

Now, that was hours of blind man's buff.
Such a waste of time. Normally I'm marking every potential incompatibility in the code.

• It is a well-known 'fact' that tocloft and KOMA do not fit together, as well as fancyhdr and KOMA is no good idea – user31729 Jan 3 '17 at 23:02
• That's the awkward part of this issue. I should have known that. But I used an old work as a basis for my thesis, with a lot of packages I don't even remember why I loaded them back in the days. The general configuration was just too nice to start from scratch... – dqpmsm Jan 3 '17 at 23:14