Hello:
I am preparing an edited book with my MikTeX 2.7. Usually, I use the book class. But `\def\chaptername{}' and `\def\thechapter{}' are not enough for my design of table of contents.
I want the table of content is as follows:
[title of chapter 1]
[the authors].................. 10
[title of chapter 2]
[the authors].................. 20
....
and the beginning of each chapter is as follows:
[title of chapter]
[the authors]
--bodytex--
Thank you very much for your supports and guides.
Document Classes ⇒ Document class for edited book?
Document class for edited book?
Hi,
the following code can give you some ideas to help you solve your problem. I defined the command \chapaut with a mandatory argument. The command must be used right after the \chapter commands; the mandatory argument will be used for the names of the authors of the corresponding chapter. The command includes the names after the chapter name and also includes the names in the ToC. I also used the titlesec and titletoc packages to fine tune the chapter headings and the ToC entries.
Of course, feel free to modify my example according to your needs.
the following code can give you some ideas to help you solve your problem. I defined the command \chapaut with a mandatory argument. The command must be used right after the \chapter commands; the mandatory argument will be used for the names of the authors of the corresponding chapter. The command includes the names after the chapter name and also includes the names in the ToC. I also used the titlesec and titletoc packages to fine tune the chapter headings and the ToC entries.
Code: Select all
\documentclass{book}
\usepackage{titlesec}
\usepackage{titletoc}
\usepackage{lipsum}% just to generate some text
\makeatletter
\newcommand*\l@authors{\@dottedtocline{1}{0pt}{0pt}}
\makeatother
\newcommand\chapaut[1]{%
\addcontentsline{toc}{authors}{#1}%
{\bfseries#1}\vskip35pt}
\titleformat{\chapter}[display]
{\normalfont\huge\bfseries}{}{20pt}{\Huge}[\addvspace{5pt}]
\titlespacing*{\chapter}
{0pt}{10pt}{0pt}
\titlecontents{chapter}
[0pt]{\addvspace{10pt}}{\bfseries}{\bfseries}{}
\begin{document}
\tableofcontents
\chapter{Test chapter one}
\chapaut{The name of the first author, The name of second author and The name of the third author}
\lipsum[1-20]
\chapter{Test chapter two}
\chapaut{The First author and The second author}
\lipsum[1-20]
\end{document}
1,1,2,3,5,8,13,21,34,55,89,144,233,...
-
- Posts: 21
- Joined: Thu Nov 19, 2009 6:00 am
Document class for edited book?
Thank you very much gmedina. It works well. Then how can I align chaptertitle (in the body text) in center as well as change the font of chaptertitle?
I tried the followings but it presents no good.
I tried the followings but it presents no good.
Code: Select all
\begin{center}
\chapter{The first}
\chapaut{{\it 1st author \& 2dn author}}
\end{center}
-
- Posts: 21
- Joined: Thu Nov 19, 2009 6:00 am
Document class for edited book?
Code: Select all
\titleformat{\chapter}[display]
{\normalfont\huge\bfseries\filcenter}{}{20pt}{\Huge}[\addvspace{5pt}]
\titlespacing*{\chapter}
{0pt}{10pt}{0pt}
\titlecontents{chapter}
[0pt]{\addvspace{10pt}}{\bfseries}{\bfseries}{}
Document class for edited book?
This solution works fine, but if faces a problem for me: in the TOC I only want the title of the chapter and its author, not the (sub)sections in the paper. If I add the command \setcounter{tocdepth}{0}, the (sub)sections disappear from the TOC, as required, but so does the chapter author name. Is there a way of getting rid of (sub)sections in the TOC while keeping the author name?
Document class for edited book?
simply shift the authors-entry to chapter levelgvw0139 wrote:Is there a way of getting rid of (sub)sections in the TOC while keeping the author name?
Code: Select all
\makeatletter
\newcommand*\l@authors{\@dottedtocline{0}{0pt}{0pt}}
\makeatother
Or, if you later want two versions, say one with authors in TOC and one without, leave \l@authors on level 1, shift the entry level for section to 2 and set tocdepth to 1 for keeping the authors in TOC:
Code: Select all
\setcounter{tocdepth}{1}
\makeatletter
\newcommand*\l@authors{\@dottedtocline{1}{0pt}{0pt}}
\renewcommand*\l@section{\@dottedtocline{2}{0pt}{0pt}}
\makeatother
Rainer