ページヘッダーに著者とセクションをユーザーとして追加する方法

ページヘッダーに著者とセクションをユーザーとして追加する方法

私はさまざまな著者による版に取り組んでいます。実際のエッセイの著者を左ページ ヘッダーに設定し、実際のセクションのタイトルを右ページ ヘッダーに設定するにはどうすればよいでしょうか。次のように試しました。

\documentclass[12pt,twoside]{scrbook}
\usepackage[german]{babel}
\usepackage{blindtext}
\usepackage[ansinew]{inputenc} 
\usepackage{scrpage2}

%%
% Kopf- und Fußzeile
%%
\clearscrheadfoot
\lehead{\pagemark}
\chead[]{\rightmark}
\rohead{\pagemark}
\cfoot[\pagemark]{}
\pagestyle{scrheadings}
%\manualmark

%%
% Titel
%%
\renewcommand*{\chaptermarkformat}{}
\renewcommand*{\chapterheadstartvskip}{\vspace*{0.5\baselineskip}}
\renewcommand*{\chapterheadendvskip}{\vspace*{1\baselineskip}}
\makeatletter
\newcommand*{\orgichapter}{}
\let\orgichapter\chapter
\renewcommand*{\chapter}[1]{%
  \gdef\chapterauthor{#1}% 
  \orgichapter
}
\renewcommand*{\chapterformat}{}


\newlength{\authorindent}
\renewcommand*{\chapterheadendvskip}{%
  \ifx\chapterauthor\@empty\else
      \markboth{"Test"}{\chapterauthor}%
      \vskip\baselineskip\nobreak
      \settowidth{\authorindent}{{%
      \usekomafont{sectioning}\usekomafont{chapter}\chapterformat
    }}%
    \noindent\begin{large}\textit{\chapterauthor}\par\nobreak
    \global\let\chapterauthor\@empty \end{large}
 \fi
  \noindent\par\nobreak\vskip 1\baselineskip%
}
\makeatother


%%
% Dokumentenbeginn
%%
\begin{document}
\chapter{Harmann von Aue}[]{Das ist ein Test-Dokument}

\section{Sage es niemand, nur den Weisen}
\blindtext
\Blindtext\Blindtext
\section{Weil die Menge gleich verhöhnt}
\Blindtext


\end{document}

問題は、\section が \marboth を上書きすることのようです。ヘッダーで \manualmark を使用することもできますが、その場合、セクションがヘッダーにまったく表示されないというサイト効果が発生します。

答え1

パッケージfancyhdrを使用する

\usepackage{fancyhdr}

これを\begin{document}の後に置いてください

\pagestyle{fancy}
\fancyhf{}                    % Use fancyhdr
\fancyhead[LE]{\author}       %L for Left, E for Even page
\fancyhead[RE]{\rightmark}    %R for Right  E for Odd page

お役に立てれば幸いです!

関連情報