# Customizing headings using scrlayer-scrpage

Using the scrbook class, how do I customize the chapter plain pagestyle? I'd like to have the page number on the left on even pages and on the right on odd ones. Also, how do I get rid of the 'Chapter' in the headings? Here's a MWE

\documentclass[chapterprefix]{scrbook}
\usepackage{xcolor, graphicx, lipsum}
\definecolor{chaptergrey}{rgb}{0.7,0.7,0.7}
\usepackage{scrlayer-scrpage}

\let\raggedchapter\raggedleft
\setkomafont{chapter}{\LARGE}

\renewcommand*{\chapterformat}{%
\scalebox{5}{\color{chaptergrey}\thechapter}%
}

\clearmainofpairofpagestyles

\begin{document}
\chapter{A chapter}
\lipsum[1-30]
\end{document}


Note: I can't load the fancyhdr package because it causes problems, and I cannot remove the chapterprefix class option because I need it to have the chapter title below the chapter number.

As I've already told in my answer to your last question you can manipulate the chapter number in the running head by redefining \chaptermarkformat. The default definition is shown in the KOMA-Script manual:

\newcommand*{\chaptermarkformat}{%
\chapappifchapterprefix{\ }\thechapter\autodot\enskip}


\chapappifchapterprefix{\ } prints \chapapp followed by a space if option chapterprefix is enabled. \chapapp is the same like \@chapapp, which is \chaptername before \appendix and \appendixname after \appendix. So, if you do not want the prefix, redefine \chaptermarkformat like this:

\renewcommand*{\chaptermarkformat}{\thechapter\autodot\endskip}


If you even do not like the number, just use

\renewcommand*{\chaptermarkformat}{}


As also shown in the same answer, to get automatic running heads, you have to load scrlayer-scrpage with option automark. This would use chapter titles for the even pages and section titles for the odd pages. Alternatively you can use command \automark and \automark* to influence the content of the automatic running head. See the KOMA-Script manual for more information.

If you want the running head aligned to the inner margin and the page number aligned to the outer margin, you can use \ihead for the running head marks and \ohead for the pagination marks. To add the page numbers also to the plain pages, you should use the *-variant. To remove the default marks from the headings and the plain page style you should use \clearpairofpagestyles. \clearmainofpagestyles only cleans up the marks from the headings pagestyle of the pair.

So

\documentclass[chapterprefix]{scrbook}
\usepackage{xcolor, graphicx, blindtext}
\usepackage[automark]{scrlayer-scrpage}

\definecolor{chaptergrey}{rgb}{0.7,0.7,0.7}

\let\raggedchapter\raggedleft
\setkomafont{chapter}{\LARGE}

\renewcommand*{\chapterformat}{%
\scalebox{5}{\color{chaptergrey}\thechapter}%
}

\renewcommand*{\chaptermarkformat}{}% If you want running heads without
% chapter number.
\clearpairofpagestyles
\ihead*{\pagemark}% page number also on plain pages

\begin{document}
\blinddocument
\end{document}


will result in:

and

\documentclass[chapterprefix]{scrbook}
\usepackage{xcolor, graphicx, blindtext}
\usepackage[automark]{scrlayer-scrpage}

\definecolor{chaptergrey}{rgb}{0.7,0.7,0.7}

\let\raggedchapter\raggedleft
\setkomafont{chapter}{\LARGE}

\renewcommand*{\chapterformat}{%
\scalebox{5}{\color{chaptergrey}\thechapter}%
}

\renewcommand*{\chaptermarkformat}{\thechapter\autodot\enskip}% only number,
% opional dot and white space, but no prefix
\clearpairofpagestyles
\ihead*{\pagemark}% page number also on plain pages