# How to reset \markright without breaking \sectionmark?

I'm using scrbook for a collection of papers. Every chapter has a different author, and is typeset with a custom command. I want the headers alternate between chapter and author (rather than whatever is section) -- so I redefine \markright and afterwards use \rightmark in scrlayer-scrpage's \cohead.

Here's an MWE:

\documentclass[a4paper,10pt,headings=optiontohead,version=last,openany]{scrbook}
\author{Immanuel Kant}
\title{Doubling section titles}
\usepackage{kantlipsum}\date{}
%% make individual papers chapters
\usepackage{suffix}
\renewcommand{\sectionmark}{}%prevent rewriting \markright
\renewcommand{\subsectionmark}{}%prevent rewriting \markright
\newcommand{\chapterauthor}[1]{\authortoc{#1}\printchapterauthor{#1}\markright{#1}}% setting \markright to author

\makeatletter
\newcommand{\printchapterauthor}[1]{%
{\parindent0pt\vspace*{-10pt}%
\par\nobreak\vspace*{30pt}}
}
\newcommand{\authortoc}[1]{%
\protect\contentsline{chapter}%
{\hskip1.3em\mdseries\scshape\protect\scriptsize#1}{}{}}
}
\makeatother
%% http://tex.stackexchange.com/a/228219/12934
\usepackage{scrlayer-scrpage}
\clearpairofpagestyles
\renewcommand{\chaptermarkformat}{}
\cfoot*{\pagemark}

\begin{document}
\maketitle
\chapter{Erst}
\chapterauthor{Auguste Comte}
\kant[2]
\section{Quite positive}
\kant[3]
\end{document}


Something happens because of fiddling with \sectionmark, and section titles print twice. My question is: What causes doubling of the titles and how to avoid it? Thank you for suggestions!

Both \sectionmark and \subsectionmark should take an argument:

\renewcommand{\sectionmark}[1]{}%prevent rewriting \markright
\renewcommand{\subsectionmark}[1]{}%prevent rewriting \markright


The \section command produces

\sectionmark{<title>}


and if you redefine \sectionmark to have no argument, the tokens {<title>} are not removed.

• This is it, thank you! I tried all sorts of random things, and it was so simple. – Ivan Kapitonov May 21 '15 at 17:41
• @IvanKapitonov Doubled section titles = bad definition of \sectionmark. ;-) – egreg May 21 '15 at 17:46
• Oh, I was dead sure it was \sectionmark -- but that didn't take me too far :) – Ivan Kapitonov May 21 '15 at 17:50

Because you are loading scrlayer-scrpage: Remove the (unnecessary) redefinitions of \sectionmark and \subsectionmark and use the possibilities of scrlayer-scrpage.

\usepackage{scrlayer-scrpage}
\automark{chapter}% -> section does not rewrite \markright
\clearpairofpagestyles
\renewcommand{\chaptermarkformat}{}
\cfoot*{\pagemark}


Then the chapter is in the header of even pages and whatever you set as argument of \markright is in the header of odd pages.

Here is a short MWE:

\documentclass[openany]{scrbook}
%\documentclass[openany]{book}
\usepackage{kantlipsum}
\newcommand{\chapterauthor}[1]{\markright{#1}}
%
\usepackage{scrlayer-scrpage}
\automark{chapter}
\clearpairofpagestyles
\renewcommand{\chaptermarkformat}{}
\cfoot*{\pagemark}
%
\begin{document}
\tableofcontents
\chapter{Erst}
\chapterauthor{Auguste Comte}
\kant[2]
\section{Quite positive}
\kant[1-10]
\chapter{Next}
\chapterauthor{Other author}
\section{Quite positive}
\subsection{Test}
\kant[1-10]
\end{document}


• Try with the standard book class but not with scrlayer-scrpage; but now I see the trick, with \automark{chapter}. – egreg May 22 '15 at 8:38
• Without scrlayer-scrpage (or the deprecated scrpage2) the command \automark is undefined. – esdd May 22 '15 at 8:54
• Of course it isn't. – egreg May 22 '15 at 9:05