我正在使用以下内容:
\documentclass[10pt,twoside]{memoir}
\usepackage[german]{babel}
\usepackage{blindtext}
\usepackage[ansinew]{inputenc}
\renewcommand{\thesection}{\arabic{section}}
\setcounter{secnumdepth}{3} % Subsection mit Zähler (1.1) versehen
%%
% Kolumnentitel
%%
%\renewcommand{\chaptermark}[1]{ \markboth{#1}{} } % Stil der Kopfzeile zurücksetzen
%\renewcommand{\sectionmark}[1]{ \markright{#1}{} } % Stil der Kopfzeile
% Page style
%\makepagestyle{mystyle}
%\makeevenhead{mystyle}{\thepage}{\small\chapterauthor}{}
%\makeoddhead{mystyle}{}{\slshape\leftmark}{\thepage}
%\pagestyle{mystyle}
%%
% Inhaltsverzeichnis
%%
\renewcommand*{\cftchapterdotsep}{\cftdotsep}
\settocdepth{chapter}
\renewcommand{\cftchapterfont}{\normalfont}
\renewcommand{\cftchapterpagefont}{\normalfont}
\makeatletter
\DeclareRobustCommand\authortoctext[1]{%
{\addvspace{10pt}\nopagebreak\leftskip0em\relax
\rightskip \@tocrmarg\relax
\noindent\itshape#1\par\addvspace{-7pt}}}
\makeatother
\newcommand\authortoc[1]{%
\gdef\chapterauthor{#1}%
\addtocontents{toc}{\authortoctext{#1}}}
%%
% Dokumentenbeginn
%%
\begin{document}
\tableofcontents*
\authortoc{Walter von der Vogelweide}
\chapter{Ich sass uf eynem Steine?}
\section{Und dachte Bein mit Beine}
\Blindtext\Blindtext\Blindtext\Blindtext
\authortoc{Hartman von Aue}
\chapter[Was auch immer]{So gebt nur mehr und immer mehr}
\section{Moralische Quellen der Irrationalitat}
\Blindtext\Blindtext\Blindtext\Blindtext
\end{document}
答案1
我想,这就是你想要的:我已经从我的另一个答案中更改了代码(汇编文章集的章节样式) 并重新使用它。
\documentclass{book}
\usepackage{xcolor}
\usepackage{xkeyval}
\usepackage{xparse}
\usepackage{blindtext}
\makeatletter
\let\latex@chapter\chapter
\def\latex@starttoc#1{%
\begingroup
\makeatletter
\@input{\jobname.#1}%
\if@filesw
\expandafter\newwrite\csname tf@#1\endcsname
\immediate\openout \csname tf@#1\endcsname \jobname.#1\relax
\fi
\@nobreakfalse
\endgroup
}
\newcommand{\NoNameAuthor}{Unknown}
\newcommand{\authortocname}{List of Authors}
\newcommand{\AuthorTocSectionDefaultOrder}{subtitle,author,date,journal,url} % Default sections
\NewDocumentCommand{\DeclareAuthorChapterKey}{m}{%
\define@key{authortoc}{#1}{%
\expandafter\def\csname kvauthortoc#1\endcsname{##1}
}%
\define@key{authortoc}{#1style}{%
\expandafter\def\csname kvauthortoc#1style\endcsname{##1}
}%
}
\DeclareAuthorChapterKey{title}
\DeclareAuthorChapterKey{author}
\DeclareAuthorChapterKey{pagenumber}
\DeclareAuthorChapterKey{chapter}
\def\@makechapterhead#1{%
\vspace*{50\p@}%
{\parindent \z@ \raggedright \normalfont
\ifnum \c@secnumdepth >\m@ne
\if@mainmatter
\@ifundefined{kvauthortocauthor}{}{%
\kvauthortocchapterstyle \kvauthortocauthor%
\par\nobreak
\vskip 20\p@
}%
\fi
\fi
\interlinepenalty\@M
\Huge \bfseries #1\par\nobreak
\vskip 20\p@
}
}
\NewDocumentCommand{\AddAuthorName}{mmm}{%
\addtocontents{autoc}{\protect\contentsline{chapter}{#2}{}}%
\addcontentsline{autoc}{chapter}{\protect\numberline\thechapter~#1}
}
\newcommand{\authortableofcontents}{%
\chapter*{\authortocname
\@mkboth{%
\MakeUppercase\contentsname}{\MakeUppercase\contentsname}}%
\latex@starttoc{autoc}%
}
\RenewDocumentCommand{\chapter}{somO{}}{%
\begingroup
\setkeys{authortoc}{author={\NoNameAuthor},#4}%
\IfBooleanTF{#1}{%
\latex@chapter*{#3}%
}{%
\IfValueTF{#2}{%
\latex@chapter[#2]{#3}
\AddAuthorName{\kvauthortoctitlestyle{#2}}{\kvauthortocauthorstyle{\kvauthortocauthor}}{\kvauthortocpagenumberstyle{\thepage}}%
}{%
\latex@chapter[#3]{#3}
\AddAuthorName{\kvauthortoctitlestyle{#3}}{\kvauthortocauthorstyle{\kvauthortocauthor}}{\kvauthortocpagenumberstyle{\thepage}}%
}%
}%
\endgroup
}
\makeatother
\newcommand{\DefaultAuthorStyle}[1]{%
{\normalsize \itshape #1}
}
\newcommand{\DefaultChapterStyle}[1]{%
{\Huge \bfseries #1}
}
\newcommand{\DefaultPagenumberStyle}[1]{%
{\bfseries \color{blue} #1}
}
\newcommand{\DefaultTitleStyle}[1]{%
{\bfseries #1}
}
\presetkeys{authortoc}{authorstyle=\DefaultAuthorStyle,
titlestyle={\DefaultTitleStyle},
pagenumberstyle=\DefaultPagenumberStyle,
chapterstyle={\DefaultChapterStyle},
}{}
\begin{document}
\authortableofcontents
\tableofcontents
\chapter{The Fellowship of the Ring}[author={J. R. R. Tolkien}]
\chapter{The Two Towers}[author={J.R.R. Tolkien}, authorstyle={\color{red}}]
\chapter{The Return of the King}[author={J.R.R. Tolkien}, pagenumberstyle={\bfseries \color{brown}}]
\chapter[High Castle]{The man in the high castle}[chapterstyle={\Huge \bfseries \color{orange}},author={J. P. Dick}, pagenumberstyle={\bfseries \color{brown}}]
\blindtext[10]
\chapter{Stoner}[author={John Williams}]
\blindtext[10]
\end{document}