# Displaying chapter authors in headers

I'm editing a book written by different authors, each chapter one or several authors. I would like to include the name of the authors of each chapter in the ToC, and also in the headers.

The answer from karlkoeller to the question Displaying author for each chapter in book explain a method to include the authors in the ToC. I would like to modify this method a little bit in order to be able to print them in the headers.

Here is my Minimal NotWorking Example:

\documentclass[11pt,portuges]{book}
\usepackage[T1]{fontenc}
\usepackage[latin9]{inputenc}
\usepackage{babel}
\usepackage[paperwidth=17cm,paperheight=24cm]{geometry}
\geometry{verbose,tmargin=2cm,bmargin=2cm,lmargin=2cm,rmargin=2cm}
\usepackage{fancyhdr}
\pagestyle{fancy}
\usepackage{lipsum}

\setcounter{secnumdepth}{3}
\setcounter{tocdepth}{3}

\makeatletter
\newcommand\thechapterauthor[1]{}
\newcommand\chapterauthor[1]{\authortoc{#1}\printchapterauthor{#1}}
\newcommand{\printchapterauthor}[1]{%
{\parindent0pt\vspace*{-25pt}%
\par\nobreak\vspace*{35pt}}
\newcommand{\authortoc}[1]{%
\protect\contentsline{chapter}%
{\hskip1.3em\mdseries\scshape\protect\scriptsize#1}{}{}}
\fancyhf{}
\makeatother

\begin{document}
\frontmatter
\title{Título}
\author{Autor}
\maketitle
\section*{Limiar}
\lipsum[2-4]
\tableofcontents{}

\mainmatter
\chapter{Chapter 1}
\chapterauthor{Zê Povinho}
\lipsum[1]
\section{Section 1}
\lipsum[1-8]
\section{Section 2}
\lipsum[3-7]
\chapter{Chapter 2}
\chapterauthor{L. Nemsei, P. Quemsabe}
\lipsum[3-4]
\section{Section 3}
\lipsum[2-5]
\subsection{Subsection 1}
\lipsum[5-8]
\end{document}


Pdflatex does not print any warnings or errors, but the name of the authors does not appear in the headers. What to do?

• Don't show only some snippets, create a small, complete example that demonstrates the problem. That makes it much easier to test. – Ulrike Fischer Dec 21 '18 at 16:31

It is sufficient to make \chapterauthor to define \thechapterauthor:
\newcommand\thechapterauthor{} % initialize