[texhax] tableofcontents
Tim McKenzie
tjm1983 at gmail.com
Sat Jul 12 01:08:05 CEST 2008
2008/7/12 Loeghmon T. Nejad <loeghmon at gmail.com>:
> What is the best way to organize table of contents in the following
> form(example):
>
> Charles Dickens
> Tale of Two Cities
> Oliver Twist
> etc.
> etc.
> William Shakespeare
> Othello
> Macbeth
> etc.
> etc.
> Writer One
> work 1
> work2
I'm in the middle of trying to typeset Dostoevsky's The Brothers
Karamazov, which requires something similar: The novel contains four
parts and an epilogue; each part contains three books; and each book
contains a number of chapters (as does the epilogue). (To further
complicate things, the books are numbered 1--12, but the chapter
numbers start at 1 again for each book.)
It's been a while since I organized the table of contents, but it
looks like I've done this:
%%%%%
\makeatletter
\providecommand*{\toclevel at mypart}{0}
\providecommand*{\toclevel at book}{1}
\providecommand*{\toclevel at mychapter}{2}
\makeatother
\usepackage[pagestyles]{titlesec}
\usepackage{titletoc}
\titleclass{\mypart}{page}[\part]
\newcounter{mypart}
\renewcommand{\themypart}{\Roman{mypart}}
\titleformat{\mypart}{\Huge\scshape\filcenter}{}{0pt}{}
\titlespacing{\mypart}{0pt}{9pc}{0pt}
\titleclass{\book}{page}[\mypart]
\newcounter{book}
\renewcommand{\thebook}{\Roman{book}}
\titleformat{\book}[display]{\bfseries\LARGE\filcenter}{Book
\thebook}{24pt}{\huge}
\titlespacing{\book}{0pt}{6pc}{0pt}
\titleclass{\mychapter}{straight}[\book]
\newcounter{mychapter}[book]
\renewcommand{\themychapter}{\arabic{mychapter}}
\titleformat{\mychapter}[display]{\filleft\bfseries\Large}{Chapter
\themychapter}{1ex}{\LARGE}
\titlespacing{\mychapter}{0pt}{24pt}{12pt}
\setmarks{book}{mychapter}
\newpagestyle{main}{
\headrule
\sethead[\thepage][][\small\bfseries\sffamily The Brothers
Karamazov: \booktitle]
{\small\bfseries\sffamily\mychaptertitle}{}{\thepage}}
\titlecontents{mypart}[0pt]{\addvspace{1pc}\scshape\Large}{}{}{}
\titlecontents{book}[1pc]{\addvspace{0.5pc}\bfseries\large}{Book
\thecontentslabel: }{}{}
\titlecontents{mychapter}[4pc]{}{\contentslabel{2em}}{}{\titlerule*[1pc]{.}\contentspage}
%%%%%
I seem to remember that the documentation for titilesec and titletoc
helped me a lot, so it's worth a look.
Tim
<><
More information about the texhax
mailing list